Table of Contents

Preface

About the Author

Acknowledgements

1 Understanding Concurrency

Concurrency Made Hard

Concurrency in Software

Concurrency in Hardware

Concurrency Made Simple

Threads

Atomic Execution

Visibility

Summary

2 Java Concurrency

Java Threads

The Thread Class

Runnables

Synchronization

Mutexes

Common Synchronization Errors

Volatile

Wait and Notify

Wait

Notify

The Concurrency Package

Safe Publication

Executors

Futures

Summary

3 The Android Application Model

Lifecycles and Components

Process Priority

Component Lifecycles

Android Applications as Web Apps

The Android Process

Application Startup

The Android Main Thread

Summary

4 Async Tasks and Loaders

Async Task Architecture

Async Task Basics

AsyncTask Execution

AsyncTask Completion

Using AsyncTasks

AsyncTask: Considered Dangerous

Getting It Right

Loaders and Cursor Loaders

AsyncTasks: What Went Wrong

Summary

5 Looper/Handler

Introducing the Looper/Handler

Basic Looper/Handler

Delegating Execution

Some Gory Details

Handlers and Messages

Starting a Looper

The Native Looper

Scheduling and the Sync-Barrier

Summary

6 Services, Processes, and Binder IPC

Service Basics

Started Service Essentials

Bound Service Essentials

Intents

The Intent Service

Bound Services

A Simple Bound Service

Binding A Service

Unbinding A Service

Binding Multiple Services

Service Lifecycle

Priorities and Flags

A Local Bound Service

Inter-Process Communication

Parcelables

Messengers

Using AIDL

Creating Processes

Binder, Considered Briefly

Binder Threads

Binder Data Transfer Limits

Binding to Death

Summary

7 Periodic Tasks

Task Characteristics

Thread Safety

Lifecycle-Aware

Smart Use of Process Priority

Power-Thrifty

The Scorecard

Timer and TimerTask

Looper/Handler

Custom Service-based Scheduler

Alarm Manager and Intent Service

The Alarm Manager Service

Schedulable Tasks

Sync-Adapters

Defining a Sync-adapter

How Sync-adapters Work

Implementing the Sync-adapter

Scoring the Sync-adapter

The JobScheduler

Scheduling a Task

Running a Task

Task Implementation

Scoring the JobScheduler

Summary

8 Concurrency Tools

Static Analysis

Android Studio

Findbugs

Annotations

JCIR Annotations

Support Library Annotations

Assertions

Conclusion and Best Practices

Bibliography

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.0.240