[T-Mobile Samsung Galaxy Note II] dwitherell:
[size=+1]

How to do my particular twist on the data icon mod

[/size]

Alright, first off this is NOT the only way to do things - it just happens to be the way I did it. This does not make it better/worse than other approaches - do what works for you. For example, if you are comfortable using apktool or one of the front-end ui interfaces for apktool like apkmultitool or the like - great, you will be fine (just decompile and recompile the entirety of SystemUI.apk).

That being said - if you are following this a bit closer to what I've laid out you will need a few things up front for this guide to be of any use. Again - there are several ways/methods/tools that can be used to go about this process - what follows is just what I tend to use.

Ok, so this guide uses/requires the following:

Ability to use baksmali/smali

WHAT I USE:

- I have to use a Windows environment for work, so for better or worse I tend to stay there. To emulate the land o' linux, I use

CygWin

- there are better methods/tools I am sure, but this is the one I use based on previous non-android exposure to it.

- I also use the baksmali-1.4.2.jar and smali-1.4.2.jar (off-topic: looks like some nice changes in store for the 2.0 beta :) ) from

here

.

NOTE: To use the jars above you need to have java installed, though I believe you can use the "standard" java that is often already on a machine.

Ability to extract/replace files within an apk

WHAT I USE:

- Really this is just a fancy way of saying you need some sort of archiving utility to extract/replace the classes.dex you will pull from SystemUI.apk. I tend to use JZip or 7zip myself.

Ability to view/edit text files

WHAT I USE:

- Notepad++ is awesome. That is all.

Ok - now for the fun stuff :)

First you will need the SystemUI.apk (located in /system/app) for whatever UVBMB4-base rom you are using. Once you have that - open up the apk and pull out the classes.dex. To avoid any sorts of path issues, make a directory wherever and drop the classes.dex and the two .jars (baksmali and smali) into it. Now fire up CygWin and cd yourself to the directory where all that now resides.

Once there, do this:

java -jar baksmali-1.4.2.jar -a 16 -o /Path/to/the/directory/outSysUI/ classes.dex

This is basically saying "use this baksmali jar file and decompile this android 4.1.x classes.dex file and dump the output/decompiled stuff into the /Path/to/the/directory/outSysUI/ directory." You will of course need to edit things depending on where that directory (the one w/ classes.dex and the 2 jars) is.

There should now be a folder called outSysUI in the directory - go to it and then go to /com/android/systemui/statusbar/policy and open NetworkController.smali.

Ok, before getting into the code part of what I did, I thought I would offer a little background that explains my thinking behind getting this working.

In the NetworkController.smali I noticed there were a bunch of update...DataNetType()V methods, so I traced their calls back to a method called getUpdateDataNetType()V. It was there I saw that the method basically tests what network you are on, and based on that it calls a method that then uses/calls the appropriate icons to display. Given that, I looked around for an update...DataNetType()V sort of method that used the H (referenced as DATA_H here) icons, and while there were a few the method I really landed on was the updateDataNetType()V method. This appeared to be a general sort of call when no other carrier was detected (felt "AOSP"-ish), and more importantly it had the H icon references in it. I then looked at the TMobile one (updateTMoDataNetType()V) to see how it was structured, and noticed it was a wee bit simplified as far as some of the checks that were done compared to the more general method I was looking at - I also paid particular attention to the bits that call up the LTE relevant icons in the TMo-based method.

I decided to copy the general method to use as a base, and then trimmed out some of the unneeded calls based on their absense from the TMo-based method. I then edited/worked in the LTE icon calls (changing a DATA_ call and some resource ids at the appropriate pswitch location) from the TMo method to make a new method. That last part was a little tricky, but I just compared the pswtich calls at the end of both methods to figure out where the LTE call was in the TMo method and where it should go in the new method.

If interested in taking a crack at crafting it on your own - have at it! Make sure to pay special attention to how the TMo method calls the lte icons (there are some resource id calls that need to be transferred over :) You can always use the below for reference as well!

Below is the method I cobbled together. Paste it in it's entirety right above this line:

.method private final updateTMODataNetType()V

New method:

.method private final updateAccTMODataNetType()V
.registers 8

.prologue
const v6, 0x7f0200a3

const v5, 0x7f020096

