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.
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.
SystemUI
-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.
-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:
-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...
-Once you have replaced all the IDs, recompile your SystemUI, push it back to your phone, and get ready to do Settings!
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.
-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...
NetworkTraffic.smali
SeekBarPreference.smali
ColorPickerDialog.smali
-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.
-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!
Enjoy!
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.***
***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.
SystemUI
-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:
Code:
<com.android.systemui.statusbar.policy.NetworkTraffic 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...
Code:
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"
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.***
***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...
NetworkTraffic.smali
Code:
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"
SeekBarPreference.smali
Code:
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"
ColorPickerDialog.smali
Code:
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"
[STRIKE]0x7f020035 <public type=“drawable” name=“ic_action_set”[/STRIKE]
*** 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. ***
*** 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.
Code:
<PreferenceScreen android:title="@string/network_traffic_title" android:key="network_traffic_state " android:summary="@string/network_traffic_summary" android:fragment="com.android.settings.temasek.NetworkTraffic" />
If I've left anything out, or if you have any questions on any part of the process, please feel free to ask!
Enjoy!
Attachments
Last edited: