2016-05-20

This is a guide for rooting your
AT&T Samsung Galaxy S4

SGH-I337,

upgrading to the latest firmware baseband,

installing the Xposed Framework,

removing bloatware, and

resetting the flash counter.

Purpose:

The purpose of this guide is to wipe and refresh your AT&T Samsung Galaxy S4 SGH-I337. Use this guide if, for example, your trusty old S4 has been getting a little too sluggish these days, or if you just inherited someone's old S4 and want to wipe their data and start fresh. After backing up what you want to keep, you'll wipe your phone, gain root access, and upgrade to the latest firmware baseband (without losing root) for the best stock firmware stability and security. At that point, your phone will be compatible with Xposed if you want to install it, and you could take a few minutes to debloat your App Drawer before reinstalling your favorite apps and configuring your phone's settings to your liking.

Disclaimer:

Following the instructions in this guide will result in your phone being wiped. While flashing different ROMs, Kernels, etc., you run the distinct risk of throwing a permanent KNOX Warranty Flag, not to mention the distinct risk of bricking your phone. Odin can get you out of a softbrick; but if, for example, you use this guide on the wrong phone, you could end up with a several hundred dollar hardbricked paperweight. Know the risks and take adequate precautions. Please read and understand this guide in its entirety before attempting to follow any of the instructions. This guide is meant to be followed in order from start to finish; however, you may be able to skip certain steps.

Prep Work
You will need an AT&T SGH-I337, a PC, and a USB cable to connect your phone and PC. There's also a few things to check on your phone and a few things to set up on your PC before we get underway.

Step 1: Make sure that your Samsung Galaxy S4 is in fact an AT&T SGH-I337.

To verify your phone's Model Number: Go to your Settings > open the More tab > select About Device > and check under Model Number for SAMSUNG-SGH-I337.

Step 2: Check which version of Android you're running. Depending on your Android Version, you may need to downgrade your firmware before you can root.

To check your phone's Android Version: Go to your Settings > open the More tab > select About Device > and check under Android Version.
If Android Version < 4.4.2: Your firmware is already rootable. :)
If Android Version = 4.4.2: Still on the About Device page, check your Baseband Version.
If the last 3 characters are NB1: Your firmware is already rootable. :)

If the last 3 characters are NC1 or NI1: Your firmware must be downgraded in order to root.
If Android Version > 4.4.2: Your firmware must be downgraded in order to root.

Step 3: Install the latest Samsung USB Drivers on your PC. Download Odin v3.09 and Run as Administrator.
Step 4: Make sure that your phone's battery is fully charged. Enable USB Debugging under the Developer Options menu.

To enable the Developer Options menu: Go to your Settings > open the More tab > select About Device > and repeatedly tap Build Number until the message Developer mode has been turned on appears.

Step 5: Connect your phone to your PC via USB cable. Your phone should be in Media Device (MTP) mode. Allow Windows to "install" the phone.

To verify that your phone is in Media Device (MTP) mode: Pull down your phone's Notification Shade and look just above Touch for Other USB Options for Connected as a Media Device. If your phone is connected as anything other than a Media Device, tap Touch for Other USB Options and select Media Device (MTP).

Backing Up Your Phone
Following the instructions in this guide will result in your phone being wiped. While wiping your phone will provide a fresh, clean firmware installation, it's also critical to note that anything you don't back up now will be irretrievably lost. Do not rely on Titanium Backup, as it may have problems trying to restore your backup on a different Android Version.

Step 1: Manually back up all of your phone's important data to your PC. That includes your pictures, videos, music, and other files, as well as any important app data stored on your phone. Nothing on your SD card should be wiped, but just to be safe, back up any important files on your phone's SD card to your PC anyway.

To manually back up your data: Open an explorer window on your PC and use it to navigate to your phone's internal storage and SD card root directory. Simply copy the files you want to back up, and then paste them into a New Folder on your PC.

Step 2: Use an app like SMS Backup & Restore to back up your text messages.
Step 3: Sync your Contacts and Calendar.
Step 4: Back up anything else you care about!

Downgrading Firmware
If your firmware must be downgraded in order to root, you will need a rootable version of the Android 4.4.2 KitKat Baseband NB1 firmware. Flash it to your phone using Odin.

