Remove All Ads from XDA

[MOD] [GUIDE] Status Bar Network Traffic (Separate In/Out)

1,389 posts
Thanks Meter: 2,563
Post Reply Email Thread
Hello XDA,

This guide will show you how to add network traffic data to your status bar, with customization options in Settings. There are already several similar guides on XDA, but all of the one I've seen only give you one overall speed, whereas this gives you separate in and out speeds.

Everything needed to make this mod work was pulled from CM12, so full credit goes to the Cyanogenmod Team and Temasek, who I believe contributed it to CM. Out of respect, I have left the Temasek folder structure intact, but you may alter it as you see fit...
I have tested this on Kit-Kat and Lollipop TouchWiz ROMs, and on AOSP Lollipop ROMs, but it should work on just about anything. If it does not work on your ROM for some reason, let me know and I'll see if I can help you figure it out.

***Before proceeding, MAKE A BACKUP***
***I am not responsible for any loss of data or ***
***damage to your device resulting from this mod.***

This mod assumes that you have working knowledge of how to decompile, edit, and recompile apps. If you do not, there are plenty of threads on XDA that will teach you. This is not one of them.

Now, let's get down to business....

We are going to be working with two apps, SystemUI and Settings (or SecSettings, depending on your ROM). Go ahead and decompile both of them, then download the attached zip file, and extract it to a location of your choice.

-Begin by copying the smali files from the attached zip to their respective location in your decompiled SystemUI. The correct folder structure is in the zip file, so just make sure you're putting them in the same place in your apk.
-Do the same thing for the .png files in drawable-xxhdpi.

***Note, if your device has a resolution lower than xxhdpi, you will probably need to resize the included images and place them in the drawable folder corresponding to your device's resolution***

-Next, open up the values folder in your decompiled SystemUI. In the corresponding folder in the zip file, you will see four xml files: colors, dimens, ids, and styles. Open them up one at a time, and add the lines to the same files in your values folder.
-Finally, go to layout/status_bar.xml in your decompiled SystemUI, and add the following line wherever you choose:
< android:id="@id/networkTraffic" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="false" />
***Note: Where you place this line determines where on your status bar it will be shown, so pay attention***

-Next, recompile your SystemUI, and once it's done, go ahead and decompile the one you just compiled (say that ten times fast).
-Go to res/values/public.xml, keep it open in a separate window, then open up smali/com/android/systemui/statusbar/policy/NetworkTraffic.smali. You are going to search the smali file for the IDs on the left, then search your public.xml for the matching string on the right, and replace the IDs in the smali with the corresponding ID from your public.xml. To make things simpler, I have also included a list of the IDs and what they correspond to in the zip file...
0x7f0c00c9    <public type="dimen" name="net_traffic_single_text_size"
0x7f0c00ca    <public type="dimen" name="net_traffic_multi_text_size"
0x7f02042a    <public type="drawable" name="stat_sys_network_traffic_updown"
0x7f020429    <public type="drawable" name="stat_sys_network_traffic_up"
0x7f020428    <public type="drawable" name="stat_sys_network_traffic_down"
-Once you have replaced all the IDs, recompile your SystemUI, push it back to your phone, and get ready to do Settings!

-This will be almost the same as SystemUI....Begin by copying the smali files from the zip to the corresponding locations in your decompiled Settings. Again, be sure to keep the folder structure intact.
-Next up, copy network_traffic.xml from the zip to res/xml, dialog_color_picker.xml and seek_bar_preference to res/layout, add the lines in the five files in values to the corresponding files in your res/values, and finally copy ic_action_set and ic_settings_backup.png to res/drawable-xxhdpi.

***Note: You don't have to worry about resizing ic_settings_backup if you're on a lower resolution device, as you'll never actually see it. It was part of the mod when I pulled it from CM12, so that's why it's here...***
***If you're on a lower resolution than xxhdpi, ic_action_set will need to be resized, or else it will be quite large (though still perfectly functional) in the color picker window.***

