[Galaxy S II General] sekhargreen:
Tutorials & Guides

How to build a perfect ROM

Know the Basics

Without knowing what you are getting yourself into will only make things worse even before you start off. To build a good Rom is different and to atleast build a fully functional Rom is different. So make sure you are fully aware of the technical fundamentals of building a Rom to enough extent so that you are able to fix the bugs and know what and where can things go wrong and how to solve them.

Performance, Memory, Stability and Battery

These are the four defining points which decide the pros and cons of the Rom that you develop. The Rom should be Fast, Have enough storage and program memory, should be stable and have a good battery backup. Trying to get a good balance of all these is very important. So make sure you keep all these things in mind while developing your Rom.

Be Patient and Polite

Building a good/perfect or bug free Rom wont come immediately. It’ll take many releases, experiments, testing and knowledge till you reach a nearly perfect Rom. So be patient as it sometimes takes weeks or sometimes months. Dealing with the public is not an easy job. You’ll find all sort of people of various characters. The can be nice as well as rude, but do remember that their critics are the only way you can improve. All they want from you is a good Rom, just keep this in mind and ignore the negatives.

Make it User Friendly

There are many ways in which you can make your Rom user friendly. Integrating useful apps. Prepping Eye candy themes, Important shortcuts etc.

Stay Motivated

This is the only driving force behind every Rom developer to continue doing their work with ease and success. Stay motivated and alert so that you can deliver the best with every release. Its hard sometimes but its it important.

Give Time to your Work

Most of the developers are either students or work some where and building Roms is some what like a hobby for us. Its correct that we are not supposed to spend all the time on building Roms but if we want to have a good working Rom we should manage considerable amount of time for few alternate days to work on this project.

Make it Different

You Rom characteristics should be some what different from what is already been provided by other developers. If its nothing different and Catchy then it’ll be hard to get users trying your Rom consistently. I still remember the days when i used to try alot of different Roms but still couldn’t find one that was nearly perfecting my needs. I tried alot of Roms that time.

Join Hands with another Developer

This is what i like the most. Join hands and team up with other developers and thus improve the efficiency and effectiveness of your Rom. The mind of two can bring together wonders. You can even team up with Developers of other devices and build a Rom for device that you personally do not own but you you widen your work area.

Don’t be ignorant

Make sure you are attentive and up to date with all what is discussed about your Rom, all bugs, all tests, reports, etc. so that you do not miss out on any bug possibly to be fixed for next release. If you ignore or avoid fixing the important bugs, the users will think that you are not really capable of solving them or not really interested in this Rom.

Get Testers

Testers are users who like to test the Rom and report you the bugs before you go public with the release. They are very helpful if you like to avoid the criticism after the release of the Rom as before itself you’ll be able to get rid of maximum number of Bugs and issues present in the Rom. That is where testers come in handy. Jus give a notice and many would love to try and test your Beta releases.

Keep Detailed Changelogs

Changelogs keep track of your developments over the time. They come in handy when ever you need to check for prolonged bugs. For example you may not notice it but if someone reports that he has been having an issue since your 3rd Rom release, then you can check out what all changes you made on that release and cross check whether one of those changes cause that bug.

Be Active on the Rom Page

This is the most important part of being interactive with the users cause there is alot that they want to be done in your Rom. Talk to them, answer their questions and discuss the pros and cons of the Roms with them. You can learn alot from them. Being active to the discussion will make them feel that you are eager to further develop and make this Rom improve further.

Add only Useful apps and Regularly Update them

Make sure the application you add to your Rom are useful by the people. Adding two Music Players in the Rom is not a good choice. Choose one that is best and use that only. But make sure you add one possibly best Application for all needs of the users. Keep track of all the applications that you have included in your Rom and make sure the latest versions are included. It keep the user feel updated with your Rom. Many times there are applications which are important to add but have some bug. Later these bugs are fixed in their next releases, so even you should add those updated fixed Applications. Use only Genuine Licenses and No Warez Applications. Warez is like a virus to the development of your Rom. Copyright issues and illegal use of cracked applications make pose a ban on you Roms by the Blogs and threads where you list them. Either you use development licenses to use the in your Roms or use an equally good free Application.

Good looking User Interface and Graphics

