INTRODUCTION TO MOBILE (UNDERSTANDING THE ANDROID ENGINE)
1. OVERVIEW OF ANDROID
1.1 Definition of Android
Android is a mobile operating system (OS) developed by Google.
It is built on the Linux kernel which handles:
- Process management
- Memory management
- Hardware communication
Key Terms:
Operating System: Software that manages hardware and runs applications
Kernel: Core part of OS that connects software to hardware
Open Source: Code is publicly available (AOSP)
1.2 Android as a Software System
Android is:
- Distributed
- Event-driven
Designed for:
- Limited battery, RAM, CPU
- Multiple apps
- Strong isolation
1.3 Features of Android
- Open ecosystem
- Multitasking
- Customizable UI
- Multiple device support
- Play Store distribution
1.4 Core Design Principles
Process Isolation: Each app runs in its own process
Component-Based: Apps made of activities, services, etc.
Event-Driven: Runs only when needed
Managed Runtime: Uses ART
2. ANDROID ARCHITECTURE
Layers:
- Linux Kernel: hardware interaction, security
- HAL: connects hardware to APIs
- Native Libraries: SQLite, WebKit, OpenGL, SSL
- ART: execution, garbage collection
- Application Framework: system services
- Applications: user apps
3. APPLICATION STRUCTURE
Project Structure:
- manifests/
- java/kotlin/
- res/
- Gradle
[Link]:
Defines activities, permissions, services
Core Components:
- Activity: UI screen
- Service: background tasks
- Broadcast Receiver: listens to events
- Content Provider: shares data
APK & DEX:
APK: final app file
DEX: optimized bytecode
Gradle:
Handles dependencies and builds
4. ACTIVITIES & UI
Activity Lifecycle:
onCreate, onStart, onResume, onPause, onStop, onDestroy
Main Thread:
Do not block (avoids ANR)
Concurrency:
Threads, handlers, coroutines
UI:
XML, Views, ViewGroups
Layouts:
LinearLayout, ConstraintLayout
Components:
TextView, EditText, Button, RecyclerView
Rendering:
Measure → Layout → Draw
Events:
Click, swipe, touch
Intents:
Explicit and Implicit
5. PROCESS MANAGEMENT
Priority Levels:
Foreground, Visible, Service, Background, Empty
Low Memory Killer:
Kills low priority apps
6. ARCHITECTURAL PATTERNS
MVC:
Model, View, Controller
MVVM:
Model, View, ViewModel
Lifecycle Awareness:
Prevents crashes and memory leaks