Slide 1

Slide 1 text

Jalandhar Niharika Arora Developer Relations Engineer, Google Optimize your apps for Android(Go edition) @thedroidLady

Slide 2

Slide 2 text

Agenda

Slide 3

Slide 3 text

Agenda 1. Android Go: What & Why? 2. Why build for Android Go? 3. Optimize app memory,startup time and app size 4. Tools 5. Final Words…

Slide 4

Slide 4 text

Android (Go edition)?

Slide 5

Slide 5 text

What is Android Go? A mobile operating system built for entry-level smartphones with less RAM than standard in higher-end devices.

Slide 6

Slide 6 text

What is Android Go? A mobile operating system built for entry-level smartphones with less RAM than standard in higher-end devices. Release Android 8.1 (API level 27) Android 9 (API level 28) Android 10 (API level 29) Android 11 (API level 30) Android 12 (API level 31) Android 13 (API level 33) Min RAM 512MB 512MB 512MB 1GB 1GB 2GB

Slide 7

Slide 7 text

Why Android (Go edition)?

Slide 8

Slide 8 text

Why Android Go? Affordable Light Opportunities Reliable

Slide 9

Slide 9 text

Why build for Android Go? 1. >200mn people actively use Android(Go edition) phones worldwide.

Slide 10

Slide 10 text

Why build for Android Go? 1. >200mn people actively use Android(Go edition) phones worldwide. 2. Big OEMs like Jio, Samsung, Oppo etc. building more Go devices.

Slide 11

Slide 11 text

Why build for Android Go? 1. >200mn people actively use Android(Go edition) phones worldwide. 2. Big OEMs like Jio, Samsung, Oppo etc. building more Go devices. 3. Not catering these devices -> no smooth user experience -> impact on business directly

Slide 12

Slide 12 text

Optimize your apps

Slide 13

Slide 13 text

Why to optimize?

Slide 14

Slide 14 text

Approach

Slide 15

Slide 15 text

Phases Description Define ● Before starting any optimization effort, define your Key Performance Indicators (KPIs).

Slide 16

Slide 16 text

KPI Category App Startup Latency Common to all apps App Crash Rate Common to all apps End to end latency for Camera Shot Specific to Camera app App Not Responding Rate Common to all apps Phases Description Define ● Before starting any optimization effort, define your Key Performance Indicators (KPIs).

Slide 17

Slide 17 text

Phases Description Define ● Before starting any optimization effort, define your Key Performance Indicators (KPIs). Breakdown ● Break down a given KPI into individual signal metrics. App Crash Rate Crash due to unhandled errors Crash due to high memory usage → Crash due to ANR etc.

Slide 18

Slide 18 text

Phases Description Define ● Before starting any optimization effort, define your Key Performance Indicators (KPIs). Breakdown ● Break down a given KPI into individual signal metrics. Benchmark ● Benchmark/measure the KPI values and individual metrics to identify current performance.

Slide 19

Slide 19 text

Phases Description Define ● Before starting any optimization effort, define your Key Performance Indicators (KPIs). Breakdown ● Break down a given KPI into individual signal metrics. Benchmark ● Benchmark/measure the KPI values and individual metrics to identify current performance. Repeat the process ● Repeat the process if your target is not met!!!!!!!!

Slide 20

Slide 20 text

Phases Description Define ● Before starting any optimization effort, define your Key Performance Indicators (KPIs). Breakdown ● Break down a given KPI into individual signal metrics. Benchmark ● Benchmark/measure the KPI values and individual metrics to identify current performance. Repeat the process ● Repeat the process if your target is not met!!!!!!!! Add regular regression test ● Decide on how often tests should run? ● What should be the optimal frequency for your app?

Slide 21

Slide 21 text

Optimize Memory

Slide 22

Slide 22 text

Optimize App Memory 1. Schedule tasks which require similar resources(CPU, IO, Memory) appropriately.

Slide 23

Slide 23 text

Optimize App Memory 1. Schedule tasks which require similar resources(CPU, IO, Memory) appropriately. 2. Release unneeded memory in onTrimMemory().