This is the major aspect that defines your Rom and makes it distinct from others. Work on that graphics that can be changed in your Rom, try different themes and skin enhancements in different aspects of os like dialer, lockscreen, fonts etc.

Keep Polls and ask Questions

Polls and asking questions from users is a very important way by which you can interact with users and get their feedback. Polls can be asking them about their preferences. Which applications they like or dislike, asking frequents questions on that changes you will be making in the Rom cause at the end of the day it is them who will be using them.

Learn from Competition

I don’t call the fellow developers a competition and usually many share their work and are supportive like i am to each other’s work. But you can learn from what is included in their Rom and if its catchy and important then you can add it to your Rom aswel. There might be many new and useful applications and features that other developers might be using and you are not even aware of that. It can be very helpful in evolving your Rom completely.

Listen and Learn from Users

Listening what a user has to say about their experiences on using your Rom is very important. They might have something very important to share from their experiences which you can incorporate in your Rom. It really helps in fixing bugs and improving your Rom further.

In the end you are the Decision Maker

Its you who has to take the decisions in the end. There will be many people wanting you to do this or that and add this or remove that but in the end you have to keep an unbiased judgment on all the requests, ideas and suggestions and bring forward the changes that you feel the masses are going to appreciate. And for that you will need to take care of all the above mentioned points in mind.

Give Credits

Not to forget that 70%-80% of your work is inspired from that of other developers. And it wonk charge you anything to be humbly give credit or some appreciation to the help you have got from other developers in terms of guides, tips, tricks, applications, UI Enhancements, etc. It just shows your character as a person as well.

What are Stock Roms and Custom Roms?

What is a Rom?

ROM – Read Only Memory is that memory which stores the system files of your Device. Those files which make up the basic Operating System, be is Windows Mobile Phone OS, Android, Symbian, Windows OS, etc. Every electronic device has a Read only Memory which stores the basic programming of the functions that the Electronic equipment is to perform. ROM in terms of our Android Devices the basic set of programming applications and files of functions which your device performs Out of the Box. Without a Rom no electronic device exists.

What are Stock ROMs?

Those ROMs which come pre installed are called Stock ROMs. Stock ROMs are the ones that come Box packed with your Device preinstalled. These are official Software that are provided by the Manufacturer or the OEM.

Is it possible to Edit/Customize/Alter Stock ROMs?

Yes it is. For a lot of Operating Systems be it Windows Mobile Phone OS, Android, Symbian, etc, it is possible to Customize these stock ROMs and install them to our devices.

What are Custom ROMs?

They are Custom ROMs are based on Stock ROMs but customized by the user in terms of additions in applications, improvements, removal of unnecessary application, etc. A customized ROM may be an minor improvement to Stock Rom or can even be a complete makeover of Stock Rom even changing the drivers of the Rom with that of other compatible devices providing better performance.

Why do we need Custom Rom?

Customization is making things personal. That is one main reason why we customize a Stock Rom. A stock Rom no matter what will have a lot of unnecessary applications, files, images, settings that are pre set by the Manufactures but are not at all important to us and uses a lot of space for no reason. No matter what there has to be one or the other Bug in a Stock Rom. To get rid of these issues we customize a stock ROM by either adding useful applications, settings, removed crap, fixing bugs and on getting a Top Notch easy to use and completely customized Device.

What about the warranty?

This is decision that you need to make personally. Yes, Custom ROMs will take away your precious warranty. But that to only if your device stops working while you are using Custom Rom on your device and you have to take it to the company. If you want you can revert back to Stock ROMs and then take your device to the Service Center and they won’t even know about it. But you need to consider reverting back to Original Stock Rom.

su

Also referred to as substitute user - a command for changing the account in the current terminal (usually black screen with blinking cursor). Default account is root account. So if you insert into terminal 'su' and hit enter, you will become root user.

root

Root alias superuser or poweruser is special user account for system administration. Similar to windows having its administrator account, unix-like systems have a root account. With this, you can do anything and if you run a command to delete the whole system, unix will just do it! No asking, no confirming. So, watch your steps!

rooting

Rooting is just enabling power of root for applications and other purposes.

Superuser app