-Next, recompile your Settings, then immediately decompile it again (any guesses as to what comes next?)
-Open up res/values/public.xml in your decompiled Settings, and then navigate to the smali files you copied earlier. Again, you are going to search the smali for the IDs below, then search your public.xml for the string next to the ID, then replace the ID in the smali with the corresponding ID from your public.xml...

0x7f0e000f    <public type="integer" name="maskUp"
0x7f0e0010    <public type="integer" name="maskDown"
0x7f0e0011    <public type="integer" name="maskUnit"
0x7f0e0012    <public type="integer" name="maskPeriod"
0x7f09188a    <public type="string" name="network_traffic_color_reset"
0x7f09188b    <public type="string" name="network_traffic_color_reset_message"
0x7f091677    <public type="string" name="ok"
0x7f090198    <public type="string" name="cancel"
0x7f0700ef    <public type="xml" name="network_traffic"
0x7f09188a    <public type="string" name="network_traffic_color_reset"
0x7f02021d    <public type="drawable" name="ic_settings_backup"
0x7f0b0696    <public type="id" name="seekBarPrefBarContainer"
0x7f040229    <public type="layout" name="seek_bar_preference"
0x7f0b0694    <public type="id" name="seekBarPrefValue"
0x7f0b0693    <public type="id" name="seekBarPrefUnitsRight"
0x7f0b0695    <public type="id" name="seekBarPrefUnitsLeft"
0x7f04022b    <public type="layout" name="dialog_color_picker”
0x7f091920    <public type="string" name="dialog_color_picker"
0x7f0b069f    <public type="id" name="color_picker_view"
0x7f0b06a2    <public type="id" name="old_color_panel"
0x7f0b069a    <public type="id" name="new_color_panel"
0x7f0b069b    <public type="id" name="white_panel"
0x7f0b069d    <public type="id" name="black_panel"
0x7f0b069c    <public type="id" name="cyan_panel"
0x7f0b069e    <public type="id" name="red_panel"
0x7f0b06a0    <public type="id" name="green_panel"
0x7f0b06a1    <public type="id" name="yellow_panel"
0x7f0b06a5    <public type="id" name="hex"
0x7f0b06a6    <public type="id" name="enter"
0x7f0b069a    <public type="id" name="new_color_panel"
0x7f020035    <public type=“drawable” name=“ic_action_set”
*** NOTE: I made a mistake with 'ic_action_set' above. It is not ***
*** referenced in the smali, only in layouts. If I mentioned it in the ***
*** text file in the zip, please disregard it there as well. ***

-Finally, paste the following line into the xml corresponding to the Settings Category you wish the options to be listed under. These will either be in res/xml or res/layout. Personally, I've placed mine at the end of display_settings.xml.
<PreferenceScreen android:title="@string/network_traffic_title" android:key="network_traffic_state " android:summary="@string/network_traffic_summary" android:fragment="" />
-Once you're done, recompile you Settings.apk, push back to your phone, set permissions, reboot, and you should be all set!

If I've left anything out, or if you have any questions on any part of the process, please feel free to ask!
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2015-01-20-13-22-22.jpg
Views:	38908
Size:	221.5 KB
ID:	3154968   Click image for larger version

Name:	Screenshot_2015-01-20-13-22-33.jpg
Views:	38168
Size:	221.3 KB
ID:	3154969   Click image for larger version

Name:	Screenshot_2015-02-07-16-03-57.png
Views:	38460
Size:	89.1 KB
ID:	3154983  
Attached Files
File Type: zip - [Click for QR Code] (95.6 KB, 15404 views)
The Following 82 Users Say Thank You to Morningstar For This Useful Post: [ View ] Gift Morningstar Ad-Free
8th February 2015, 01:52 PM |#2  
sawixso81's Avatar
Senior Member
Thanks Meter: 908
Donate to Me
This is awesome but am I blind where is the downloadable zip? lol
The Following User Says Thank You to sawixso81 For This Useful Post: [ View ] Gift sawixso81 Ad-Free
8th February 2015, 01:54 PM |#3  
Senior Member
Flag Hanoi
Thanks Meter: 197
Donate to Me
Originally Posted by sawixso81

