• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

[NEW] Stock Data Usage Monitor in Android 2.x

Search This thread

tweakradje

Senior Member
Mar 18, 2005
1,066
536
Android
sites.google.com
Decided to start a new thread on this subject since I could not find any correct info about it.
I decompiled phone.apk to check wether there was a data usage monitor in there. If you use Anycut you can select it (from of Phone.apk). Only it looks like it is disabled. Carriers wish? The data usage monitor in Android 2.x (like in ICS) might be useful :)

Anyway, after decompiling Phone.apk and searching for "datausage" there it was.

Files that are interesting are in com/android/phone:
- DataUsageListener.smali
- DataUsage.smali
- Settings.smali

com/android/phone/DataUsageListener
android/net/ThrottleManager

This answers a question I already had for a while: /data/system/throttle with temp file like:
1:6:0:0:0:0:0:0:0:0:0:0:0:0:2:1347228000000:1349820000000

In Settings.smali there is:

Code:
    :cond_a
    const-string v6, "throttle"

    invoke-virtual {p0, v6}, Lcom/android/phone/Settings;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Landroid/net/ThrottleManager;

    .line 473
    .local v5, tm:Landroid/net/ThrottleManager;
    new-instance v6, Lcom/android/phone/DataUsageListener;

    iget-object v7, p0, Lcom/android/phone/Settings;->mButtonDataUsage:Landroid/preference/Preference;

    invoke-direct {v6, p0, v7, v3}, Lcom/android/phone/DataUsageListener;-><init>(Landroid/content/Context;Landroid/preference/Preference;Landroid/preference/PreferenceScreen;)V

    iput-object v6, p0, Lcom/android/phone/Settings;->mDataUsageListener:Lcom/android/phone/DataUsageListener;

    .line 475
    const-string v6, "XEC"

    sget-object v7, Lcom/android/phone/Settings;->salesCode:Ljava/lang/String;

    invoke-virtual {v6, v7}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

and a ref to android.settings.secure:

Code:
/**
3936          * The bandwidth throttle polling freqency in seconds
3937          * @hide
3938          */
3939         public static final String THROTTLE_POLLING_SEC = "throttle_polling_sec";
3940 
3941         /**
3942          * The bandwidth throttle threshold (long)
3943          * @hide
3944          */
3945         public static final String THROTTLE_THRESHOLD_BYTES = "throttle_threshold_bytes";
3946 
3947         /**
3948          * The bandwidth throttle value (kbps)
3949          * @hide
3950          */
3951         public static final String THROTTLE_VALUE_KBITSPS = "throttle_value_kbitsps";
3952 
3953         /**
3954          * The bandwidth throttle reset calendar day (1-28)
3955          * @hide
3956          */
3957         public static final String THROTTLE_RESET_DAY = "throttle_reset_day";
3958 
3959         /**
3960          * The throttling notifications we should send
3961          * @hide
3962          */
3963         public static final String THROTTLE_NOTIFICATION_TYPE = "throttle_notification_type";
3964 
3965         /**
3966          * Help URI for data throttling policy
3967          * @hide
3968          */
3969         public static final String THROTTLE_HELP_URI = "throttle_help_uri";
3970 
3971         /**
3972          * The length of time in Sec that we allow our notion of NTP time
3973          * to be cached before we refresh it
3974          * @hide
3975          */
3976         public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC =
3977                 "throttle_max_ntp_cache_age_sec";
3978 
3979         /**
3980          * The maximum size, in bytes, of a download that the download manager will transfer over
3981          * a non-wifi connection.
3982          * @hide
3983          */
3984         public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
3985                 "download_manager_max_bytes_over_mobile";
3986 
3987         /**
3988          * The recommended maximum size, in bytes, of a download that the download manager should
3989          * transfer over a non-wifi connection. Over this size, the use will be warned, but will
3990          * have the option to start the download over the mobile connection anyway.
3991          * @hide
3992          */
3993         public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
3994                 "download_manager_recommended_max_bytes_over_mobile";
3995



