Android Application Sandboxing
What you'll learn: How Android isolates each app in its own sandbox with a unique UID to prevent unauthorized access to other apps' data and resources.
The Core Security Boundary
Android application sandboxing is a fundamental security mechanism where each app runs in its own isolated environment—a "sandbox"—that prevents it from accessing other apps' data or system resources without explicit permission.
Think of it like apartment buildings: each app gets its own apartment (sandbox) with a unique key (UID). You can't just walk into your neighbor's apartment and access their belongings—the lock prevents it. Similarly, apps can't peek into each other's sandboxes by default.
How Sandboxing Works
When you install an Android app:
- Unique User ID (UID): The system assigns the app a unique Linux user ID—different from every other app
- Private Directory: The app gets its own private storage directory (
/data/data/com.example.app) owned by that UID - Process Isolation: The app runs in its own process with its own instance of the Dalvik/ART virtual machine
- File Permissions: Linux file permissions ensure that files owned by UID 10042 cannot be read by processes running as UID 10043
What This Prevents
- Data theft: App A cannot read App B's saved passwords, tokens, or user data
- Code manipulation: Malicious apps cannot modify another app's code or behavior
- Resource abuse: One app cannot directly interfere with another's memory or CPU usage
- Privilege escalation: Apps start with minimal privileges and must request more through the permission system (which you learned in the previous lesson)
Key Takeaway: Android's application sandboxing assigns each app a unique UID and runs it in an isolated process, creating strong security boundaries that prevent unauthorized inter-app access and contain potential security breaches to individual apps.