[Samsung Epic 4G Touch] nivron:
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:

To this:

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.

.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:

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.