This is W.I.P....... will come back soon

Cheers
 
Last edited:

tweakradje

Senior Member
Mar 18, 2005
1,066
536
Android
sites.google.com
Ok, when listing all services on my 2.3.6 stock rom I see that throttle service is running:

# service list
...
24 throttle: [android.net.IThrottleManager]
...

In logcat I see the throttle service starting:
I/SystemServer( 179): Throttle Service
I/SystemServer( 179): throttleF systemReady

So now I will try to add some records to the secure db with sqlite3 for throttle.


EDIT: seems like throttle has nothing todo with data usage reporting. Only with
narrowing your bandwith when a certain amount of data is reached.
http://forum.xda-developers.com/showthread.php?t=1798279&highlight=throttle+notification+type
Perhaps DataUsageListener hooks into that service?
 
Last edited:
  • Like
Reactions: jimam

tweakradje

Senior Member
Mar 18, 2005
1,066
536
Android
sites.google.com
Ok now I have entered some values for throttling into the secure table of android.settings

(ref: https://www.codeaurora.org/git/proj.../java/com/android/server/ThrottleService.java)

### check current throttle settings
sqlite3 /data/data/com.android.providers.settings/databases/settings.db "SELECT * FROM secure WHERE name like 'throttle_%';"
27|throttle_reset_day|10
540|throttle_polling_sec|60
541|throttle_threshold_bytes|0
542|throttle_notification_type|2
543|throttle_value_kbitsps|100000000

These are the sqlite3 (must be rooted and sqlite3 installed) commands to get them into th db. These are test values. 60 sec sampling is too fast. Use 3600 for every hour.

### interval in secs for measuring kbytes used
sqlite3 /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) VALUES ('throttle_polling_sec', '60');"

### what is the limit in bytes after throttle_reset_day before start throttling 0=no throttle, don't show in phone settings
sqlite3 /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) VALUES ('throttle_threshold_bytes', '0');"

### do you want a notification (not the provider)
sqlite3 /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) VALUES ('throttle_notification_type', '2');"

### the new kbit/s is threshold is reached in the period (throttle_reset_day) 0=not measuring data usage?
sqlite3 /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) VALUES ('throttle_value_kbitsps', '100000000');"

If you want to update one of these values use:
## setting throttle kb to 1 Mb, it should start to throttle and give me a warning
sqlite3 /data/data/com.android.providers.settings/databases/settings.db "UPDATE secure SET value='1024000' WHERE name='throttle_threshold_bytes';"

27|throttle_reset_day|10
540|throttle_polling_sec|60
541|throttle_threshold_bytes|1024000
542|throttle_notification_type|2
543|throttle_value_kbitsps|100000000

Now I have rebooted my phone and throttling samples should provide data for datausage?

Cheers
 
Last edited:
  • Like
Reactions: jimam

tweakradje

Senior Member
Mar 18, 2005
1,066
536
Android
sites.google.com
I know I am talking to myself right now but hey.

How about this guys? Some progress. See screenshot.
Now only need to set the proper network adapter I guess.

config_datause_iface
public static final int config_datause_ifaceThe default iface on which to monitor data use
Code:
# netcfg
netcfg
lo       UP    127.0.0.1       255.0.0.0       0x00000049
dummy0   DOWN  0.0.0.0         0.0.0.0         0x00000082
rmnet0   DOWN  0.0.0.0         0.0.0.0         0x00001002
rmnet1   DOWN  0.0.0.0         0.0.0.0         0x00001002
rmnet2   DOWN  0.0.0.0         0.0.0.0         0x00001002
rmnet3   DOWN  0.0.0.0         0.0.0.0         0x00001002
rmnet4   DOWN  0.0.0.0         0.0.0.0         0x00001002
rmnet5   DOWN  0.0.0.0         0.0.0.0         0x00001002
rmnet6   DOWN  0.0.0.0         0.0.0.0         0x00001002
rmnet7   DOWN  0.0.0.0         0.0.0.0         0x00001002
usb0     DOWN  0.0.0.0         0.0.0.0         0x00001002
tunl0    DOWN  0.0.0.0         0.0.0.0         0x00000080
gre0     DOWN  0.0.0.0         0.0.0.0         0x00000080
sit0     DOWN  0.0.0.0         0.0.0.0         0x00000080
wlan0    DOWN  0.0.0.0         0.0.0.0         0x00001002
pdp0     UP    188.90.76.237   255.255.255.0   0x000010d1
logcat says:
D/ThrottleService( 179): onPolicyChanged testing=false, period=60, threshold=1024000, value=100000000, resetDay=10, noteType=2, maxNtpCacheAge=86400