After rooting is done, you will see a new app called superuser in app drawer. This app can delegate applications to use su (root) feature. When an app asks this from first use, a popup window will appear asking if the application should be allowed to use root permission.

sh, bash

is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems. So simply, it is some interface, which can execute command(s), which you have entered. Many shells exist, but in scope of android you can (as far as I know) use only sh (standard - Bourne-shell) or bash (compiled in BusyBox or separately on XDA). Both are basically same, but bash has much more features and it is more comfortable.

user/root shell

How do I know if I'm root or normal user? It's simple. Root's shell is ended with # (usually it's shell looks like "bash-3.2# _") and user's ends with $ (usually bash-3.2$ _). In terminal emulator you also can have only [path]($|#) (for root for example "/etc # _")

BusyBox

also called "The Swiss Army Knife of Embedded Linux" is a tool which brings into Android basic tools known from unix system, but is much more smaller than standard tools is. But this "packing" has limited functions in comparison to standard tools in unix-system (missing special modes of tool, color output and so on). Many application use this. For example busybox grep (filtering of text) is needed for application called Market enabler.

BusyBox commands

list of commands is really wide, so it's not possible explain all, so I pickup only top few. (hint: if you want what some command do, just search on google for "man <command_name>" for example man mv or enter command here

cd - change directory - same like in windows. You can switch directory. example: cd /sdcard

ls - list of files in actual directory (have few switches like for example: ls -l /sdcard/*.png (detailed listing)

cat - print file into standard output (like more in windows) Example: cat /sdcard/data.txt

vi - editing of file. But on limited phone keyboard (no keyboard) it is little harder Read more about vi

cp - copy of one or more file. Example: cp /sdcard/bike.jpg /sdcard/media/bike-wallpaper.jpg

mv - moving/rename files, Example: mv /sdcard/bike.jpg /sdcard/media/renamed-moved-bike.jpg

rm - delete file (rm -R for recursive, or for delete whole folder), Example: rm -R /sdcard/wallpaper-bad/*

find - search for files, Example find / -name "best-chopper-ever.avi"

mkdir - make directory - creates directory, Example: mkdir mynewdir

chmod - changes access of files

less - similar like cat, but you can scroll in it and it doesn't produce any output. Example: less /sdcard/funnytext.txt

For BusyBox's tool help, just enter BusyBox <command_name> -h.

ADB (shell)

ADB - Android Debug Bridge is a versatile tool that lets you manage the state of an emulator instance or Android-powered device. It is a client-server program that includes three components:

* A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as the ADT plugin and DDMS also create adb clients.

* A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device.

* A daemon, which runs as a background process on each emulator or device instance.

Generally, it can be compared with standard cmd prompt in windows (you can write commands which will be executed locally, for example in Terminal Emulator) or it can be just like SSH in unix-like system (you connect to terminal through adb client (in Android SDK) and commands will be run remotely.

Android SDK

Android software development kit is a complex set of tools for developing apps on Android. It includes a fully usable emulator of Android OS on your PC, where you can do everything. You can install/delete apps, browse web page in embedded web browser, play games or make your own application in Eclipse (widely used IDE for development). Of course, with emulator you can use also GPS or camera.

Android SDK tools

* Fully emulated Android device

* Android Development Tools Plugin (Eclipse IDE)

* Android Virtual Devices (AVDs)

* Hierarchy Viewer

* layoutopt

* Draw 9-patch

* Dalvik Debug Monitor Service (ddms)

* Android Debug Bridge (adb)

* Android Asset Packaging Tool (aapt)

* Android Interface Description Language (aidl)

* sqlite3

* Traceview

* mksdcard

* dx

* UI/Application Exerciser Monkey

* monkeyrunner

* Android

* zipalign

Tools for work with Android adb shell

You have two ways to connect into ADB service - locally and remotely.

Locally - for local access you will need some application which can connect to local adb shell.

Terminal Emulator (free) - probably most commonly used app from market, which works and looks like standard unix shell.

ConnectBot (free) - same as Terminal Emulator, but it can be also used for connecting via SSH or telnet

Remotely- For remote connection you need phone configuration adjustment:

Home desktop -> [menu button] -> Settings -> Applications -> Development -> USB debugging [ON].

Also you need connect your phone via USB (or finds on market some widget/app, witch enable using ADB also via wi-fi)

adb tool from Android SDK

After downloading Android SDK, extract the archive anywhere (in example I extracted it in c:/AndroidSDK). Then follow instructions on developer.android.com for installation of SDK Platform-tools (contains adb). After installation click on start menu and in Run... (in Windows7 in search bar) enter 'cmd' and press Ok or [enter]. Then write in cmd line:

Quote:

cd c:\AndroidSDK\android-sdk-windows\tools [enter]

now you can enter following command to connect to phone's adb shell if you don't have more connected device (virtual or real-one)

Quote:

adb shell

If you have more then one, you need explicitly say which one should be used for connection. So list connected devices with

Quote:

adb devices

which shows you serial number of connected devices. Than use

Quote:

adb -s <serial-number> shell

3. Custom recovery

* What is custom recovery

* Tools which custom recovery provide - NAND backup/restore, formatting of SDcard, partitioning (ext1,ext2, ext3), wiping, flashing of Custom ROM, ...

* Is it safe to install? - potential problems, backup/restore of original recovery

* How this whole thing works - installation description (not how-to install, just explanation of what is done during installation)

What is custom recovery

Recovery is an image (binary data) stored in internal memory. This image contains something like a "program" or "tool", which can boot-up independently from the Android system. This tool is part of phone system, and in PC terminology recovery can by compared to BIOS with some added features. This recovery state can be reached on all phones, but if you don't have a custom recovery, it will do a so-called HW reset and automatically restart itself into standard boot mode.

Tools which custom recovery provides

* USB-MS Toggle :mounts sdcard as mass storage

It just mounts your phone as USB-mass storage (USB disk) so you can access it through your PC

* Backup/Restore:

Absolutely GREAT feature. With NAND you can copy an image of your actual system (phone's memory). It means that you can backup the whole system with all configuration, customization, wallpapers, system's tweaks... just everything. This image will be written to your SD card which you are then free to copy around and back up on your computer

* Flash Zip From Sdcard

This tool is designed for installation of custom ROMs or tweaks. If you are instructed to install via custom recovery, then you should use this menu. Never unzip the file because it contains meta-information about itself with some validate-checks so if you edit it, or unpack and pack back, it won't work. And remember to place the file in the root (main folder) of your sdcard.

* Wipe Menu:

Wipe data/factory reset: wipes data & cache

- wipes user data (contacts, apps, configuration, ...) and cache (caches of applications)

Wipe cache

- wipes cache only

Wipe Dalvik cache : Wipes Dalvik cache in all possible locations if moved by apps2sd

- wipes Dalvik cache

Wipe SD:ext : Wipes Apps2sd ext partition

- if you used Partition SDcard option, you can wipe it here

Wipe Battery Stats (remember to fully charge your phone before doing this)

- If you think, that your battery life is too short, you can try delete battery stats. Than let phone fully charge. (more)

Wipe rotate settings

- wipe sensor settings (acceleration, ...)

Wipe .android secure : Wipes froyo native .android_secure on sdcard

- wipe information about moved apps

* Partition Sdcard:

Partition SD: Partitions sdcard for apps2sd (this formats card so all data will be lost)

- will create ext2 partition (you will be asked for size of ext2 and cache)

Repair Sd:ext

SD:ext2 to ext3 : converts apps2sd ext2 partition to ext3 (requires kernel support for ext3)

SD:ext3 to ext4 : same as above but ext3 to ext4 (requires kernel support for ext4)

ext2 - file system for the Linux kernel (no journal, fast but not recovery of I/O error)

ext3 - file system for the Linux kernel (journal, slower than ext2 because of journal, but provides recovery on I/O error)

ext4 - file system for the Linux kernel (journal, enhanced version of ext3)

* Mounts:

Gui automatically mounts folders

png-optimized -

png files takes less memory, are loads faster

JIT -

just-in-time compilation also known as dynamic translation, is a method to improve the runtime performance of computer programs, but it takes some time to convert into it on start.

HW:acceleration -

using of HW acceleration for rendering GUI. Increases battery consumption.

VM.Heap Size -

maximum memory an application can consume

stagefright -

In Android 2.2 new media framework that supports local file playback and HTTP progressive streaming

Deodex

Advantages or disadvantages

- Odexed ROMs are slightly faster, deodexed ROMs are slightly slower

+ You can make custom themes for your ROM

+ Performance los is negligible.

Requirements:

Download XUltimate

Busybox installed

Root

1. Connect phone to computer

2. Start xUltimate, we will now get the required files from our phone to deodex and zipalign it which we will describe in the 3rd step.

3. On the main menu of xUltimate, choose option 5 (Pull and deodex all). Everything will be done for you here. Don't worry. You will see all your finished files in the folders 'done_app' and 'done_frame' which are located in the installation directory of xUltimate.

4. move folders 'done_app' and 'done_frame' folders to your sdcard, you can find these folders in the directory of xUltimate as described in the previous step.

5. Make sure the sdcard is not mounted to pc anymore

6. Open Windows Command Prompt and type the following commands.

adb shell

su

stop

mount -o remount,rw /dev/block/stl12 /system

rm /system/app/*.odex

rm /system/framework/*.odex

busybox cp /sdcard/done_app/* /system/app/

busybox cp /sdcard/done_frame/* /system/framework/

chmod 644 /system/app/*

chmod 644 /system/framework/*

mount -o remount,ro /dev/block/stl12 /system

sync

reboot recovery

7. Now data and cache reset in the recovery menu...

8. reboot

If one of the commands, for example 'cp' is not found, try putting busybox in front of the command:

eg: busybox cp /sdcard/done_frame/* /system/framework/

--------------------------------------------------------------------------------------------------

[How To] Setup ADB for Windows/ Mac

For Windows

Want to set up ADB or Android Debugging Bridge on your PC, here is a quick guide for you. This tutorial does not need large download or full Android SDK installation. You will just have to download a small compressed file, which is all that you require.

STEP 1: First download this file called ADBUNZIPTOCDRIVE.zip, just click on the link, download will start automatically.

STEP 2: Now download PdaNet for driver installation. It comes with drivers from all major manufacturers, so this is all you need. Install PDAnet after downloading.

STEP 3: Now extract the zip file that we downloaded in the first step to C drive and name the extracted folder ADB.

STEP 4: Now we will go to the desktop and right click to make a new shortcut.

STEP 5: Point the shortcut to ADB folder that we created in step 3, and name the shortcut ADB or whatever you want.

STEP 6: Now right click on that shortcut and go to properties and change START IN field to c:\adb.

STEP 7: Click Apply or OK and you are done. Click on ADB shortcut on the desktop and you are good to go.

Here is list of ADB commands that might be useful for you in the future.

adb devices – list all connected devices

adb push <local> <remote> – copy file/dir to device

adb pull <remote> [<local>] – copy file/dir from device

adb sync [ <directory> ] – copy host->device only if changed

adb shell – run remote shell interactively

adb shell <command> – run remote shell command

adb emu <command> – run emulator console command

adb logcat [ <filter-spec> ] – View device log

adb forward <local> <remote> – forward socket connections forward specs are one of: tcp:<port>

localabstract:<unix domain socket name>

localreserved:<unix domain socket name>

localfilesystem:<unix domain socket name>

dev:<character device name>

jdwp:<process pid> (remote only)

adb jdwp – list PIDs of processes hosting a JDWP transport

adb install [-l] [-r] [-s] <file> – push this package file to the device and install it

adb uninstall [-k] <package> – remove this app package from the device (‘-k’ means keep the data and cache directories)

adb bugreport – return all information from the device

that should be included in a bug report.

adb help – show this help message

adb version – show version num

adb wait-for-device – block until device is online

adb start-server – ensure that there is a server running

adb kill-server – kill the server if it is running

adb get-state – prints: offline | bootloader | device

adb get-serialno – prints: <serial-number>

adb status-window – continuously print device status for a specified device

adb remount – remounts the /system partition on the device read-write

adb reboot [bootloader|recovery] – reboots the device, optionally into the bootloader or recovery program

adb reboot-bootloader – reboots the device into the bootloader

adb root – restarts the adbd daemon with root permissions

adb usb – restarts the adbd daemon listening on USB

adb tcpip <port> – restarts the adbd daemon listening on TCP on the specified port