Step 1: Download the Rootable NB1 ROM to your PC and extract the .tar.md5 file from the compressed RAR file. Rename the .tar.md5 file extension to a .tar file extension.
Step 2: Power off your phone and boot into Download Mode.

To boot into Download Mode: Power off your phone > press and hold the power and volume down buttons at the same time > when the warning screen appears, release both buttons > and then press the volume up button.

Step 3: If 0:[COM*] is displayed on Odin, then your phone is connected to your PC via USB cable and Odin is able to communicate with your phone. Make sure that Auto Reboot and F. Reset Time are the only boxes checked. Click the AP button and select I337UCUFNB1_TWRootable_Full_Odin.tar. Click Start to flash the Rootable NB1 ROM to your phone.
Step 4: Your phone will reboot when the process is complete. Follow the prompts on your phone to complete the initial setup process. Your phone is now running a rootable version of Android.
Note: If a Security Notice appears at any point during the rooting and upgrading process asking you to restart the phone, do not restart the phone. Manually disable KNOX instead.

To manually disable KNOX: Go to your Settings > open the More tab > open the Application Manager > open the All tab > scroll down to the following applications and Force Stop, Clear Data, and Clear Cache for each application: KLMS Agent, KNOX Notification Manager, KNOX Store, and Samsung KNOX. Now go back through the list and disable them all one more time for good measure.

Rooting and Upgrading Firmware
Use towelroot to root your phone. Install SuperSU. Upgrade to a rooted, deodexed version of the Android 5.0.1 Lollipop Baseband OK2 firmware using FlashFire and Odin.

Step 1: Set your phone's Screen Timeout to 10 Minutes and enable installation from Unknown Sources.

To change your Screen Timeout settings: Go to your Settings > open the My Device tab > select Display > and set Screen Timeout to 10 Minutes.

To enable installation from Unknown Sources: Go to your Settings > open the More tab > select Security > tick Unknown Sources and untick Verify Apps.

Step 2: Download the towelroot APK file to your phone's SD card, and run it to install the towelroot app. Open the towelroot app and tap Make It Ra1n to root your phone.
Step 3: Install the SuperSU app from the Play Store. Open the SuperSU app and opt to Disable KNOX. Note: If SuperSU hangs, manually disable KNOX, reinstall the SuperSU app, and try again.

To manually disable KNOX: Go to your Settings > open the More tab > open the Application Manager > open the All tab > scroll down to the following applications and Force Stop, Clear Data, and Clear Cache for each application: KLMS Agent, KNOX Notification Manager, KNOX Store, and Samsung KNOX. Now go back through the list and disable them all one more time for good measure.

Step 4: The phone is now rooted, and the firmware can be upgraded to Android 5.0.1 Lollipop without losing root by using the following method. Download the Rooted, Deodexed OK2 ROM to your phone's SD card. Download the OK2 Bootloader to your PC, and rename its .tar.md5 file extension to a .tar file extension. Install the FlashFire app from the Play Store. Note: FlashFire requires you to first "become a tester" using your Play Store gmail account in order to access the download link.
Step 5: Open the FlashFire app and tap the + button to bring up the Actions menu. Select Flash Zip or OTA and select I337_OK2_Stock_Rooted_Deodexed_ROM.zip. Tap the check mark button to accept the default settings. Set Reboot setting to Download. Tap the lightning bolt button to flash the Rooted, Deodexed OK2 ROM to your phone. Your phone will reboot into Download Mode when the flash is complete. Note: If your phone hangs on the black Samsung Galaxy S4 boot screen instead of booting into Download Mode, go back to Downgrading Firmware Step 1.
Step 6: If 0:[COM*] is displayed on Odin, then your phone is connected to your PC via USB cable and Odin is able to communicate with your phone. Make sure that Auto Reboot and F. Reset Time are the only boxes checked. Click the AP button and select I337_OK2_Bootloader.tar. Click Start to flash the OK2 Bootloader to your phone.
Step 7: Your phone will reboot when the process is complete. This first boot will pause on the white AT&T splash screen for a solid 15-20 minutes. Don't interrupt it! Eventually your phone will finish booting up into the initial setup process. Follow the prompts on your phone to complete the initial setup process. Your phone is now running Android 5.0.1 Lollipop, and it's still rooted.