const/4 v4, 0x0

const v3, 0x7f0a0069

const v2, 0x7f020097

.line 1423
iget v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataNetType:I

packed-switch v0, :pswitch_data_12c

:goto_12
return-void

.line 1528
:pswitch_13
sget-object v0, Lcom/android/systemui/statusbar/policy/TelephonyIcons;->DATA_G:[[I

iget v1, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mInetCondition:I

aget-object v0, v0, v1

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataIconList:[I

.line 1530
const v0, 0x7f0200a0

iput v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataTypeIconId:I

.line 1531
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContext:Landroid/content/Context;

const v1, 0x7f0a0068

invoke-virtual {v0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

move-result-object v0

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContentDescriptionDataType:Ljava/lang/String;

goto :goto_12

.line 1434
:pswitch_2c
sget-object v0, Lcom/android/systemui/statusbar/policy/TelephonyIcons;->DATA_G:[[I

iget v1, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mInetCondition:I

aget-object v0, v0, v1

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataIconList:[I

.line 1436
iput v4, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataTypeIconId:I

.line 1437
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContext:Landroid/content/Context;

const v1, 0x7f0a0068

invoke-virtual {v0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

move-result-object v0

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContentDescriptionDataType:Ljava/lang/String;

goto :goto_12

.line 1444
:pswitch_42
sget-object v0, Lcom/android/systemui/statusbar/policy/TelephonyIcons;->DATA_E:[[I

iget v1, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mInetCondition:I

aget-object v0, v0, v1

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataIconList:[I

.line 1446
const v0, 0x7f02009f

iput v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataTypeIconId:I

.line 1447
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContext:Landroid/content/Context;

const v1, 0x7f0a006d

invoke-virtual {v0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

move-result-object v0

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContentDescriptionDataType:Ljava/lang/String;

goto :goto_12

.line 1454
:pswitch_5b
sget-object v0, Lcom/android/systemui/statusbar/policy/TelephonyIcons;->DATA_3G:[[I

iget v1, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mInetCondition:I

aget-object v0, v0, v1

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataIconList:[I

.line 1455
iput v2, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataTypeIconId:I

.line 1456
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContext:Landroid/content/Context;

invoke-virtual {v0, v3}, Landroid/content/Context;->getString(I)Ljava/lang/String;

move-result-object v0

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContentDescriptionDataType:Ljava/lang/String;

goto/16 :goto_12

.line 1462
:pswitch_6f
iget-boolean v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mHspaDataDistinguishable:Z

if-eqz v0, :cond_8d

.line 1463
sget-object v0, Lcom/android/systemui/statusbar/policy/TelephonyIcons;->DATA_H:[[I

iget v1, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mInetCondition:I

aget-object v0, v0, v1

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataIconList:[I

.line 1464
const v0, 0x7f0200a1

iput v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataTypeIconId:I

.line 1465
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContext:Landroid/content/Context;

const v1, 0x7f0a006a

invoke-virtual {v0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

move-result-object v0

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContentDescriptionDataType:Ljava/lang/String;

goto/16 :goto_12

.line 1468
:cond_8d
sget-object v0, Lcom/android/systemui/statusbar/policy/TelephonyIcons;->DATA_3G:[[I

iget v1, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mInetCondition:I

aget-object v0, v0, v1

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataIconList:[I

.line 1469
iput v2, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataTypeIconId:I

.line 1470
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContext:Landroid/content/Context;

invoke-virtual {v0, v3}, Landroid/content/Context;->getString(I)Ljava/lang/String;

move-result-object v0

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContentDescriptionDataType:Ljava/lang/String;

goto/16 :goto_12

.line 1477
:pswitch_a1
iget-boolean v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mHspaDataDistinguishable:Z

if-eqz v0, :cond_bf

.line 1478
sget-object v0, Lcom/android/systemui/statusbar/policy/TelephonyIcons;->DATA_H_PLUS:[[I

iget v1, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mInetCondition:I

aget-object v0, v0, v1

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataIconList:[I

.line 1479
const v0, 0x7f0200a2

iput v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataTypeIconId:I

.line 1480
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContext:Landroid/content/Context;

const v1, 0x7f0a006a

invoke-virtual {v0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

move-result-object v0

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContentDescriptionDataType:Ljava/lang/String;

goto/16 :goto_12

.line 1483
:cond_bf
sget-object v0, Lcom/android/systemui/statusbar/policy/TelephonyIcons;->DATA_3G:[[I

iget v1, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mInetCondition:I

aget-object v0, v0, v1

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataIconList:[I

.line 1484
iput v2, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataTypeIconId:I

.line 1485
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContext:Landroid/content/Context;

invoke-virtual {v0, v3}, Landroid/content/Context;->getString(I)Ljava/lang/String;

move-result-object v0

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContentDescriptionDataType:Ljava/lang/String;

goto/16 :goto_12

.line 1493
:pswitch_d3
sget-object v0, Lcom/android/systemui/statusbar/policy/TelephonyIcons;->DATA_1X:[[I

iget v1, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mInetCondition:I

aget-object v0, v0, v1

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataIconList:[I

.line 1495
iput v5, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataTypeIconId:I

.line 1496
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContext:Landroid/content/Context;

const v1, 0x7f0a006c

invoke-virtual {v0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

move-result-object v0

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContentDescriptionDataType:Ljava/lang/String;

goto/16 :goto_12

.line 1503
:pswitch_ea
sget-object v0, Lcom/android/systemui/statusbar/policy/TelephonyIcons;->DATA_1X:[[I

iget v1, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mInetCondition:I

aget-object v0, v0, v1

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataIconList:[I

.line 1505
iput v5, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataTypeIconId:I

.line 1506
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContext:Landroid/content/Context;

const v1, 0x7f0a006c

invoke-virtual {v0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

move-result-object v0

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContentDescriptionDataType:Ljava/lang/String;

goto/16 :goto_12

.line 1516
:pswitch_101
sget-object v0, Lcom/android/systemui/statusbar/policy/TelephonyIcons;->DATA_3G:[[I

iget v1, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mInetCondition:I

aget-object v0, v0, v1

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataIconList:[I

.line 1517
iput v2, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataTypeIconId:I

.line 1518
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContext:Landroid/content/Context;

invoke-virtual {v0, v3}, Landroid/content/Context;->getString(I)Ljava/lang/String;

move-result-object v0

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContentDescriptionDataType:Ljava/lang/String;

goto/16 :goto_12

.line 1522
:pswitch_115
sget-object v0, Lcom/android/systemui/statusbar/policy/TelephonyIcons;->DATA_LTE:[[I

iget v1, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mInetCondition:I

aget-object v0, v0, v1

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataIconList:[I

.line 1523
iput v6, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mDataTypeIconId:I

.line 1524
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContext:Landroid/content/Context;

const v1, 0x7f0a00b6

invoke-virtual {v0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

move-result-object v0

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/NetworkController;->mContentDescriptionDataType:Ljava/lang/String;

goto/16 :goto_12

.line 1432
:pswitch_data_12c
.packed-switch 0x0
:pswitch_2c
:pswitch_13
:pswitch_42
:pswitch_5b
:pswitch_d3
:pswitch_101
:pswitch_101
:pswitch_ea
:pswitch_6f
:pswitch_6f
:pswitch_6f
:pswitch_13
:pswitch_101
:pswitch_115
:pswitch_101
:pswitch_a1
.end packed-switch
.end method

The last little bit of code editing is to replace the call to the original TMo data icon method with the new one. This call can be found in

.method private getUpdateDataNetType()V

Just search for

updateTMODataNetType()V

and replace that call with

updateAccTMODataNetType()V

(or whatever you end up calling it).

So for a more exact visual:

Instead of

invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/NetworkController;->updateTMODataNetType()V

it now says

invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/NetworkController;->updateAccTMODataNetType()V

Now save the NetworkController.smali and return to CygWin. Type the following:

java -Xmx1024M -jar smali-1.4.2.jar -a 16 outSysUI/ -o classes.dex

This is basically saying "using up to this much memory (1024M), use the smali-1.4.2.jar file to compile the contents of the outSysUI/ directory into a 4.1.x classes.dex file."

You then take that newly compiled classes.dex and drop it back into SystemUI.apk. Then you can push/flash the apk and blammo you are all set :)

Hope this helps folks :)