[HOWTO] Fix FastDormancy Battery drain without a full wipe/data-reset

Search This thread

uskr

Senior Member
Feb 12, 2011
113
75
After updating to XWKE2, some people reported their battery life greatly improved after doing a full factory reset on the device.

After some research I found out that all you have to do is delete the following files, if they exist on your system:

/data/data/com.android.providers.telephony/databases/nwk_info.db
/system/csc/nwk_info.db

(The second file may or may not exist.)

And reboot your phone. You will notice that FastDormancy will now do short pauses between queries on your logcat (5seconds or more), instead of query non-stop like crazy.

Better yet, if you have the skills, you can figure out which values to set on those databases to make FastDormancy work or disable it on networks that Dormancy is not supported.

Since there are hundreds of different networks out there, it would be impossible for me to figure out the configuration for each one of them, so for now just delete the file and you will already get a great improvement on your battery life.

If you want to know more about the FastDormancy problem, just search on this forum. There are a few threads that already discuss it in length.


Even better, here is how to set the FastDormancy pooling to a very high value, making it save even more battery when your network does not support Dormancy:

You will need to have the file /data/data/com.android.providers.telephony/databases/nwk_info.db on it's original location, so if you deleted, recover your backup copy back in place. If you dont have one anymore, you can download the attached file.

1. make sure the file /data/data/com.android.providers.telephony/databases/nwk_info.db exists
2. make sure you have sqlite3 binary installed (most people install it anyway while rooting). It's usually located at /system/xbin/sqlite3
3. open adb shell as root and execute:
# cd /data/data/com.android.providers.telephony/databases/
# getprop gsm.operator.numeric
310410 <-- write down this number, it's your carrier number and you will need it for the following commands
# sqlite3 nwk_info.db
sqlite> delete from dormpolicy where plmn="310410"; (replace the number 310410 on all commands with the number you got from the previous command)
sqlite> delete from nwkinfo where plmn="310410";
sqlite> insert into dormpolicy values("310410","My Carrier",30,30);
sqlite> insert into nwkinfo values("310410", "My Carrier", "off", 1500, "", "");
sqlite> (hit ctrl-d to exit sqlite3)
#

Done, FastDormancy will only pop on your adb logcat once every 30 seconds. you can change the number to whatever you want, in seconds.

Quick FAQ:

Q: But I don't have the second file?
A: That's fine, most people won't have it. But the code that checks for those files also checks for that one, so just in case I decided to make sure that one is deleted if ever exists.

Q: But that file may have more important network information?!
A: IT DOESN'T. If you take the time to open the file and look at it, you will se that it doesn't have much information at all. You will see it's ONLY contents are related to Dormancy, and NOTHING else. So if you are having FastDormancy problems, they already miss the information you need about your carrier anyway. Also, if you factory reset after KE2, it already delete those files.

Q: My battery usage seams the same!?
A: The problem only appears IF wifi is turned off or in "sleep mode". If you are testing it in those conditions, you won't see anything changed. You will only notice the fix while the phone has no wifi connectivity, has 3g on and is on standby. That's when FastDormancy goes nuts.

Q: How do I disable Dormancy?
A: If you wanna mess with the database or with ro.ril.disable.fd.plmn.prefix=23402,23410,23411, you can find your current network plmn running over adb shell the command: getprop gsm.operator.numeric . It's not guaranteed that it will turn it off. But if you have any luck, post here please. :)

Q: Why FastDormancy is there in the first place?
A: If your network support Dormancy AND the information required is on those databases, you can get a much improved battery life by using it. But only a few have that right now. Or at least working as intended.
 

Attachments

  • nwk_info.db.zip
    1.5 KB · Views: 1,018
Last edited:

jimyen

Senior Member
Dec 3, 2009
75
37
Will give it a try, thanks I hope it helps.

Sent from my GT-I9100 using XDA Premium App
 

darkalchemist

Senior Member
Aug 19, 2010
248
20
Something tells me that those dbs have network info that might be needed perhaps? I'm assuming there have been no side effects other than removing the fast dormancy problems?
 

CandyAndy

Senior Member
Jul 29, 2009
860
137
Just in case I will copy those files to somewhere else. I am not sure if deleting is the best option.
 

jangomango

Senior Member
Sep 20, 2010
518
111
Bournemouth
Battery much worse. Phone now in arabic, wont boot and also has lcd juice leaking out of the earphone socket

Sent from my GT-I9100 using XDA Premium App
 
  • Like
Reactions: poults

landerson07

Senior Member
May 3, 2011
239
22
I only had the first file to have moved that to my sd! Only time will tell I guess!

Sent from my GT-I9100 using Tapatalk
 

dan13l

Senior Member
Aug 3, 2005
360
15
Right, I'm an idiot, you can't see anything in the data directory without a decent file browser that takes advantage of superuser permissions.

I have now removed the first file (no trace of the second one, for reals) and will see how things go.

So far today, Android OS has account for 48 minutes of CPU in 5 hours, so it'll be interesting to see if that drops off...
 
Last edited:

unixbyte

Member
Jul 2, 2009
35
3
I'm an idiot, too.

Not moved and directly deleted that file.
Damnit.. Next time it might be helpful if you are NOT 100% sure that it helps, please don't tell to remove instead of moving file..

13 Sekunden means 13 SECONDS!
 

Attachments

  • SC20110519-154309.jpeg
    SC20110519-154309.jpeg
    88.9 KB · Views: 1,281

dan13l

Senior Member
Aug 3, 2005
360
15
Um, unixbyte, not sure what you're showing us there?

13 seconds of use isn't *really* enough to tell whether this has made a difference...
 

Top Liked Posts

  • There are no posts matching your filters.
  • 14
    After updating to XWKE2, some people reported their battery life greatly improved after doing a full factory reset on the device.

    After some research I found out that all you have to do is delete the following files, if they exist on your system:

    /data/data/com.android.providers.telephony/databases/nwk_info.db
    /system/csc/nwk_info.db

    (The second file may or may not exist.)

    And reboot your phone. You will notice that FastDormancy will now do short pauses between queries on your logcat (5seconds or more), instead of query non-stop like crazy.

    Better yet, if you have the skills, you can figure out which values to set on those databases to make FastDormancy work or disable it on networks that Dormancy is not supported.

    Since there are hundreds of different networks out there, it would be impossible for me to figure out the configuration for each one of them, so for now just delete the file and you will already get a great improvement on your battery life.

    If you want to know more about the FastDormancy problem, just search on this forum. There are a few threads that already discuss it in length.


    Even better, here is how to set the FastDormancy pooling to a very high value, making it save even more battery when your network does not support Dormancy:

    You will need to have the file /data/data/com.android.providers.telephony/databases/nwk_info.db on it's original location, so if you deleted, recover your backup copy back in place. If you dont have one anymore, you can download the attached file.

    1. make sure the file /data/data/com.android.providers.telephony/databases/nwk_info.db exists
    2. make sure you have sqlite3 binary installed (most people install it anyway while rooting). It's usually located at /system/xbin/sqlite3
    3. open adb shell as root and execute:
    # cd /data/data/com.android.providers.telephony/databases/
    # getprop gsm.operator.numeric
    310410 <-- write down this number, it's your carrier number and you will need it for the following commands
    # sqlite3 nwk_info.db
    sqlite> delete from dormpolicy where plmn="310410"; (replace the number 310410 on all commands with the number you got from the previous command)
    sqlite> delete from nwkinfo where plmn="310410";
    sqlite> insert into dormpolicy values("310410","My Carrier",30,30);
    sqlite> insert into nwkinfo values("310410", "My Carrier", "off", 1500, "", "");
    sqlite> (hit ctrl-d to exit sqlite3)
    #

    Done, FastDormancy will only pop on your adb logcat once every 30 seconds. you can change the number to whatever you want, in seconds.

    Quick FAQ:

    Q: But I don't have the second file?
    A: That's fine, most people won't have it. But the code that checks for those files also checks for that one, so just in case I decided to make sure that one is deleted if ever exists.

    Q: But that file may have more important network information?!
    A: IT DOESN'T. If you take the time to open the file and look at it, you will se that it doesn't have much information at all. You will see it's ONLY contents are related to Dormancy, and NOTHING else. So if you are having FastDormancy problems, they already miss the information you need about your carrier anyway. Also, if you factory reset after KE2, it already delete those files.

    Q: My battery usage seams the same!?
    A: The problem only appears IF wifi is turned off or in "sleep mode". If you are testing it in those conditions, you won't see anything changed. You will only notice the fix while the phone has no wifi connectivity, has 3g on and is on standby. That's when FastDormancy goes nuts.

    Q: How do I disable Dormancy?
    A: If you wanna mess with the database or with ro.ril.disable.fd.plmn.prefix=23402,23410,23411, you can find your current network plmn running over adb shell the command: getprop gsm.operator.numeric . It's not guaranteed that it will turn it off. But if you have any luck, post here please. :)

    Q: Why FastDormancy is there in the first place?
    A: If your network support Dormancy AND the information required is on those databases, you can get a much improved battery life by using it. But only a few have that right now. Or at least working as intended.
    2
    I noticed /system/etc/nwk_info.xml in XWKE7

    Code:
    	<NetworkInfos version="6">
    		<!-- Canada  -->
    	    <DormPolicy plmn="302610"
    	        nwkname="Bell"
                lcdonfdtime="0"
                lcdofffdtime="0"
    	    />
    	    <DormPolicy plmn="20404"
    	        nwkname="Bell"
                lcdonfdtime="0"
                lcdofffdtime="0"
    	    />
    		<!-- USA  -->
    		<DormPolicy plmn="31026"
    	        nwkname="T-Mobile"
                lcdonfdtime="0"
                lcdofffdtime="0"
    	    />
    		<DormPolicy plmn="310330"
    	        nwkname="T-Mobile"
                lcdonfdtime="0"
                lcdofffdtime="0"
    	    />
    		<DormPolicy plmn="310490"
    	        nwkname="T-Mobile"
                lcdonfdtime="0"
                lcdofffdtime="0"
    	    />
    		<DormPolicy plmn="310580"
    	        nwkname="T-Mobile"
                lcdonfdtime="0"
                lcdofffdtime="0"
    	    />
    		<DormPolicy plmn="310660"
    	        nwkname="T-Mobile"
                lcdonfdtime="0"
                lcdofffdtime="0"
    	    />
    		<DormPolicy plmn="31038"
    	        nwkname="Vodafone"
                lcdonfdtime="0"
                lcdofffdtime="0"
    	    />
    		<DormPolicy plmn="31090"
    	        nwkname="Vodafone"
                lcdonfdtime="0"
                lcdofffdtime="0"
    	    />
    		<DormPolicy plmn="310150"
    	        nwkname="Vodafone"
                lcdonfdtime="0"
                lcdofffdtime="0"
    	    />
    		<DormPolicy plmn="310410"
    	        nwkname="Vodafone"
                lcdonfdtime="0"
                lcdofffdtime="0"
    	    />
    		<DormPolicy plmn="310560"
    	        nwkname="Vodafone"
                lcdonfdtime="0"
                lcdofffdtime="0"
    	    />
    		<DormPolicy plmn="310680"
    	        nwkname="Vodafone"
                lcdonfdtime="0"
                lcdofffdtime="0"
    	    />
    	</NetworkInfos>

    Perhaps we should add our carriers into this list? Also, I disabled fast dormancy on mine via *#*#9900#*#* and it seems to have done the trick, though I also put in a db with 960 second interval between "checks" just in case :p
    2
    I copied sqlite3 from /data/data/com.keramidas.TitaniumBackup/files into /system/xbin - that did the trick.

    I could post my database if that would be helpful? Basically the result of "getprop gsm.operator.numeric" on my device was 23410. So if you get the same, my version of the database should have the fix for you.

    Edit: Here's the link to the modified database, just overwrite your existing one (I'd suggest making a back of it first though).

    https://dl.dropbox.com/s/5xf6446ivgbdsek/nwk_info.db?dl=1
    1
    I'll give it a try 2nt .
    1
    sqlite> insert into dormpolicy values("310410","My Carrier",30,30);

    It looks like the schema of the dormpolicy table has changed in Jelly Bean. With this schema, I was getting "getDormancyFromDB() DB not prepare error" (sic) errors in the output of
    Code:
    logcat -b radio | grep 'RIL::FD'
    when I enabled my data connection. I found the solution at http://www.pocketpc.ch/samsung-galaxy-s3/172760-info-fast-dormancy.html and it is to add two more columns to the table. As root:

    Code:
    # cd /data/data/com.android.providers.telephony/databases
    # sqlite3 nwk_info.db
    sqlite> ALTER TABLE dormpolicy ADD COLUMN lcdonfdtime_Rel8 TEXT;
    sqlite> ALTER TABLE dormpolicy ADD COLUMN lcdofffdtime_Rel8 TEXT;
    sqlite> UPDATE dormpolicy SET lcdonfdtime_Rel8='-1';
    sqlite> UPDATE dormpolicy SET lcdofffdtime_Rel8='-1';
    sqlite> .quit
    #

    logcat -b radio | grep 'RIL::FD' now reports:
    Code:
    E/RIL     ( 1852): [RIL::FD] getDormancyFromDB() Getting data from DB is done without any error
    shortly after enabling data.

    I did this on CyanogenMod 10.1.3.