[MOD]/[HOWTO] Make E4GT ROMs show 1X/3G instead of just 3G! (EG30) |NEW METHOD|

Search This thread

nivron

Senior Member
Oct 21, 2010
933
774
Orlando, Florida
Update 05/30/12
Click here for the ICS version!

Greetings and Salutations, Epic 4G Touch Owners and other curious parties!

UPDATE!!!!!
Method now uses smali/baksmali to avoid errors with apktool.

Disclaimer: Just reading this may cause your head to burst, your phone to catch fire, dogs and cats may do the tango! I am not responsible for any bad stuff that happens from you reading or acting on the information in this thread.

If any ROM authors want to use this fix in their ROMs, I'm completely cool with that. A quick kudos in your credits section would be nice, though. :cool:

Background: One of the things that really peeves me off about Sprint is that they want us to think we always have 3G service. I know that I don't have 3G in all of the areas I travel, and I also don't when I am roaming.

Thankfully, the fix is quite simple! It was a bit more difficult than the fix for HTC Sense ROMs as the smali edit was not quite as simple.

This was my primary reason for rooting my phone, that's how aggravating it is for me. :eek:

Let's change this:
sc20111017143708.png


To this:
sc20111017151702.png


Credits
crawrj - For providing the stock ROM for me to fiddle with.

Calkulin - (indirectly) helped me find how to fix this for Sense ROMs which I wrote up here.

Samsung - for a relatively good phone. Hopefully the weird auto-brightness and battery life will be fixed next update.

The brave XDA members who try these instructions and report their success or failure!!!

XDA for being a great source of information!!!

XDA members for thinking outside of the box!!!


The fix:
This fix requires editing your SystemUI.apk file. If you are using one of the fine custom ROMs on XDA, be aware that the you or the author may have already made changes to the SystemUI.apk file, so using my file IS NOT RECOMMENDED.

If you are using the Stock Deodexed EG30 ROM, you can safely use my attached SystemUI.apk file. It may work with other "stock" ROMs, but this is the one I based it on.


This mod relies on the assumption that your ROM developer has not deleted any of the 1x graphic files in the ROM. The developer CAN theme or otherwise change the images as long as the file names remain the same.

What you need to perform this mod:
1. An Epic 4G Touch ROM ZIP file, or a phone running a Epic 4G Touch ROM -- AOSP ROMs already have the correct indicators.
2. The Java SDK -- So you can run Smali.
3. Smali/Baksmali -- So you can decompile/compile the classes.dex file.
4. Android SDK -- To push/pull files from your phone (adb only).
5. Some sort of archive tool (such as WinRAR, 7zip, etc).
5. A text editor capable of editing UNIX-formatted files. I recommend Notepad++, personally.

Ease Of Use Tips: Install Java SDK first, then Android SDK (if you need adb). Download the smali files (smali-1.2.8.jar and baksmali-1.2.8.jar at the time of this writing) to a new "working" folder where we can do our magic.

KEEP A COPY OF YOUR PRE-EDITED SYSTEMUI.APK FILE, just in case!

Instructions:
1a. [If you are using a ROM ZIP File]: Use 7zip/WinRAR/WinZip to open the ROM ZIP file. Navigate to system\app and extract SystemUI.apk to your "working" folder.

1b. [If you want to grab SystemUI.apk from your running phone]: Use adb to pull SystemUI.apk to your working folder. Example: adb pull /system/app/SystemUI.apk C:\Working\SystemUI.apk

To avoid problems, ONLY USE adb to pull/push SystemUI.apk. Phone apps may cause unknown issues.

