Posts

Showing posts from June, 2013

Zygote in Android

when an application is launched , the core process for the application is forked from Zygote. Zygote has all the core libraries and hence all applications share these libraries from Zygote. Zygote is also used to share the system drawables with all the apps. This allows the system to load the bitmaps for buttons only once for instance. Zygote System Process The important processes in the system appear to be zygote (which is the app_process binary), and runtime. These are both started up by the init process. The following fragment of init.rc is relevant. It is important to note that these services have the autostart 1 attribute, indicating they are restarted if they quit. zygote { exec /system/bin/app_process args { 0 -Xzygote 1 /system/bin 2 --zygote } autostart 1 } runtime { exec /system/bin/runtime autostart 1 } If we go and kill either the zygote, or runtime process

Looper in Android

What is Looper? Looper is a class which is used to execute the Messages(Runnables) in a queue. Normal threads have no any queue. For example, Simple thread do not have any queue. It is one time execution and after end of the code the thread will be stopped and it will not able to run another Message(Runnable). Where we can use Looper class? If someone wants to execute multiple messages(Runnables) then he should use the Looper class which is responsible for create a queue in the thread. For example. If we are writing an application which downloads files from the internet then we can use Looper class for put a files in the queue to be download. How it works? There is prepare() method to prepare the Looper. Now after that you can use loop() method to create a message loop in the current thread and now your looper is ready to execute the requests in the queue until you quit the loop. Here is the code by which you can prepare the Looper. class LooperThread extends Thr

Android Boot Sequence

Image
Android is linux based open source operating system, x86 (x86 is a series of computer microprocessor instruction set architectures based on the Intel 8086 CPU.) is most likely system where linux kernel is deployed however all Android devices are running on ARM process (ARM (formerly Advanced RISC Machine, which was formerly Acorn RISC Machine)) except Intel’s Xolo device ( http://xolo.in/xolo-x900-features ). Xolo comes with Atom 1.6 GHz x86 processor. Android boot sequence or I can say embedded device or ARM based linux has minor difference compare to desktop version.  In this article I am going to explain boot sequence for Android only. Inside the linux boot process is good article for desktop based linux boot sequence. Android device execute following steps when you press power switch Android Boot Sequence / Process Step 1 : Power On and System Startup When power start Boot ROM code start execution from pre defined location which is hardwired on ROM. It load B

Android: Activity launch mode

A task is the stack ("Last in, First out") which contains a collection of activity instances. Normally, when a user starts an app a new task will be created, and the first activity instance is called as a root of the task. The Android system can hold multiple tasks at the same time and only one task is in the foreground. Similar to a double click of the home key on iOS, if you long press the HOME key on Android you'll be presented with a list of your currently running applications. You can select any one of these applications (which are currently running in the background) in order to bring it to the foreground and interact with the app! Of course, because background tasks do tend to use up your processor cycles you should try to keep your backgrounded apps to a minimum to ensure your phone performs optimally. Now let's look at the launch mode of an activity. Launch mode allows you to define how a new instance or the existing instance of an activity