Android Reboot to App-Launch Journey | by Kanchan Pal
Hey All! We all are mostly busy in building Android applications with best practices and with fancy libraries which abstract most of the things for us and often don’t make time to understand thoroughly behind the scenes.
Sometimes we go into the documentation and see that also, but then very rarely we care what all happens when the phone becomes alive for the first time or when it reboots.
I am presenting you this journey of system boot on a high level till the time you open your own app, so you have a clear idea about the sequence of the process happening during this time.
- Power On and Boot Sequence: When you turn on your Android device, the first thing that happens is the power-on self-test (POST) to check the hardware’s basic functionality. Then, the bootloader is activated, which is a small program that initializes the device’s hardware and prepares it for loading the operating system. (Abstracting bootloader initialization with Boot ROM)
- BootLoader and Kernel Loading: The bootloader’s main task is to load the Linux kernel, which is the core of the operating system. The kernel initializes hardware components, manages memory, and provides essential services. Once the kernel is loaded into memory, it is executed, and the device transitions from the bootloader phase to the kernel phase.
- Init Process and System Services: The kernel starts the init process, which is the first user space process. Init is responsible for starting the system services, daemons, and other processes that are crucial for the operating system’s functioning. These processes include the SurfaceFlinger (for handling graphics and UI), Zygote (for managing app processes), and various hardware-specific services.
- System Server Initialization: The system server is a critical component that manages various high-level system services, such as the Package Manager (manages apps and their data), Activity Manager (manages app lifecycle), and WindowManager (manages window placement and UI hierarchy). These services work together to create the overall user experience.
- Zygote and App Process Creation: When you launch you own app, the Zygote process, which is a template for new app processes, is forked. This process serves as the basis for the new app’s runtime environment, enabling faster app launch times through a technique called process forking.
- App Initialization and UI Rendering: The new app process initializes and its Application class’s
onCreate
method is called. This is where the app sets up its initial state. You can initialize the components you want to use and can make lazy initializations if they ain’t required until their first use. - App Components and Lifecycle: Android apps are built using various components, such as Activities, Services, Broadcast Receivers, and Content Providers. Activities represent the UI, Services perform background tasks, Broadcast Receivers listen for system-wide events, and Content Providers enable data sharing between apps. These components interact following the Android lifecycle.
- App Launch and UI Interaction: When you open an app, its main activity is started by the system’s Activity Manager. The app’s UI elements are displayed on the screen, and you can interact with them through touch or other input methods.
- App Execution and Functionality: The app performs its intended functionality, such as displaying information, processing user input, and interacting with various system services and APIs. This can involve network requests, data processing, and more.
- App Termination or Background Execution: The user can close the app by navigating away from it or pressing the device’s home or recent apps button. At this point, the app might enter the background or be terminated, depending on the system’s resource management and the app’s lifecycle state.
That’s a simplified overview of the journey from a phone reboot to opening a non-system application on the Android operating system. Keep in mind that Android is a complex ecosystem with many layers of interaction, so there are more details and intricacies involved in each step. I’ll cover the application launch process in more detail in another article as in how various resources are gathered, bytecode compilation happens, Manifest file is read to locate and load the app components to eventually turn into what you see as the first screen in your app; Main Activity.
A daemon is a type of background process that runs on a computer or operating system, typically without direct user interaction. They are often started during system boot and continue to run in the background, waiting for specific events or requests to perform their designated tasks.
Here are some key characteristics and examples of daemons:
- Background Process: Daemons operate behind the scenes, without requiring direct user input or interaction. They handle tasks that are necessary for the system’s operation or to provide specific services.
- Autostart on Boot: Daemons are usually configured to start automatically when the operating system boots up. They are part of the system’s startup process and remain active throughout the system’s uptime.
- Independence: Daemons are independent processes that can run separately from user sessions. They continue running even if no user is actively logged into the system.
- Specialized Tasks and Services: Daemons are responsible for various system services, such as managing network connections, handling print jobs, monitoring hardware events, managing system logs, and more.
That’s all what I had to share. I’ve explored this from various sources and based on the work experience I had in one of my companies where I got to explore a bit about AOSP. You can find all the related classes and their interaction in Android Open Source Code (AOSP).
https://source.android.com/docs/setup/download/downloading
The above discuss is mere high-level and for the sake of understanding the components involved in the process and their interaction with each other. Please make time to google any of the components which are alien in this article because they are the key ones for Android so good to have this knowledge in depth. Feel free to improve the article by putting your comments so I’ll try to improvise/correct/more comprehensive if need be.
Happy Learning, Happy Sharing!!
Your claps on the article will motivate for future articles for sure!
Github: https://github.com/kanch231004/
Linked in https://www.linkedin.com/in/kanchan-pal-44ba35106/
Let’s connect on medium to stay tuned for more such articles in future.
Related Posts
Leave a Reply Cancel reply
Categories
- ! Без рубрики (1)
- ++PU (1)
- 1 (1)
- 1w (1)
- 1win Brazil (1)
- 1win India (1)
- 1WIN Official In Russia (1)
- 1win Turkiye (1)
- 1xbet egypt (1)
- 2ankarafayansustasi.net_may (1)
- ankarafayansustasi.netsiteai apr (1)
- Artificial intelligence (1)
- Arts & Entertainment, Photography (1)
- belugasitesi_mAY (1)
- BH_TOPsitesi apr (1)
- BHsitesy_may (2)
- Blog (3)
- Bookkeeping (14)
- Bootcamp de programação (2)
- Bootcamp de programación (2)
- BT_TOPsitesi apr (1)
- casino (5)
- casinom-hub (1)
- casinom-hub.comsitesi apr (3)
- colombian mail order brides (1)
- Cryptocurrency exchange (2)
- Dinamobet_next (1)
- Disease & Illness, Colon Cancer (1)
- Dumanbet (1)
- Dumanbet_next (1)
- Finance, Insurance (1)
- FinTech (5)
- Forex Trading (11)
- Galabet (1)
- Health & Fitness, Fitness Equipment (1)
- Hitbet (1)
- Home & Family, Crafts (1)
- Home & Family, Gardening (1)
- Internet Business, Audio-Video Streaming (1)
- Internet Business, Ecommerce (1)
- Internet Business, Email Marketing (1)
- Internet Business, Internet Marketing (1)
- IT Вакансії (1)
- IT Образование (5)
- IT Освіта (1)
- latin women dating (1)
- mail order bride (1)
- Mars bahis (2)
- Matadorbet (1)
- minimiri.comsitesi apr (3)
- Mobile App Development (771)
- Mostbet Russia (1)
- New Post (1)
- News (1)
- PB_TOPsitesi apr (1)
- PBsitesi_may (1)
- Pusulabet (1)
- redmirepool.bizsitesi apr (2)
- redmirepoolsitesi_may (1)
- Reference & Education, College (1)
- Reference & Education, Sociology (1)
- Rokusitesi apr (1)
- Sober living (6)
- Society, Divorce (1)
- Software development (7)
- Superbetin (1)
- Tempobet_next (1)
- thelongeststride.comsitesi apr (1)
- tipobet-turkiyesitesi apr (1)
- Ultrabet (1)
- Uncategorized (1)
- Игра (2)
- казино (1)
- Криптовалюты (1)
- Новости Криптовалют (1)
- Финтех (7)
- Форекс Брокеры (9)
- Форекс обучение (2)