Installing Xposed
Xposed consists of an Installer app for managing Xposed Modules, as well as a Framework that can be flashed using FlashFire.

Step 1: Set your phone's Screen Timeout to 10 Minutes and enable installation from Unknown Sources.

To change your Screen Timeout settings: Go to your Settings > open the My Device tab > select Display > and set Screen Timeout to 10 Minutes.

To enable installation from Unknown Sources: Go to your Settings > open the More tab > select Security > and tick Unknown Sources.

Step 2: Sign into the Play Store and update the SuperSU app. Open the app, update the SU Binary when asked, and reboot as instructed. Sign into the Play Store again, and reinstall FlashFire.
Step 3: Download the Xposed Installer APK file to your phone's SD card, and run it to install the Xposed Installer app.

Where's the download link? It's at the bottom of the first forum post in the linked thread, under Attached Files. Download the latest version of the XposedInstaller_*.apk file, where * stands for the version number (version 3.0_alpha4 at the time of writing).

Step 4: Download the Xposed Framework to your phone's SD card. Open the FlashFire app and tap the + button to bring up the Actions menu. Select Flash Zip or OTA and select xposed-v*-sdk21-arm-arter97-snapdragon.zip. Note: If that file fails to flash properly, try flashing xposed-v*-sdk21-arm-arter97-snapdragon_requestConcurrentGC.zip instead. Tap the check mark button to accept the default settings. Tap the lightning bolt button to flash the Xposed Framework to your phone. When the flash is complete, your phone will reboot and then spend 10 minutes "optimizing" all ~235 of your apps and files before it finishes booting.

Where's the download link? There are 2, and they're both at the bottom of the first forum post in the linked thread, under Attached Files. Download the latest version of the xposed-v*-sdk21-arm-arter97-snapdragon.zip file and the xposed-v*-sdk21-arm-arter97-snapdragon_requestConcurrentGC.zip file, where * stands for the version number (version 75 at the time of writing).
Note: Choosing the correct version of the Xposed Framework for any given phone depends on the phone's Android Version and the Instruction Set of the phone's CPU. SDK21 ARMv7 from developer @arter97 is the version required by your SGH-I337, which has a Snapdragon 600 CPU and should now be running a rooted, deodexed version of Android 5.0.1 Lollipop.

Step 5: If it worked, you should now have the Xposed Framework installed on your phone. Open the Xposed Installer app and tap Download to browse available Xposed Modules. Download, install, and activate your favorites; and then from the main menu of the Xposed Installer app, tap Framework and select Reboot. After your phone reboots, open the Xposed Installer app and tap Modules to configure the Xposed Modules you just installed.

Removing Bloatware
If you want to remove any of the pre-installed bloatware, it's always best to do it before you run off downloading your own apps.

Step 1: Make a list of all the apps in your App Drawer that you would prefer to uninstall. Note: Deleting system-critical apps can cause everything from annoying error messages to diminished functionality to bootloops and softbricks. If you aren't sure whether an app is safe to remove, research it. If you still aren't sure, just hide the app instead of uninstalling it; better safe than sorry!
Step 2: Using a root-required system app uninstaller app like System App Remover, uninstall the list of apps you made, taking care not to remove any that System App Remover doesn't mark as Could Remove unless you're certain that it's safe to do so. When the uninstallation process is complete, reboot your phone.

Apps known to be safe to remove:
AT&T

AT&T FamilyMap, AT&T Live, AT&T Locker, AT&T Mail, AT&T Mobile Locate, AT&T Navigator, AT&T Smart Wi-Fi, Device Help, (AT&T) Messages (not to be confused with the stock SMS app Messaging!), (AT&T) Mobile TV

Google

Chrome (gave the error: com.android.chrome has stopped when uninstalled, but no further issues), Google (the app with the square blue icon and a white g, used for search; don't uninstall the wrong thing by mistake! Uninstalling this app gave the error: com.google.android.googlequicksearchbox has stopped when uninstalled, referring to the Google Search widget that breaks without the Google app installed), Google+, Hangouts, (Google) Photos, Play Books, Play Games, Play Movies & TV, Play Music, Play Newsstand, Voice Search (part of the Google app, uninstalling the Google app also removes the Voice Search app)

Samsung

Flipboard, Group Play, (Samsung) Help, Kids Mode, KNOX (the app with a little shortcut arrow on the bottom left corner of the icon: com.sec.knox.setupwizardstub; don't uninstall the wrong thing by mistake!), Optical Reader, S Memo, S Translator, S Voice, Samsung Apps, Samsung Hub, Samsung Link

Third-party

Caller Name ID, Keeper, Lookout, TripAdvisor, Uber, YP (Yellow Pages)

Step 3: Now make a list of any remaining widgets that you would prefer to uninstall. Open the System App Remover app and uninstall the list of widgets you made, taking care not to remove any that System App Remover doesn't mark as Could Remove unless you're certain that it's safe to do so. When the uninstallation process is complete, reboot your phone.

Widgets known to be safe to remove:
Dual Clock (Digital), Samsung GALAXY Apps Widget, Google Search, Travel, Yahoo! Finance, Yahoo! News

Note: It is strongly advised not to remove any other files with System App Remover unless they're causing you a specific problem and you're completely certain that they would be safe to remove. Always reboot your phone after uninstalling any other files.

Other files known to be safe to remove:
S Note Provider (component for S Memo; safe to remove if S Memo is already uninstalled), Samsung Books, Samsung Games, Samsung Link Platform (component for Samsung Link; safe to remove if Samsung Link is already uninstalled), Samsung Link Platform Connectivity (component for Samsung Link; safe to remove if Samsung Link is already uninstalled), SamsungHub Updater (component for SamsungHub; safe to remove if SamsungHub is already uninstalled)

Resetting the Flash Counter
If, after all of your tinkering, your bootscreen now shows an unlocked padlock with the word "Custom," it means you've managed to set off a Modified System Flag. This step restores the standard black Samsung Galaxy S4 bootscreen.

Step 1: Download the Triangle Away APK file to your phone's SD card, and run it to install the Triangle Away app. Open the Triangle Away app and confirm that the Model Number displayed by Triangle Away matches your SAMSUNG-SGH-I337. Under Current Status, your Flash Counter, Binary Status, and System Status are all displayed.

Where's the download link? It's at the bottom of the first forum post in the linked thread, under Attached Files. Download the latest version of the TriangleAway-v*.apk file, where * stands for the version number (version 3.26 at the time of writing).

Step 2: Unplug your phone and tap Reset Flash Counter to reset your Flash Counter to 0 and remove your Modified System Flag. Your phone will power off. Wait at least 10 seconds before powering it on again.

Note: Triangle Away cannot remove a KNOX Warranty Flag. Your System Status as reported in Download Mode may remain Custom even after using Triangle Away. If you go to your Settings > open the More tab > select About Device > and select Status, your Device Status as reported here, too, may remain Custom even after using Triangle Away.

:good: :) ;) :D :cool:

Credits:

The knowledge contained in this guide and the resources to which it links are thanks to the skill and contributions of the following talented and generous people. Please give them a Thanks on their threads, rate and share their apps, and donate to them if you can.
odindownload.com

@sac02 for [How-To] I installed a custom Lollipop ROM on my AT&T Galaxy S4 and it was easy!

@guut13 for [INDEX] All things AT&T [MK2 NB1 NC1 NI1 NJ4 NJ5 OC3 OC4 OK2] and ROM List, [GUIDE]Odin to Stock, Updating, Rooting, and Installing Safestrap > Part 2

@muniz_ri for Rootable NB1 ROM, [How-To] Update to I337_OK2 - 5.0.1 and KeepRoot, Rooted, Deodexed OK2 ROM, OK2 Bootloader

@geohot for towelroot

@Chainfire for SuperSU, FlashFire, Triangle Away

@Portgas D. Ace for [DISCUSSION] Xposed for Lollipop > Unofficial Q&A

@rovo89 for Xposed Installer

@arter97 for Xposed Framework

Show more