[Samsung Epic 4G Touch] kobridge:
The information in here is only tested on the ICS (Stock based roms) and (stock or repacked kernels). It's not been tested on any other roms. So, if you want to apply the tweak that I provided in here, do it with your own risk. I'm here to help or share the good and bad things but not responsible for any bricked phones.

Update: Wifi Sleeps well! But you need to understand what's going on here.

We are expecting wifi to sleep when the screen is off and 'Keep Wi-Fi on during sleep' is set to 'Never'.

But wifi does not go to sleep mode even every options are satisfied on ICS stock roms with Stock or Rogue repacked Kernel).

I tried many ways to make it sleep (from settings, from build.prop tweaks and from through the init.d script) but none of those worked. Only the way to make it sleep is turning off the wifi manually before turning off the screen.

There is one workaround that making the wifi sleep during the screen off. The method is using Wifi Fixer app from google market but it does not work 100 %. Sometimes, it makes wifi sleep but other times, nothing happens.

So, anyone who is expecting wifi sleeps by any tweaks or by wifi option changes, don't expect it any more. There's no hope yet. For me, I'm waiting for the next build to test this function out.

There's some additional information at http://xdaforums.com/showthread.php?t=1625299 and check wifi section.

If anyone knows the method to make wifi sleep on stock rom/kernel, please post your info here. There are some tools that we can use to check wifi is sleeping or not during the sleep mode. I'm currently using Battery Widget Pro.

Because I've tested lots of things so far, if you know the methond or if it works on your phone, please show how it works and screenshots if possible.

[Update] Wifi sleeps finally as I wanted!

OK. Here is the story.

One specific app mis-led me to wroing conclusion - Battery Monitor Widget Pro (v2.2.4). This app shows that wifi is always on if wifi is turned on. This app does not exclude the time wifi was turned off during the sleep mode.

Plus, there's some pre-allocated time to make the wifi sleep after the screen turned off. For most of Android phones, it seems like this value is 15 minutes. So, even the screen is off, wifi does not enter to the sleep mode immediately. Phone spend 15 minutes after the screen off, and kill the wifi session if wifi option was set to never (keep wi-fi on during sleep).

How to check whether wifi sleeps or not :

Do NOT use Battery Monitor Widget to check the wifi status.

You can easily check it from the stock Battery app. Settings > Battery > click on the graph > check wi-fi status if there is any gap (means sleep or turned off).

Then, How to change the default 15 minutes value to make the phone sleep early?

Update 5/16/12 - Fixed wifiSleepWait tweak, so it works without any manual database handling. The below is just for informational. Now you don't need to manually create a row into the table.

There were one or two information available on XDA but nothing is correctly applicable to Epic 4G Touch. So, here is the tweak that I made for E4GT.

To do this you will need root explorer -

1. move to the folder, /data/data/com.android.providers.settings/

2. copy the databases folder to your /sdcard

3. Move to /sdcard/databases click settings.db

4. select secure

5. it will ask you which editor you are going to use. If you installed sqlite then select sqlite, otherwise use root explorer (only at first time)

6.Check if there is column name 'wifi_idle_ms'. If there is, then change the value to whatever mili seconds you want. For example, 10000 = 10 seconds, 30000=30seconds. If you want to wait 15 minutes until wifi sleep, then 15*60000 = ?

7.If there is no 'wifi_idle_ms' row, the click long time anywhere on the table. It will show you the actions, select new record. Do not change _id, put the 'wifi_idle_ms' in the name field (without quote sign) and put the value explained above. For me, I just put the 10000 (for 10 seconds). Click save.

8. Now you can see the value changed or row created. Exit editor and move up to /sdcard. Copy (or Move) databases folder to original location (/data/data/com.android.providers.settings/). Sometime, the copy is not successful because database is currently being used. If it's not copied, then try it agaon to copy until it's successful. For me, it was successful on second try.

9. Reboot the phone and click the power button shortly to change to screen off mode(sleep mode).

10. After the time passed defined in above, click the power button again and notice that phone was working on 4G or 3G mode and not wifi mode. Phone will try to reconnect wifi after the screen turned on.

11. That's it. Now you can change the idle time until wifi turned off as much as you want.

The above was the manual way to change the wifi_idle_ms value from database. But there is another way to change this values automatically. The method is using sqlite and of course you need to know the sql query.

In my case, I tried to add this sqlite query statement into my init.d tweak but only update sql command worked and insert was not successful. Maybe I need someone's help to get this insert statement successful.

In here, I'm adding only the update tweak which can be added into init.d. What this mean is, at first time you have to insert the database row manually but once it's created, you can update the idle value during the boot thru init.d script.

Because you don't need to run this init.d script everytime on boot, once you update the value, change the permission to 644 and it won't run again until you change it back to 755.

To run this init.d script, you will need sqlite3 - http://chensun.net/android-development/install-sqlite3-on-google-nexus-one/54/

Download it and simply move to /system/xbin foler. Assign the same permission like other files on the same folder.

Of course, you also need root access and busybox.

The init.d script will be found at http://xdaforums.com/showthread.php?t=1625299

70wifiSleepWait_kobridge.zip (previous version)

70wifiSleepWait_kobridge.v2.zip (current)