Slide 24

Slide 24 text

Optimize App Memory 1. Schedule tasks which require similar resources(CPU, IO, Memory) appropriately. 2. Release unneeded memory in onTrimMemory(). 3. Find & fix memory leaks.

Slide 25

Slide 25 text

Optimize App Memory 1. Schedule tasks which require similar resources(CPU, IO, Memory) appropriately. 2. Release cache-like memory in onTrimMemory(). 3. Find & fix memory leaks. 4. Optimize your bitmaps.

Slide 26

Slide 26 text

Optimize Startup time

Slide 27

Slide 27 text

Optimize Startup time 1. Move the tasks from UI thread to background thread.

Slide 28

Slide 28 text

Optimize Startup time 1. Move the tasks from UI thread to background thread. 2. Avoid eager initialization.

Slide 29

Slide 29 text

Optimize Startup time 1. Move the tasks from UI thread to background thread. 2. Avoid eager initialization. 3. Analyze and fix disk read contention.

Slide 30

Slide 30 text

Optimize Startup time 1. Move the tasks from UI thread to background thread. 2. Avoid eager initialization. 3. Analyze and fix disk read contention. 4. Avoid synchronous IPCs on UI thread.

Slide 31

Slide 31 text

Optimize App size

Slide 32

Slide 32 text

Optimize App size 1. Remove unnecessary layouts.

Slide 33

Slide 33 text

Optimize App size 1. Remove unnecessary layouts. 2. Migrate to dynamic layouts/views when appropriate.

Slide 34

Slide 34 text

Optimize App size 1. Remove unnecessary layouts. 2. Migrate to dynamic layouts/views when appropriate. 3. Revaluate features with low DAU. Try to disable features which take more memory and make the app less performant.

Slide 35

Slide 35 text

Optimize App size 1. Remove unnecessary layouts. 2. Migrate to dynamic layouts/views when appropriate. 3. Revaluate features with low DAU. Try to disable features which take more memory and make the app less performant. 4. Try to reduce dalvik code size.

Slide 36

Slide 36 text

Optimize App size 1. Remove unnecessary layouts. 2. Migrate to dynamic layouts/views when appropriate. 3. Revaluate features with low DAU. Try to disable features which take more memory and make the app less performant. 4. Try to reduce dalvik code size. 5. Upload your app with Android app bundles and utilize dynamic delivery feature if applicable.

Slide 37

Slide 37 text

Tools

Slide 38

Slide 38 text

Memory ● Debug Memory usage using Perfetto ● Utilize meminfo : adb shell dumpsys meminfo [-d] ● Detailed analysis using showmap : adb shell showmap ● Use Address Sanitizer to detect memory errors in C/C++ code ● Inspect your memory usage using Memory Profiler

Slide 39

Slide 39 text

App Startup ● Debug CPU usage, frame rendering time and thready activity using Perfetto ● Streamline startup sequences and explicitly set the order of initialization using App Startup library. ● Utilize Baseline Profiles. ● Combine and effectively use Debug API + CPU Profiler. ● Write tests and measure scrolling/animation rendering time using Macrobenchmark.

Slide 40

Slide 40 text

App Size ● Use Android Studio Analyzer. ● Remove unused resources using Lint. ● Crunch PNG files using aapt tool.

Slide 41

Slide 41 text

Resources

Slide 42

Slide 42 text

Resources ● Android Go Developer Documentation: What, Why and how to develop apps following standard best practices. ● Optimize your app for Android : Lessons from Google apps Part-1 ● Optimize your app for Android : Lessons from Google apps Part-2

Slide 43

Slide 43 text

Final Words

Slide 44

Slide 44 text

Conclusion 1. Android Go is not just “INDIA” specific. 2. Improving performance on Android Go (low-end) devices ∝ Improve performance on all (mid & high-end) devices too. 3. Keeping your users happy should be your first priority.

Slide 45

Slide 45 text

“Building an app is easy, but building an efficient one for everyone is, what we really require.”

Slide 46

Slide 46 text

Thank you! @thedroidLady