D/ThrottleService( 179): onResetAlarm - last period had 0 bytes read and 0 written
Not bad I would say :)

EDIT: config_datause_iface seems to be bolted down in the framework-res.apk (rmnet0). Will look at it later.


Cheers
 

Attachments

  • Data_Usage_on_stock_android_2.3.jpg
    Data_Usage_on_stock_android_2.3.jpg
    100 KB · Views: 1,120
Last edited:

tweakradje

Senior Member
Mar 18, 2005
1,066
536
Android
sites.google.com
In framework-res\res\values\strings.xml there is this line:

<string name="config_datause_iface">rmnet0</string>

change it to

<string name="config_datause_iface">pdp0</string>

and recompile the framework-res.apk and overwrite it in /system/framework folder.

Other default values in framework-res\res\values\integers.xml
<integer name="config_datause_polling_period_sec">600</integer>
<integer name="config_datause_threshold_bytes">0</integer>
<integer name="config_datause_throttle_kbitsps">300</integer>
<integer name="config_datause_notification_type">2</integer>

Cheers
 

tweakradje

Senior Member
Mar 18, 2005
1,066
536
Android
sites.google.com
IT WORKS !!!

After changing the framework-res.apk as described above the counter is running :)

From logd:

D/ThrottleService( 181): onPollAlarm - roaming =false, read =263, written =52, new total =21056

Only I cannot select it, phone crashes (logcat):
W/dalvikvm( 1377): threadid=1: thread exiting with uncaught exception (group=0x40018578)
E/AndroidRuntime( 1377): FATAL EXCEPTION: main
E/AndroidRuntime( 1377): java.lang.RuntimeException: Unable to resume activity {com.android.phone/com.android.phone.Data
Usage}: java.util.MissingFormatArgumentException: Format specifier: 4$d
E/AndroidRuntime( 1377): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2124)
E/AndroidRuntime( 1377): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2139)
E/AndroidRuntime( 1377): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1672)
E/AndroidRuntime( 1377): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 1377): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
E/AndroidRuntime( 1377): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1377): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 1377): at android.app.ActivityThread.main(ActivityThread.java:3687)
E/AndroidRuntime( 1377): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1377): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 1377): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
E/AndroidRuntime( 1377): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
E/AndroidRuntime( 1377): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1377): Caused by: java.util.MissingFormatArgumentException: Format specifier: 4$d
E/AndroidRuntime( 1377): at java.util.Formatter.getArgument(Formatter.java:1131)
E/AndroidRuntime( 1377): at java.util.Formatter.doFormat(Formatter.java:1096)
E/AndroidRuntime( 1377): at java.util.Formatter.format(Formatter.java:1062)
E/AndroidRuntime( 1377): at java.util.Formatter.format(Formatter.java:1031)
E/AndroidRuntime( 1377): at java.lang.String.format(String.java:2177)
E/AndroidRuntime( 1377): at android.content.res.Resources.getString(Resources.java:283)
E/AndroidRuntime( 1377): at android.content.Context.getString(Context.java:196)
E/AndroidRuntime( 1377): at com.android.phone.DataUsageListener.updateUI(DataUsageListener.java:180)
E/AndroidRuntime( 1377): at com.android.phone.DataUsageListener.updatePolicy(DataUsageListener.java:139)
E/AndroidRuntime( 1377): at com.android.phone.DataUsageListener.resume(DataUsageListener.java:110)
E/AndroidRuntime( 1377): at com.android.phone.DataUsage.onResume(DataUsage.java:74)
E/AndroidRuntime( 1377): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1150)
E/AndroidRuntime( 1377): at android.app.Activity.performResume(Activity.java:3832)
E/AndroidRuntime( 1377): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2114)
E/AndroidRuntime( 1377): ... 12 more
E/ ( 181): Dumpstate > /data/log/dumpstate_app_error

The /data/system/throttle/-2065243490 file now looks like this:
1:6:2295795:4567981:0:0:0:0:301613:702561:0:0:0:0:1:1346450400000:1349042400000
The /data/system/throttle/temp file remains the same:
1:6:0:0:0:0:0:0:0:0:0:0:0:0:2:1347228000000:1349820000000

Cheers

ps: changed stock framework-res.apk for Galaxy Ace (S5830 - S5830XWKTM) attached.
 

Attachments

  • Data_Usage_01.jpg
    Data_Usage_01.jpg
    97.7 KB · Views: 816
  • framework-res.apk
    3.4 MB · Views: 230
  • data_Usage_02.jpg
    data_Usage_02.jpg
    88 KB · Views: 713
Last edited:

tweakradje

Senior Member
Mar 18, 2005
1,066
536
Android
sites.google.com
Is there someone out there that can help with the last problem? If I click the DataUsage button ithe phone service crash/restarts?

Code:
E/AndroidRuntime( 1377): java.lang.RuntimeException: Unable to resume activity {com.android.phone/com.android.phone.Data
Usage}: java.util.MissingFormatArgumentException: Format specifier: 4$d

Cheers
 
  • Like
Reactions: THeLogiC and jimam

stranxk

Senior Member
Jun 16, 2011
131
54
Veracruz
You seem to be doing an awesone job for gingerbread devices, keep going mate, i would like something like this for galaxy s advance in a near future.
 

LorD ClockaN

Inactive Recognized Developer
Sep 1, 2008
14,106
28,536
Veli Losinj
www.losinj.com
Little info.. when we first built ICS for Desire HD, data counter wasn't working..
there was a lot to be done to the kernel regarding XT_quota and similar stuff..

and only after that the counter started working fine..
so don't kill your self with fwb code, maybe the kernel doesn't support it.. I know Desire HD's GB kernel didn't!
 

tweakradje

Senior Member
Mar 18, 2005
1,066
536
Android
sites.google.com
Thx for your support guys.

The mobile data monitor part works ok. It even resets fine this morning to 0 Mb on day 1 of the month.
It is only the GUI part with the settings that FC the phone service. May indeed be missing a system variable.

The strange part is that if I disable the monitor as it was, the settings GUI does load but is greyed out (via custom shortcut in launcher).

See second image that show the screen that should load.

Any ideas?

Cheers
 

Attachments

  • Data_Usage_03.jpg
    Data_Usage_03.jpg
    90.7 KB · Views: 589
  • Data_Usage_04.jpg
    Data_Usage_04.jpg
    52.4 KB · Views: 526

cornelha

Senior Member
Dec 14, 2007
1,476
709
Cape Town
Why not just grab the dialer source, its available on just about any GB git branch out there. Its FOSS, no need to struggle with smali. Well done on finding this
 
Last edited:

Deadly

Senior Member
Jul 19, 2012
10,286
3,899
Bangalore
great work mate.. i do believe it needs some kernel support may be.. as for same reason firewall needs kernel support.. or its just some sigining problem? as you have modded framework-res.apk.. may be resigning all the system .apk files would solve it.. thanks for the work mate..
 

sihag

Senior Member
Dec 26, 2011
185
54
Jaipur
In framework-res\res\values\strings.xml there is this line:

<string name="config_datause_iface">rmnet0</string>

change it to

<string name="config_datause_iface">pdp0</string>

and recompile the framework-res.apk and overwrite it in /system/framework folder.

