Kick off your book project in 3 hours! Live workshop on Zoom. You’ll leave with a real book project, progress on your first chapter, and a clear plan to keep going. Saturday, June 6, 2026. Learn more…

Leanpub Header

Skip to main content

Android Internals 2: Performance, Concurrency, and Runtime

Stop treating Android like a black box and start thinking like the engineers who build it.

Minimum price

$19.00

$29.00

You pay

Author earns

$
PDF
EPUB
About

About

About the Book

This book takes you from understanding Android to engineering it at scale. You’ll learn how real performance problems emerge across the runtime, scheduler, Binder, GPU, memory system, and rendering pipeline, then trace them with the same tools used by platform engineers. Instead of memorizing APIs, this book teaches you to think in end-to-end latency paths, frame budgets, thermal limits, and concurrency graphs. By the end, you’ll be able to diagnose ANRs and jank systematically, modify AOSP for real devices, build custom ROM features, and contribute meaningful patches to projects like AOSP and LineageOS with confidence.

Share this book

Categories

Author

About the Author

Abdur-Rahmaan Janhangeer

Long-time Python and Open Source specialist.

Contents

Table of Contents

Chapter 1: Concurrency Model in Android

  1. 1.1: Coroutines as a Structured Concurrency Graph
  2. 1.2: Cancellation Propagation and Failure Modes
  3. 1.3: Dispatcher Starvation and Thread Contention
  4. 1.4: Race Conditions in Lifecycle Aware Components
  5. 1.5: Main Dispatcher, Choreographer, and Frame Coordination
  6. Conceptual Summary Diagram
  7. Next Chapter Preview: ART as a Runtime System

Chapter 2: ART as a Runtime System (Not a VM)

  1. 2.1 From Source Code to Execution: The Real Pipeline
  2. 2.2 JIT and AOT Are Not Opposites. They Are Partners
  3. 2.3 Baseline Profiles and Cloud Profiles
  4. 2.4 Garbage Collection Is About Behavior, Not Just Pauses
  5. 2.5 Heap Behavior and Fragmentation
  6. 2.6 Allocation Churn and Frame Performance
  7. 2.7 Method Dispatch and Warmup Effects
  8. 2.8 ART in the Larger System
  9. What Comes Next

Chapter 3: Power & Thermal Management (System-Level)

  1. 3.1: Doze Mode and App Standby
  2. 3.2: WakeLocks and System Suspend Control
  3. 3.3: JobScheduler and WorkManager Internals
  4. 3.4: Thermal Throttling and Sustained Performance
  5. System Interaction View (Power + Thermal + Scheduling)
  6. Key Mental Model
  7. Preview of Next Chapter: UI Performance at Scale

Chapter 4: End-to-End Performance Model (The Missing Mental Model)

  1. 4.1: The End-to-End Interaction Model
  2. 4.2: The Unified Performance Equation
  3. 4.3: Classification of Bottlenecks
  4. 4.4: Perfetto as a System-Level Debugger
  5. 4.5: Root Cause Thinking (Not Symptom Tracing)
  6. 4.6: A Mental Model for Engineering Decisions
  7. Next chapter

Chapter 5: UI Performance at Scale

  1. 5.1: Compose Recomposition Cost Model and View Invalidations
  2. 5.2: View System Pitfalls and Rendering Inefficiencies
  3. 5.3: Startup Performance and Cold Path Execution
  4. 5.4: Memory Churn in UI Systems
  5. Summary Mental Model
  6. Next Chapter Preview: System Jank Engineering

Chapter 6: System Jank Engineering

  1. 6.1 Frame pacing vs frame rendering
  2. 6.2 VSync alignment failures
  3. 6.3 Choreographer backlog
  4. 6.4 Render thread contention
  5. Summary mental model
  6. Next chapter preview: Advanced Debugging & Profiling

Chapter 7: Advanced Debugging & Profiling

  1. 7.1: Perfetto as a System Timeline Tool
  2. 7.2: Memory Profiling with heapprofd and Native Tools
  3. 7.3: Debugging Without Source Code
  4. 7.4: Native Crash Analysis and Symbol Resolution
  5. 7.5: Kernel-Level Debugging with ftrace and Scheduling Analysis
  6. Chapter Summary
  7. Next Chapter Preview: Custom ROMs and AOSP Mastery

Chapter 8: Custom ROMs & AOSP Mastery

  1. 8.1 Building for Real Devices and Device Trees
  2. 8.2 Modifying System Components and Extending the Platform
  3. 8.3 Build Variants and Their Impact on System Behavior
  4. 8.4 Flashing, Boot Chain, and Verification Systems
  5. 8.5 Over the Air Updates and Incremental System Evolution
  6. 8.6 Vendor Components and Project Treble Boundaries
  7. Chapter Continuation Context
  8. Next Chapter Preview: Modern Android Evolution and System Modularity

Chapter 9: Modern Android Evolution (Staying Relevant)

  1. 9.1: Project Treble and the Vendor Interface
  2. 9.2: Mainline Modules and Modular Android
  3. 9.3: Scoped Storage Evolution
  4. 9.4: ART Runtime Evolution
  5. 9.5: CTS, VTS, and System Compliance
  6. Chapter 9 Summary
  7. Next Chapter Preview: Chapter 10 Boot Flow as Dependency Injection System

Chapter 10: Capstone Projects (Choose One)

  1. 10.1: Port AOSP to an Older Unsupported Pixel Device
  2. 10.2: Add a Complete System Feature (End-to-End Android Subsystem)
  3. 10.3: Contribute a Non-Trivial Patch to AOSP or LineageOS
  4. System Integration View of All Capstones
  5. Final Debugging Reality Check
  6. Chapter 11 Preview: Open Source Contribution Workflow

Chapter 11: Open Source Contribution Workflow

  1. 11.1: Understanding the Contribution Landscape
  2. 11.2: Repository Structure and Working Model
  3. 11.3: Branching, Topics, and Change Isolation
  4. 11.4: Writing a Contribution (Commit Structure)
  5. 11.5: Code Review and Gerrit Lifecycle
  6. 11.6: Testing Expectations Before Submission
  7. 11.7: Common Contribution Patterns
  8. 11.8: Mental Model of Contribution Impact
  9. 11.9: Final Capstone Flow (How Real Contributions Happen)
  10. Chapter Preview: Next Phase of Mastery

Chapter 12: Final Debugging Challenge

  1. 12.1: The Problem Space of Real Android Failures
  2. 12.2: The Debugging Stack Model
  3. 12.3: Core Toolchain in a Unified Workflow
  4. 12.4: Case Study 1: ANR Caused by Hidden Binder Contention
  5. 12.5: Case Study 2: Boot Loop from Service Dependency Deadlock
  6. 12.6: Case Study 3: Frame Drops Under Thermal Pressure
  7. 12.7: Diagnostic Principles
  8. 12.8: Outcome of This Chapter
  9. Closing of Book 2

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub