Sunday, December 18, 2011

Loading ICE CREAM SANDWICH on a Verizon CDMA Samsung Galaxy Tab

[Disclaimer: Contents in this post, could lead to bricking your tablet. Do not blame me for a burnt tablet. You will try it under your own responsibility. My only contribution is putting all the steps that i went through and have shared my personal experiences and emotions in this blog. As such the low level kernel stuffs were done by many many geniuses, and their links are spread all over the internet in XDA, Rootzwiki, MyDroidWorld and many many other forums]

OK with the disclaimer on , just protected myself against any potential law suits :).
Fine now, getting my hands dirty on my first ever experimental rooting stuffs. Honestly, i have never tried rooting until this post.
I purchased my first tablet computer, the Verizon CDMA 7" Galaxy Tab in February. I have heard stories of people experimenting with custom ROM and Cyanogen Mod, honestly i had appreciated all their work only by reading the posts. All of a sudden, at the stroke of a lightening, i realized, "why not experiment for myself, what worse could happen, i would end up with a 200$ brick!, (Well!, that is not entirely true!!, you will see why in my experiences below - in short, i bricked my galaxy tab 17 times!! before i got it all right, so don't panic, unless you are extremely careless, you can still recover it! [ read the disclaimer].
Through all my search and findings, which was fruitful in a way!, i envisioned writing my experiences in this blog as a one shot hub which amalgamates all the steps that are required right from stock factory sealed to ice-cream sandwich(Android 4.0.1) rooted tablet. I will try to include all the software's that i had used and post as many links that are required to get the tasks done.

[Working in this ICS ROM]
1. wifi little flaky while re-scanning networks, but its ok for alpha. Connection works perfectly.
2. bluetooth
3. GPS
4. Sdcard

[Please let me know if any links does not work, i shall repost them. If any step fails, please let me know, i will update it correctly]
[If you bricked your device because of the steps, most like you can unbrick it using heimdall - steps mentioned below to stock rom, but use under your own risk.]

Ok enough said, now to work!

1. Get a Samsung Galaxy tab from some retail store or online. If you are like me, owning a CDMA Verizon Galaxy Tab, read on!.

2. The steps are __only__ for Verizon CDMA Galaxy Tab, i have not tried this on  any other device.

3. If you have the stock Froyo, Lets first upgrade that. We need to have a rooted ROM to install ClockWorkMod(CWM). CWM is an application by itself, which facilitates easy installation of custom ROMs, on android devices.

4. Installing Heimdall 1.1.1: Grab Heimdall. Heimdall is a tool used to flash kernel and ROM (aka firmware). At the time of writing, Heimdall is at 1.3.1, but I'm old school, and i always preferred 1.1.1 and it has worked well for me. I will therefore stick with it and the software can be obtained from the Heimdall download link.

5. Extract the compressed file to a folder, and keep it aside, we will come back to this later.

6. Installing Windows USB device drivers for your Galaxy Tab: Download the Samsung Galaxy Tab Windows 7(or your appropriate OS) USB driver from the link. The link will lead to installation of Samsung Kies software. Connect your tab to the PC, and install the driver using Samsung Kies software.

7. Now launch the "Zadig" software from the extracted Heimdall folder, which is under the "Drivers" folder of the extracted Heimdall tool.
8. Under "Options" select "List all Devices, and if you had installed the USB device driver correctly in the earlier steps, you will find "Samsung Android Composite ADB Interface" under the "USB Devices" drop-down list.

9. Now choose "Install Driver", and accept the warning message. This is a one time process and from now on, you wouldn't have to repeat the steps 6 through 9.

10. Flashing a rooted Verizon Stock Gingerbread kernel: I got my rooted stock ROM from the link, and details on how to flash is below or you could refer to the post at XDA.

11. Place the Galaxy Tab in Download mode. Power off the device. Power on again by holding the "Power + Volume Down" buttons together for about 3-4 seconds. You will see a "Downloading Message".

12. Open the "heimdall-frontend.exe" from the extracted heimdall folder.
13. Place all the files from the extracted stock ROM in the correct locations. [It is very important that you do this step correctly, if you need your galaxy tab]
FactoryFS = factoryfs.rfs
Kernel (zImage) = zImage
Param.lfs = param.lfs
Cache = cache.rfs
Database Data = dbdata.rfs
Recovery = recovery.bin

14. Once the files are placed appropriately, click "Start". Please wait patiently for sometime and your galaxy tab will reboot by itself once the process is completed successfully. You may have to push "Start" couple of times before it works correctly.
15. Once the Tab reboots, power down the tab immediately [do not let it power up fully, after flashing].

16. Power up again in recovery mode by holding the "Power + Volume Up" buttons together for about 3-4 seconds and once you see the "Samsung" Logo still continuing to hold the "Volume Up" button leave the "Power" button. You will see a "Recovery mode". This is "Android System Recovery" software, not ClockWorkMod recovery[we will install this later].
17. Once in recovery, use the "Volume" buttons to navigate up or down and the "Home" button for "Enter" key. Wipe "data/cache" and "cache" partitions, and reboot.
18. You now have a fully working "Rooted Verizon Stock Gingerbread 2.3.5" with RFS partition system format[what this is, i will come to it later]. You can stop at this point if you feel so.
19. Converting File System to EXT4: Now, we need to convert our file system to EXT4 partition type. Why? because it will be faster!, user experience and app loading will be better off in EXT4 format and for the ICS port that I'm using, it is required that you have already a Gingerbread boot loader on a EXT4 partition. I was originally stuck here for long hours, until some experimentation.
20.  I navigated to the forum in RootzWiki by [Cdma] [Vzwtab] Cm7 Beta-Kang [Unofficial] 11/01. I grabbed the recovery tool which is ClockWorkMod [ Copyright notice - This link is from my ftp site, but all copyrights and ownership belongs to the original author of ClockWordMod tool. Since the original  download link no longer exists, i have placed a copy of the file in my FTP for convenience and download. ]
21. Before proceeding any further, it is very important that you have all the future files mentioned below in your Galaxy Tab's SDCARD. Do so if you don't want to repeat all the steps mentioned above again. 
22. I grabbed the CM-7.1 ROM from the above forum as well. Then i navigated to this forum for fetching the AOSP ICS / CM9 for the CDMA Build 3 ROM and the corresponding google apps. [ Upgrading to any AOSP ICS Build is up to the discretionary of the end user. I would recommend reading the cautionary notes from the original post, I'm not responsible for burned boards. Also the later builds e.g Build 5 onward, the file-system is again changed. I would recommend, first upgrading to Build 3 and then Build 7. ]

Connect your Tab to the PC and mount the SD Card and copy the downloaded files to your sdcard. [Do not extract the zip file. Copy the zip file.]

23. Flash CWM Now open heimdall-frontend again. Place your Galaxy tab in download mode as explained in step 11. In Heimdall, place all the files in the correct locations. [It is very important that you do this step correctly, if you need your galaxy tab]
Kernel (zImage) = zImage [ from unzipped CWM tar file]
Recovery = recovery.bin
[ from unzipped CWM tar file]

24. Galaxy Tab will reboot and put it in recovery mode as explained in step 16. Now unlike the earlier "Android Recovery Manager" you will see a "ClockWorkMod" recovery manager. This will have more options than the earlier one. If you don't see this, then something is wrong, and let me know, i will see if some steps have been missed. But on reboot, you should still have a rooted gingerbread.

25. Update to CM7.1:  In the recovery mode(Volume Up/Down - navigation and "Power" button is Enter key, navigate to "mounts and storage" and Format only the following "/system, /data, /cache". Hit "Go Back" and "Wipe data/factory reset and cache partition"

26. Select "Install zip from sdcard" and select your zip file, and select your custom ROM. "Select the CM-7.1 ROM". It is very important you first select this because, this ROM installation will convert your partition type from RFS to EXT4 automatically.

27. Reboot and enjoy fully working CM7.1 gingerbread ROM. You can stop here if you wish or proceed further for ICS, but this is a very stable ROM from my personal usage perspective.

28. Reboot into recovery similar to step 25 onwards to step 27, but instead of the CM7.1 ROM select your ICS ROM in the "install zip from sdcard". Reboot and enjoy ICS.

29. Installing Google Apps: This Rom or the step 25 ROM does not come with google apps pre-installed, meaning you have to install it separately.

30. Reboot into recovery mode, and under "mounts and storage" select "Mount /system". It is very Important that you DO NOT FORMAT or wipe any folder or partition. Select the "" from the sdcard and install it by selecting "install zip from sdcard".

31. Reboot and enjoy ICS
What it will look like after all steps:

Saturday, August 20, 2011

Using SharedPreferences and Data Storage – Android Development

Well, there is a lot of help online for creating a folder in the Android file system. A little bit of googling and you should be good with it. The reason i have posted this blog entry is for those who want stuffs in one page. Here it is, with explanation.

Objective: To create a folder in the public SD Card directory of android.

Public directory in android terms refers to directory which is not deleted when application is uninstalled. 

There is a great detail of information in the links at the references section.

The code below can be altered to make it create a non-public directory, to create folder only at the time of installation of application and so on. The only way to create a directory only at the time of installation is to create a SharedPreferences boolean key for and set it true / false when the folder is created.

The reason, i have created the folder in the application context is because, the folder will be created at the application installation and will be available across all activities. Depending on your application design, you could choose to create the folder either in ApplicationContext or ActivityContext.

For implementing in ActivityContext, simply change the Application to Activity

Here is code

import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;


public class ErApplication extends Application { // Activity or Application
    private static ErApplication singleton;
    private static final String ER_ROOT_FOLDER = "er";
    private static final String ER_ROOT_FOLDER_PREFERENCES = "RootFolder";
    public static ErApplication getInstance()  {
        return singleton;
    /** Called when the application is first created. */
    public final void onCreate() {
        singleton = this;
        /** Root folder creation on first time installation of application */
        try {
        } catch (IOException e) {
            /** Unable to create file, because external storage is not mounted */
            Log.w("ExternalStorage", "Error creating directory", e);
    /** SharedPreferences configuration for setting folder creation flag */
    private void SetFolderCreationPreferences() throws IOException {
        /** Get the default SharedPreferences object */
        SharedPreferences mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
        /** Checks if key "RootFolder" exists in preferences else returns
         * the default value of true
        boolean mCreateRootFolder = mSharedPrefs.getBoolean(ER_ROOT_FOLDER_PREFERENCES, false);
        if(mCreateRootFolder) {
              /** Do some crap */
        } else {
            /** Set "NoRootFolder" key to true and commit the preference value*/
            SharedPreferences.Editor mSharedprefsEditor = mSharedPrefs.edit();
            mSharedprefsEditor.putBoolean(ER_ROOT_FOLDER_PREFERENCES, true);

    /** SharedPreferences configuration for setting folder creation flag */
    public static void CreatePublicFolder(String publicFolderName) throws IOException {
        /** You may want to have a check for MEDIA_MOUNTED here for safety
          * I did not add that, but its just 1 line “if” code
        File publicDirectory = new File(Environment.getExternalStorageDirectory() + "/" + publicFolderName);


[1] Environment -

[2] SharedPreferences -

[3] Data Storage -