Other default values in framework-res\res\values\integers.xml


Cheers

What if we change:-
<integer name="config_datause_polling_period_sec">600</integer> This to 300
<integer name="config_datause_threshold_bytes">0</integer>
<integer name="config_datause_throttle_kbitsps">300</integer> This to 600
<integer name="config_datause_notification_type">2</integer>

Would'nt it change the polling speed of data to fast and changing throttle might help in more data per second?
 

sssomnath474

Senior Member
Mar 9, 2012
210
302
mars :P
www.facebook.com
hello i just added this lines on setting.xml
Code:
<com.android.settings.IconPreferenceScreen android:persistent="false" android:title="Data" android:key="button_data_usage_key" settings:icon="@drawable/data">
        <intent android:targetPackage="com.android.phone" android:action="android.intent.action.MAIN" android:targetClass="com.android.phone.DataUsage" />
    </com.android.settings.IconPreferenceScreen>

and got this
NWyHDtn.jpg
 

Top Liked Posts

  • There are no posts matching your filters.
  • 19
    Decided to start a new thread on this subject since I could not find any correct info about it.
    I decompiled phone.apk to check wether there was a data usage monitor in there. If you use Anycut you can select it (from of Phone.apk). Only it looks like it is disabled. Carriers wish? The data usage monitor in Android 2.x (like in ICS) might be useful :)

    Anyway, after decompiling Phone.apk and searching for "datausage" there it was.

    Files that are interesting are in com/android/phone:
    - DataUsageListener.smali
    - DataUsage.smali
    - Settings.smali

    com/android/phone/DataUsageListener
    android/net/ThrottleManager

    This answers a question I already had for a while: /data/system/throttle with temp file like:
    1:6:0:0:0:0:0:0:0:0:0:0:0:0:2:1347228000000:1349820000000

    In Settings.smali there is:

    Code:
        :cond_a
        const-string v6, "throttle"
    
        invoke-virtual {p0, v6}, Lcom/android/phone/Settings;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
    
        move-result-object v5
    
        check-cast v5, Landroid/net/ThrottleManager;
    
        .line 473
        .local v5, tm:Landroid/net/ThrottleManager;
        new-instance v6, Lcom/android/phone/DataUsageListener;
    
        iget-object v7, p0, Lcom/android/phone/Settings;->mButtonDataUsage:Landroid/preference/Preference;
    
        invoke-direct {v6, p0, v7, v3}, Lcom/android/phone/DataUsageListener;-><init>(Landroid/content/Context;Landroid/preference/Preference;Landroid/preference/PreferenceScreen;)V
    
        iput-object v6, p0, Lcom/android/phone/Settings;->mDataUsageListener:Lcom/android/phone/DataUsageListener;
    
        .line 475
        const-string v6, "XEC"
    
        sget-object v7, Lcom/android/phone/Settings;->salesCode:Ljava/lang/String;
    
        invoke-virtual {v6, v7}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
    
        move-result v6

    and a ref to android.settings.secure:

    Code:
    /**
    3936          * The bandwidth throttle polling freqency in seconds
    3937          * @hide
    3938          */
    3939         public static final String THROTTLE_POLLING_SEC = "throttle_polling_sec";
    3940 
    3941         /**
    3942          * The bandwidth throttle threshold (long)
    3943          * @hide
    3944          */
    3945         public static final String THROTTLE_THRESHOLD_BYTES = "throttle_threshold_bytes";
    3946 
    3947         /**
    3948          * The bandwidth throttle value (kbps)
    3949          * @hide
    3950          */
    3951         public static final String THROTTLE_VALUE_KBITSPS = "throttle_value_kbitsps";
    3952 
    3953         /**
    3954          * The bandwidth throttle reset calendar day (1-28)
    3955          * @hide
    3956          */
    3957         public static final String THROTTLE_RESET_DAY = "throttle_reset_day";
    3958 
    3959         /**
    3960          * The throttling notifications we should send
    3961          * @hide
    3962          */
    3963         public static final String THROTTLE_NOTIFICATION_TYPE = "throttle_notification_type";
    3964 
    3965         /**
    3966          * Help URI for data throttling policy
    3967          * @hide
    3968          */
    3969         public static final String THROTTLE_HELP_URI = "throttle_help_uri";
    3970 
    3971         /**
    3972          * The length of time in Sec that we allow our notion of NTP time
    3973          * to be cached before we refresh it
    3974          * @hide
    3975          */
    3976         public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC =
    3977                 "throttle_max_ntp_cache_age_sec";
    3978 
    3979         /**
    3980          * The maximum size, in bytes, of a download that the download manager will transfer over
    3981          * a non-wifi connection.
    3982          * @hide
    3983          */
    3984         public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
    3985                 "download_manager_max_bytes_over_mobile";
    3986 
    3987         /**
    3988          * The recommended maximum size, in bytes, of a download that the download manager should
    3989          * transfer over a non-wifi connection. Over this size, the use will be warned, but will
    3990          * have the option to start the download over the mobile connection anyway.
    3991          * @hide
    3992          */
    3993         public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
    3994                 "download_manager_recommended_max_bytes_over_mobile";
    3995



    This is W.I.P....... will come back soon

    Cheers
    5
    IT WORKS !!!

    After changing the framework-res.apk as described above the counter is running :)

    From logd:

    D/ThrottleService( 181): onPollAlarm - roaming =false, read =263, written =52, new total =21056

    Only I cannot select it, phone crashes (logcat):
    W/dalvikvm( 1377): threadid=1: thread exiting with uncaught exception (group=0x40018578)
    E/AndroidRuntime( 1377): FATAL EXCEPTION: main
    E/AndroidRuntime( 1377): java.lang.RuntimeException: Unable to resume activity {com.android.phone/com.android.phone.Data
    Usage}: java.util.MissingFormatArgumentException: Format specifier: 4$d
    E/AndroidRuntime( 1377): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2124)
    E/AndroidRuntime( 1377): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2139)
    E/AndroidRuntime( 1377): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1672)
    E/AndroidRuntime( 1377): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    E/AndroidRuntime( 1377): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
    E/AndroidRuntime( 1377): at android.os.Handler.dispatchMessage(Handler.java:99)
    E/AndroidRuntime( 1377): at android.os.Looper.loop(Looper.java:130)
    E/AndroidRuntime( 1377): at android.app.ActivityThread.main(ActivityThread.java:3687)
    E/AndroidRuntime( 1377): at java.lang.reflect.Method.invokeNative(Native Method)
    E/AndroidRuntime( 1377): at java.lang.reflect.Method.invoke(Method.java:507)
    E/AndroidRuntime( 1377): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
    E/AndroidRuntime( 1377): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
    E/AndroidRuntime( 1377): at dalvik.system.NativeStart.main(Native Method)
    E/AndroidRuntime( 1377): Caused by: java.util.MissingFormatArgumentException: Format specifier: 4$d
    E/AndroidRuntime( 1377): at java.util.Formatter.getArgument(Formatter.java:1131)
    E/AndroidRuntime( 1377): at java.util.Formatter.doFormat(Formatter.java:1096)
    E/AndroidRuntime( 1377): at java.util.Formatter.format(Formatter.java:1062)
    E/AndroidRuntime( 1377): at java.util.Formatter.format(Formatter.java:1031)
    E/AndroidRuntime( 1377): at java.lang.String.format(String.java:2177)
    E/AndroidRuntime( 1377): at android.content.res.Resources.getString(Resources.java:283)
    E/AndroidRuntime( 1377): at android.content.Context.getString(Context.java:196)
    E/AndroidRuntime( 1377): at com.android.phone.DataUsageListener.updateUI(DataUsageListener.java:180)
    E/AndroidRuntime( 1377): at com.android.phone.DataUsageListener.updatePolicy(DataUsageListener.java:139)
    E/AndroidRuntime( 1377): at com.android.phone.DataUsageListener.resume(DataUsageListener.java:110)
    E/AndroidRuntime( 1377): at com.android.phone.DataUsage.onResume(DataUsage.java:74)
    E/AndroidRuntime( 1377): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1150)
    E/AndroidRuntime( 1377): at android.app.Activity.performResume(Activity.java:3832)
    E/AndroidRuntime( 1377): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2114)
    E/AndroidRuntime( 1377): ... 12 more
    E/ ( 181): Dumpstate > /data/log/dumpstate_app_error

    The /data/system/throttle/-2065243490 file now looks like this:
    1:6:2295795:4567981:0:0:0:0:301613:702561:0:0:0:0:1:1346450400000:1349042400000
    The /data/system/throttle/temp file remains the same:
    1:6:0:0:0:0:0:0:0:0:0:0:0:0:2:1347228000000:1349820000000

    Cheers

    ps: changed stock framework-res.apk for Galaxy Ace (S5830 - S5830XWKTM) attached.
    4
    I know I am talking to myself right now but hey.

    How about this guys? Some progress. See screenshot.
    Now only need to set the proper network adapter I guess.

    config_datause_iface
    public static final int config_datause_ifaceThe default iface on which to monitor data use
    Code:
    # netcfg
    netcfg
    lo       UP    127.0.0.1       255.0.0.0       0x00000049
    dummy0   DOWN  0.0.0.0         0.0.0.0         0x00000082
    rmnet0   DOWN  0.0.0.0         0.0.0.0         0x00001002
    rmnet1   DOWN  0.0.0.0         0.0.0.0         0x00001002
    rmnet2   DOWN  0.0.0.0         0.0.0.0         0x00001002
    rmnet3   DOWN  0.0.0.0         0.0.0.0         0x00001002
    rmnet4   DOWN  0.0.0.0         0.0.0.0         0x00001002
    rmnet5   DOWN  0.0.0.0         0.0.0.0         0x00001002
    rmnet6   DOWN  0.0.0.0         0.0.0.0         0x00001002
    rmnet7   DOWN  0.0.0.0         0.0.0.0         0x00001002
    usb0     DOWN  0.0.0.0         0.0.0.0         0x00001002
    tunl0    DOWN  0.0.0.0         0.0.0.0         0x00000080
    gre0     DOWN  0.0.0.0         0.0.0.0         0x00000080
    sit0     DOWN  0.0.0.0         0.0.0.0         0x00000080
    wlan0    DOWN  0.0.0.0         0.0.0.0         0x00001002
    pdp0     UP    188.90.76.237   255.255.255.0   0x000010d1
    logcat says:
    D/ThrottleService( 179): onPolicyChanged testing=false, period=60, threshold=1024000, value=100000000, resetDay=10, noteType=2, maxNtpCacheAge=86400

    D/ThrottleService( 179): onResetAlarm - last period had 0 bytes read and 0 written
    Not bad I would say :)

    EDIT: config_datause_iface seems to be bolted down in the framework-res.apk (rmnet0). Will look at it later.


    Cheers
    3
    In framework-res\res\values\strings.xml there is this line:

    <string name="config_datause_iface">rmnet0</string>

    change it to

    <string name="config_datause_iface">pdp0</string>

    and recompile the framework-res.apk and overwrite it in /system/framework folder.

    Other default values in framework-res\res\values\integers.xml
    <integer name="config_datause_polling_period_sec">600</integer>
    <integer name="config_datause_threshold_bytes">0</integer>
    <integer name="config_datause_throttle_kbitsps">300</integer>
    <integer name="config_datause_notification_type">2</integer>

    Cheers
    2
    Is there someone out there that can help with the last problem? If I click the DataUsage button ithe phone service crash/restarts?

    Code:
    E/AndroidRuntime( 1377): java.lang.RuntimeException: Unable to resume activity {com.android.phone/com.android.phone.Data
    Usage}: java.util.MissingFormatArgumentException: Format specifier: 4$d

    Cheers