2. Open SystemUI.apk in 7zip/WinRAR/WinZip (it's really a ZIP file) and extract classes.dex to your "working" folder.

3. Go to a command prompt in your "working" folder and run the following command: java -jar baksmali-1.2.8.jar -o SystemUI/ classes.dex

4. Browse to your "working" folder and see that there is now an SystemUI folder inside, with other subfolders. Browse to SystemUI\smali\com\android\systemui\statusbar\policy.

5. Edit the file called StatusBarPolicy.smali with your favorite UNIX-format compatible text editor and look for the following text. The key is to search for .line 1567. Edit the line below that is in BOLD.
Code:
    .line 1567
    :pswitch_5e
[B]    sget-object v0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->sDataNetType_3g:[[I[/B]

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

    aget-object v0, v0, v1

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

    goto :goto_23

5. Change that line to say sget-object v0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->sDataNetType_1x:[[I

7. Save StatusBarPolicy.smali

8. Go back to your command prompt, change to your "working" folder and issue the following command: java -jar smali-1.2.8.jar SystemUI/ -o newclasses.dex

9. If there weren't any errors, go ahead and rename the original classes.dex to classes.old and rename newclasses.dex to classes.dex.

10. Open SystemUI.apk in your favorite archiver (if you closed it earlier).

11. Drag the file called classes.dex from your "working" folder into SystemUI.apk and replace the one already in there.

12. Run the following commands to get the file on your phone:
Code:
adb remount
adb push SystemUI.apk /system/app/SystemUI.apk
adb shell stop
adb shell start

You should hear your bootup sound and then the changes should be instantly applied.


To Test:
1. Dial ##DEBUG# (##33284#) on your phone.
2. Enter your MSL (can be found by typing getprop ril.MSL from Terminal Emulator or adb shell).
3. Scroll to Others at the bottom of the list.
4. Click on HDR/1X Selection
5. Change from Hybrid Mode to CDMA Only Mode. This puts your phone in 1X only mode.
6. Press OK.
7. Verify 1X icon comes within 30 seconds, if you have service.
8. Repeat steps 4-7, substituting Hybrid Mode for CDMA Only Mode to switch back.

How I found this: Looking through a logcat as I tried to determine which of the many toggles in smali was responsible for 1x, I noticed that the line saying StatusBarPolicy( 6238) onDataconnectionStateChanged-S:1 T:6. When it would go back to 3G, it was S:1 T:7. Hence my choice of pswitch6.

Please let me know whether or not this worked for you. I'd like to make a list of ROMs (with applicable mods) this works for or doesn't work for.

I will do whatever I can to help if you are struggling. :) If there's something you don't understand, please let me know. I can update the instructions if I accidentally wrote something wrong.
 

Attachments

  • SystemUIfixed.apk
    323.8 KB · Views: 138
Last edited:

nivron

Senior Member
Oct 21, 2010
933
774
Orlando, Florida
OLD (OUTDATED AND MAY NOT WORK) INSTRUCTIONS, FOR ARCHIVE


What you need to perform this mod:
1. An Epic 4G Touch ROM ZIP file, or a phone running a Epic 4G Touch ROM -- AOSP ROMs already have the correct indicators.
2. Apktool -- To extract the files we need to edit.
3. Android SDK -- To push/pull files from your phone (adb only).
4. Some sort of archive tool (such as WinRAR, 7zip, etc).
5. A text editor capable of editing UNIX-formatted files. I recommend Notepad++, personally.

Ease Of Use Tips: Install Android SDK (if you need adb). Download the apktool files to a new "working" folder where we can do our magic.

KEEP A COPY OF YOUR PRE-EDITED SYSTEMUI.APK FILE, just in case!

Instructions:
1a. [If you are using a ROM ZIP File]: Use 7zip/WinRAR/WinZip to open the ROM ZIP file. Navigate to system\app and extract SystemUI.apk to your "working" folder. Also grab framework-res.apk from system\framework.

1b. [If you want to grab SystemUI.apk from your running phone]: Use adb to pull SystemUI.apk and framework-res.apk to your working folder. Example: adb pull /system/app/SystemUI.apk C:\Working\SystemUI.apk and adb pull /system/framework-res.apk C:\Working\framework-res.apk To avoid problems, ONLY USE adb to pull/push SystemUI.apk. Phone apps may cause unknown issues.

2. Go to a command prompt in your "working" folder and run the following commands:
apktool if framework-res.apk
apktool d SystemUI.apk

3. Browse to your "working" folder and see that there is now an SystemUI folder inside, with other subfolders. Browse to SystemUI\smali\com\android\systemui\statusbar\policy.

4. Edit the file called StatusBarPolicy.smali with your favorite UNIX-format compatible text editor and look for the following text. The key is to search for pswitch_6 (you want the second result).
Code:
    .line 1567
    :pswitch_6
    [B]sget-object v0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->sDataNetType_3g:[[I[/B]

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

    aget-object v0, v0, v1

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

    goto :goto_0

5. Change that line to say sget-object v0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->sDataNetType_1x:[[I

6. Save StatusBarPolicy.smali

7. Go to a command prompt in your "working" folder and run the following command: apktool b SystemUI SystemUIfixed.apk

8. If there are no errors, open SystemUI.apk and SystemUIfixed.apk in your archiver of choice (WinRAR, 7-zip, etc.)

9. Drag the file called classes.dex from SystemUIfixed.apk to SystemUI.apk and replace the one already in there.

10. Run the following commands to get the file on your phone:
a. adb remount
b. adb push SystemUI.apk /system/app/SystemUI.apk
c. adb shell stop
d. adb shell start


You should hear your bootup sound and then the changes should be instantly applied.
 
Last edited:
  • Like
Reactions: journeyman73

frifox

Senior Member
Oct 12, 2007
502
56
Portland, OR
7. Go to a command prompt in your "working" folder and run the following command: apktool b SystemUI SystemUIfixed.apk
just got an error at the step above
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\Users\Denis\AppData\Local\Temp\APKTOOL6011639570221402409.tmp, -I, C:\Users\Denis\apktool\framework\1.apk, -S, D:\cell\apktool\SystemUI\res, -M, D:\cell\apktool\SystemUI\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
at brut.androlib.Androlib.buildResources(Androlib.java:248)
at brut.androlib.Androlib.build(Androlib.java:171)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:174)
at brut.apktool.Main.main(Main.java:59)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\Users\Denis\AppData\Local\Temp\APKTOOL6011639570221402409.tmp, -I, C:\Users\Denis\apktool\framework\1.apk, -S, D:\cell\apktool\SystemUI\res, -M, D:\cell\apktool\SystemUI\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:83)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
... 6 more
 

nivron

Senior Member
Oct 21, 2010
933
774
Orlando, Florida
just got an error at the step above

Looks like it's having issues loading aapt. Which files did you download? The apktool-install-windows-r04-brut1.tar.bz2 and apktool1.4.1.tar.bz2, right? What folder did you put them into, and are you running the command from the same folder you extracted the apktool files into?

If you're using the file I listed above, and you have extracted apktool into the working folder (including aapt.exe and the JAR file from the other archive), could you try copying apktool.bat and aapt.exe into your Windows folder (or put the apktool folder in your PATH) and try again?

From the apktool webpage:
Windows:

Download apktool-install-windows-* file
Download apktool-* file
Unpack both to your Windows directory
 
Last edited:

frifox

Senior Member
Oct 12, 2007
502
56
Portland, OR
Looks like it's having issues loading aapt. Which file did you download? The apktool-install-windows-r04-brut1.tar.bz2? What folder did you put it into, and are you running the command from the same folder you extracted aapt into?

If you're using the file I listed above, and you have extracted apktool into the working folder (including aapt.exe), could you try copying apktool.bat and aapt.exe into your Windows folder (or put the apktool folder in your PATH) and try again?
I got both aapt & apktool bat/jar files all in same folder (c:\cell\apktool) and am running the comands from that folder as well. Copying those files to Windows folder didn't work so i doubt its PATH issue.
 
Last edited:

nivron

Senior Member
Oct 21, 2010
933
774
Orlando, Florida
I got both aapt & apktool bat/jar files all in same folder (c:\cell\apktool) and am running the comands from that folder as well. Copying those files to Windows folder didn't work so i doubt its PATH issue.

Very strange -- are you able to paste the entire log of what apktool shows when you try to recompile? Maybe there is something in there that is helpful.
 

frifox

Senior Member
Oct 12, 2007
502
56
Portland, OR

nivron

Senior Member
Oct 21, 2010
933
774
Orlando, Florida
Thanks for the log. It doesn't like the custom "9" PNGs. I haven't really messed around with those, but I'll see what I can do to fix it.

Now that's really weird. I didn't have any problems doing it. I don't know if the custom "9" file is going to be broken, but you can try the attached file out if you like. There are other "9" files in the ROM that don't give me any sort of error. I wonder if there's just something wonky about that one particular file. Since I'm not using the "res" folder from the updated APK, the "9" files shouldn't really be touched, but YMMV.


Code:
nivron@aristotle:~/android/apks$ apktool d SB1.6SystemUI.apk 
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: /home/nivron/apktool/framework/1.apk
I: Loaded.
I: Decoding file-resources...
W: Cant find 9patch chunk in file: "drawable-hdpi/status_bar_close_on.9.png". Renaming it to *.png.
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
nivron@aristotle:~/android/apks

Then I made the edit...

Code:
ivron@aristotle:~/android/apks$ apktool b SB1.6SystemUI SB16SystemUIFixed.apk
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
I: Building apk file...
nivron@aristotle:~/android/apks
 

Attachments

  • SB1.6SystemUI.apk
    331.7 KB · Views: 6

frifox

Senior Member
Oct 12, 2007
502
56
Portland, OR
went to my linux box and tried it there, same error :confused: pushing your apk worked but can't test 3g/1x as my ##debug# doesnt work (tho ##data# does work). luckily the service here blows so i'm already seeing 1x icon here and there so i guess it worked :D
 

nivron

Senior Member
Oct 21, 2010
933
774
Orlando, Florida
Glad it worked!

went to my linux box and tried it there, same error :confused: pushing your apk worked but can't test 3g/1x as my ##debug# doesnt work (tho ##data# does work). luckily the service here blows so i'm already seeing 1x icon here and there so i guess it worked :D

I think I have an older apktool on my Linux box. Maybe that's why. Try grabbing your framework-res.apk and running: apktool if framework-res.apk before you decompile SystemUI.apk.

Sent from my SPH-D710 using Tapatalk
 
Last edited:

frifox

Senior Member
Oct 12, 2007
502
56
Portland, OR
nope, same error. could you load your older apktool version to mediafire? i'll give it a shot and see if that fixes anything.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 14
    Update 05/30/12
    Click here for the ICS version!

    Greetings and Salutations, Epic 4G Touch Owners and other curious parties!

    UPDATE!!!!!
    Method now uses smali/baksmali to avoid errors with apktool.

    Disclaimer: Just reading this may cause your head to burst, your phone to catch fire, dogs and cats may do the tango! I am not responsible for any bad stuff that happens from you reading or acting on the information in this thread.

    If any ROM authors want to use this fix in their ROMs, I'm completely cool with that. A quick kudos in your credits section would be nice, though. :cool:

    Background: One of the things that really peeves me off about Sprint is that they want us to think we always have 3G service. I know that I don't have 3G in all of the areas I travel, and I also don't when I am roaming.

    Thankfully, the fix is quite simple! It was a bit more difficult than the fix for HTC Sense ROMs as the smali edit was not quite as simple.

    This was my primary reason for rooting my phone, that's how aggravating it is for me. :eek:

    Let's change this:
    sc20111017143708.png


    To this:
    sc20111017151702.png


    Credits
    crawrj - For providing the stock ROM for me to fiddle with.

    Calkulin - (indirectly) helped me find how to fix this for Sense ROMs which I wrote up here.

    Samsung - for a relatively good phone. Hopefully the weird auto-brightness and battery life will be fixed next update.

    The brave XDA members who try these instructions and report their success or failure!!!

    XDA for being a great source of information!!!

    XDA members for thinking outside of the box!!!


    The fix:
    This fix requires editing your SystemUI.apk file. If you are using one of the fine custom ROMs on XDA, be aware that the you or the author may have already made changes to the SystemUI.apk file, so using my file IS NOT RECOMMENDED.

    If you are using the Stock Deodexed EG30 ROM, you can safely use my attached SystemUI.apk file. It may work with other "stock" ROMs, but this is the one I based it on.


    This mod relies on the assumption that your ROM developer has not deleted any of the 1x graphic files in the ROM. The developer CAN theme or otherwise change the images as long as the file names remain the same.

    What you need to perform this mod:
    1. An Epic 4G Touch ROM ZIP file, or a phone running a Epic 4G Touch ROM -- AOSP ROMs already have the correct indicators.
    2. The Java SDK -- So you can run Smali.
    3. Smali/Baksmali -- So you can decompile/compile the classes.dex file.
    4. Android SDK -- To push/pull files from your phone (adb only).
    5. Some sort of archive tool (such as WinRAR, 7zip, etc).
    5. A text editor capable of editing UNIX-formatted files. I recommend Notepad++, personally.

    Ease Of Use Tips: Install Java SDK first, then Android SDK (if you need adb). Download the smali files (smali-1.2.8.jar and baksmali-1.2.8.jar at the time of this writing) to a new "working" folder where we can do our magic.

    KEEP A COPY OF YOUR PRE-EDITED SYSTEMUI.APK FILE, just in case!

    Instructions:
    1a. [If you are using a ROM ZIP File]: Use 7zip/WinRAR/WinZip to open the ROM ZIP file. Navigate to system\app and extract SystemUI.apk to your "working" folder.

    1b. [If you want to grab SystemUI.apk from your running phone]: Use adb to pull SystemUI.apk to your working folder. Example: adb pull /system/app/SystemUI.apk C:\Working\SystemUI.apk

    To avoid problems, ONLY USE adb to pull/push SystemUI.apk. Phone apps may cause unknown issues.

    2. Open SystemUI.apk in 7zip/WinRAR/WinZip (it's really a ZIP file) and extract classes.dex to your "working" folder.

    3. Go to a command prompt in your "working" folder and run the following command: java -jar baksmali-1.2.8.jar -o SystemUI/ classes.dex

    4. Browse to your "working" folder and see that there is now an SystemUI folder inside, with other subfolders. Browse to SystemUI\smali\com\android\systemui\statusbar\policy.

    5. Edit the file called StatusBarPolicy.smali with your favorite UNIX-format compatible text editor and look for the following text. The key is to search for .line 1567. Edit the line below that is in BOLD.
    Code:
        .line 1567
        :pswitch_5e
    [B]    sget-object v0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->sDataNetType_3g:[[I[/B]
    
        iget v1, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mInetCondition:I
    
        aget-object v0, v0, v1
    
        iput-object v0, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mDataIconList:[I
    
        goto :goto_23

    5. Change that line to say sget-object v0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->sDataNetType_1x:[[I

    7. Save StatusBarPolicy.smali

    8. Go back to your command prompt, change to your "working" folder and issue the following command: java -jar smali-1.2.8.jar SystemUI/ -o newclasses.dex

    9. If there weren't any errors, go ahead and rename the original classes.dex to classes.old and rename newclasses.dex to classes.dex.

    10. Open SystemUI.apk in your favorite archiver (if you closed it earlier).

    11. Drag the file called classes.dex from your "working" folder into SystemUI.apk and replace the one already in there.

    12. Run the following commands to get the file on your phone:
    Code:
    adb remount
    adb push SystemUI.apk /system/app/SystemUI.apk
    adb shell stop
    adb shell start

    You should hear your bootup sound and then the changes should be instantly applied.


    To Test:
    1. Dial ##DEBUG# (##33284#) on your phone.
    2. Enter your MSL (can be found by typing getprop ril.MSL from Terminal Emulator or adb shell).
    3. Scroll to Others at the bottom of the list.
    4. Click on HDR/1X Selection
    5. Change from Hybrid Mode to CDMA Only Mode. This puts your phone in 1X only mode.
    6. Press OK.
    7. Verify 1X icon comes within 30 seconds, if you have service.
    8. Repeat steps 4-7, substituting Hybrid Mode for CDMA Only Mode to switch back.

    How I found this: Looking through a logcat as I tried to determine which of the many toggles in smali was responsible for 1x, I noticed that the line saying StatusBarPolicy( 6238) onDataconnectionStateChanged-S:1 T:6. When it would go back to 3G, it was S:1 T:7. Hence my choice of pswitch6.

    Please let me know whether or not this worked for you. I'd like to make a list of ROMs (with applicable mods) this works for or doesn't work for.

    I will do whatever I can to help if you are struggling. :) If there's something you don't understand, please let me know. I can update the instructions if I accidentally wrote something wrong.
    2
    Ok, another question...When I navigate to the statusbarpolicy.smali to try and edit it, I get a pop up window saying "windows dosen't recogize this program" So what program do I need installed to open this type of file?

    nivron should put a prerequisite in op: Basic knowledge of CLI and Notepad

    but yeah, edit that file with notepad++, not double click it and see what happens.
    2
    Having a little trouble. In the command prompt I ran this step:

    apktool if framework-res.apk and apktool d SystemUI.apk

    Those are supposed to written in two different lines:

    apktool if framework-res.apk [ENTER]
    apktool d SystemUI.apk [ENTER]
    1
    Changelog
    10/18/11 - Changed from apktool method to baksmali method because of Windows issues with apktool.
    1
    Could some1 help me out w/ instructions for an ODEX'd Stock EL29 ROM? The lack of 1x noti's a real pitty of a PitA.

    In EL29, the line has moved down from .line 1567 to .line 1588.

    The easiest thing is to just search for the "pswitch_5e".

    All the other steps to mod this for EL29 are identical to EG30.