This is awesome but am I blind where is the downloadable zip? lol

+1 double lol!
The Following User Says Thank You to jafangie For This Useful Post: [ View ] Gift jafangie Ad-Free
8th February 2015, 01:58 PM |#4  
Senior Member
Thanks Meter: 63
This is a great post, but i did not imagine it would be so much work (even having to recompile)...

there's a great tool (free) which i use over 4 years, does exactly the same thing and does not require root:
Network Monitor Mini by KF Software House.

it will run not in the status bar, but just below it. if you make the label transparent, decrease font size and change the color to something more visible, it will be just perfect.

The Following 2 Users Say Thank You to lisbon2004 For This Useful Post: [ View ] Gift lisbon2004 Ad-Free
8th February 2015, 02:14 PM |#5  
MattBooth's Avatar
Senior Member
Flag Bradford
Thanks Meter: 13,779
I believe this was first on OmniROM before it was on CM (via Temasek or not), but good stuff I know I got it from there(Omni) for my CM build months ago.
The Following 2 Users Say Thank You to MattBooth For This Useful Post: [ View ] Gift MattBooth Ad-Free
8th February 2015, 02:24 PM |#6  
Hamidreza2010's Avatar
Senior Member
Thanks Meter: 475
@Morningstar where is attach dear?
8th February 2015, 02:24 PM |#7  
dahawthorne's Avatar
Senior Member
Flag Brighton
Thanks Meter: 1,433
Network Monitor Mini Pro
I've been using Network Monitor Mini Pro for maybe a couple of years, and Pro has an option to display upload & download speeds in the status bar. You'll see it in the middle of the status bar - size, width, font, position all configurable.

I don't have time or expertise to follow the decomple/recompile route, but respect to Morningstar for the post.
Attached Thumbnails
Click image for larger version

Name:	Network Monitor Mini Pro.jpg
Views:	5858
Size:	211.7 KB
ID:	3155763  
The Following User Says Thank You to dahawthorne For This Useful Post: [ View ] Gift dahawthorne Ad-Free
8th February 2015, 02:26 PM |#8  
happiness4u's Avatar
Senior Member
Flag xbin/busybox
Thanks Meter: 136
I'm using official CM12 for Nexus5, and I can't seem to find the network traffic options in settings by default?
8th February 2015, 02:33 PM |#9  
danieldmm's Avatar
Senior Member
Flag France
Thanks Meter: 11,884
Donate to Me
@Morningstar are you teasing us ? Forget to put the zip attached
8th February 2015, 03:21 PM |#10  
sawixso81's Avatar
Senior Member
Thanks Meter: 908
Donate to Me
Hey OP have a question for you I havent tried this yet but my said rom I am running has the network deal like this by thanhfhuongf(built into rom) but I was actually going to use your guide to reverse the mod back to stock, needless to say I managed to get it to how I want network indicator gone and regular 4g/lte icon back but the problem is the indicator arrows do not move I have web service able to browse web and download but no arrow movement Im thinking it has to with my icons because I did take from another stock systemUI and copyed/paste into my Current systemUI those icons and later on noticed that the original Icon was 54x54 in size where as my modded systemUI was bigger in size but any way if you can assist me give me a pm,thanks and I do plan on giving this a try I like the looks of this one better if I decide to give it ago.
8th February 2015, 04:44 PM |#11  
Awesome stuff morningstar. Thanx for sharing and taking the time to make this guide.

Sent from my SCH-I545 using Xparent BlueTapatalk 2
The Following User Says Thank You to Gunthermic For This Useful Post: [ View ] Gift Gunthermic Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes