Developer Options in Android
By: Bal Sikandar
Tags: Developer Tools, Android, Developer Options, Debugging, AndroidDev

Every Android developer begins their journey by enabling USB debugging from the Developer options page but sometimes less curious ones miss out on the many useful features available on this page.

let’s explore some of these really useful debugging features in this article.

Layout Inspector

I’m sure most are already using this to see the layout dimensions of their views and containers and it’s one of the most useful features that has been for me as well.

As you can see in this picture the size of every TextView, Image or Containers that you have is drawn with pinkish lines.

Simulate Display cutout

With this option, you can mimic the screen shape of different camera positions on devices i.e in the Middle, Right or tall options. We may not be using it in everyday apps of ours it’s mostly needed when you create a full-screen page (including status bar)then you have to be careful what part of your app isn’t behind any camera cutout.

Minimum Width

Every Android UI needs to be tested on multiple devices of different shapes and sizes to ensure quality. From size i mean resolutions e.g. 360x480, 720x1080 etc. Usually, we do this testing by installing our app on all available devices to us. Now if you think about it. It’s a quite tiring and redundant process.

With this option available now we can mimic the resolution of different devices just by entering width value. On Android 10 it’s named as Smallest width.

Don’t Keep Activities

If you want to simulate how your app behaves when activity is killed when your app goes into the background then you can do that forcefully using this setting.

Enable this and see if your ViewModels are preserving screen state on recreation or not. Similarly, you can also restrict no. of background processes using Background process limit(I hardly use it though)

This setting shows a bar graph comprised of different colors that represent different steps of screen rendering for example measure, draw, input handling, sync upload, etc…

Ideally, while you’re using your app it shouldn’t cross the horizontal green line more than it should. This green line represents a 16ms timeline so if your bar graph continuously goes above threshold means several of your frames are dropping. Check the below link for more details.

Strict mode is a developer tool that detects accidental read/write on Disk on Main Thread or network operations on Main Thread. By enabling this you’ll get Logs as warnings in Logcat which you can use to fix such behaviors. Alternatively, you can also enable it programmatically for detail check below link.

Animator duration scale/Transition animation scale

With this, you can slowly change duration for any animation in your device so if you’re working on any animation and can’t decide right duration value then experiment using this setting.

Night Mode

If you’re building the app with Dark mode support than you can enable/disable night mode from this option. Although in most devices this option is also available in Notification tiles.

My UI is flat but still, it’s taking a lot of time in a draw. Has this ever happened to you? If yes then there is a possibility that you’re doing overdraw unintentionally.

Overdraw occurs when your app draws same pixel multiple times.

Why does this happen to suppose you have set a background color value for a view and also a color value for that view’s parent so when your screen is drawn all the overlapping areas b/w child view and it’s parent view will be drawn at least drawn twice which can cause slow rendering.

Enable this setting and find such irregularities in your app and fix them asap check the below link for details.

Below I’m mentioning some other settings that I want you guys to try out yourself and trust me you’ll find it useful someday if not today.