The Settings app on Android includes a screen called Developer options that lets you configure system behaviors that help you profile and debug your app performance. For example, you can enable debugging over USB, capture a bug report, enable visual feedback for taps, flash window surfaces when they update, use the GPU for 2D graphics rendering, and more.
Enable developer options
On Android 4.1 and lower, the Developer options screen is available by default. On Android 4.2 and higher, you must enable this screen as follows:
- Open the Settings app.
- Scroll to the bottom and select About phone.
- Scroll to the bottom and tap Build number 7 times.
- Return to the previous screen to find Developer options near the bottom.
At the top of the Developer options screen, you can toggle the options on and off (figure 1). You probably want to keep this on. When off, most options are disabled except those that don't require communication between the device and your development computer.
Next, you should scroll down a little and enable USB debugging. This allows Android Studio and other SDK tools to recognize your device when connected via USB, so you can use the debugger and other tools.
The rest of this page describes the other options available on this screen.
Tap Take bug report to get a copy of the current device log files to share with someone. After a moment you get a notification that the bug report is ready (figure 2). To share the bug report, tap the notification.
Other general options include the following:
- Demo mode: Makes it easier to take clean screenshots by displaying a generic, preset notification bar that does not show notifications or low battery warnings. Enable Demo Mode allows you to change the appearance of the status bar using adb demo mode commands. Or you can use Show Demo Mode to hide notifications and display a preset status bar.
- Desktop backup password: Sets a backup password so you can use adb commands to back up and restore device apps and data under password protection.
- Stay awake: Sets your screen to stay on every time you plug it in.
- Enable Bluetooth Host Controller Interface (HCI) snoop log: Captures all Bluetooth HCI
packets in a file stored at
/sdcard/btsnoop_hci.log. You can retrieve the packets, and then use a program like Wireshark to analyze and troubleshoot the information.
Debugging options provide ways to configure on-device debugging, and to establish communication between the device and your development computer.
Enable USB debugging (figure 3) so your Android device can communicate with your development machine through Android Debug Bridge (adb). The Wait for Debugger option is unavailable until you use Select debug app to select the app to debug. If you enable Wait for Debugger, the selected app waits for the debugger to attach before it executes.
Other debugging options include the following:
- Revoke USB debugging authorizations: When you use a computer to debug over USB for the first time, you have to authorize it and set up a key pair (see RSA security key). You can revoke USB debugging authorization, which forces your device to reauthorize debugging, and set up a new key pair.
- Select mock location app: Use this option to fake the GPS location of the device to test whether your app behaves the same in other locations. To use this option, download and install a GPS mock location app.
- Enable view attribute inspection: Saves view attribute information in the
mAttributesmember variable of a
Viewinstance so it can be used for debugging. You can access the attribute information through the Hierarchy Viewer user interface, as shown in Figure 4.
Networking options provide ways to configure Wi-Fi and DHCP settings.
Tap Select USB Configuration to specify how you want the computer to identify the device. As shown in figure 5, you can configure devices for charging only, to transfer files (MTP), to transfer pictures (PTP), to use your mobile internet on the PC (RNDIS), or to transfer audio or MIDI files.
The followng list describes other ways to configure Wi-Fi and DHCP setup:
- Wireless display certification: Enables advanced configuration controls and settings for Wireless Display certification to the specifications set forth in the Wi-Fi Alliance Wi-Fi Display Specification. The certification applies to Android 4.4 (API level 19) and higher.
- Enable Wi-Fi verbose logging: Increases the Wi-Fi logging level for each wireless network (SSID) you connect to according to its relative received signal strength (RSSI). For more information about logs, see Write and View Logs with Logcat.
- Aggressive Wi-Fi to cellular handover: When the signal is low, makes Wi-Fi more efficient in handing over the data connection to a cellular network.
Enable Show taps to display taps when you touch the screen. A circle appears under your finger or stylus and follows you as you move around the screen. A tap works like a pointer when you Record a Video on your device.
Enable Pointer Location to show the pointer (tap) location on the device with cross-hairs. A bar appears across the top of the screen to track the cross-hair coordinates (figure 6). As you move the pointer, the coordinates in the bar track the cross-hair location and the pointer path draws on the screen.
Drawing options provide visual cues about the app's user interface and how it operates.
Enable Show Layout Bounds to show your app's clip bounds, margins, and other user interface constructions on the device, as shown in figure 7.
Other Drawing options include the following:
- Force RTL layout direction: Forces screen layout direction to be from right to left (RTL) or from left to right (default).
- Window animation scale: Sets the window animation playback speed so you can check its performance at different speeds. A lower scale results in a faster speed.
- Transition animation scale: Sets the transition animation playback speed so you can check its performance at different speeds. A lower scale results in a faster speed.
- Simulate secondary displays: Creates a secondary display as an overlay on the device.
This is useful when supporting additional displays with the
PresentationAPI. See Secondary Displays.
Hardware accelerated rendering
Hardware accelerated rendering options provide ways to optimize your app for its target hardware platforms by leveraging hardware-based options such as the GPU, hardware layers, and multisample anti-aliasing (MSAA).
Tap Simulate color space to change the color scheme of the entire device UI. The options refer to types of color blindness. Choices are Disabled (no simulated color scheme), Monochromacy (black, white, and gray), Deuteranomaly (red-green), Protanomaly (red-green), and Tritanomaly (blue-yellow). Protanomaly refers to red-green color blindness with weakness in red colors, and Deuteranomaly (shown in figure 8) refers to red-green color blindness with weakness in green colors.
If you take screenshots in a simulated color space, they appear normal as if you hadn’t changed the color scheme.
Some other ways to leverage hardware-based options are the following:
- Force GPU rendering: Forces apps to use the GPU for 2D drawing, if they were written without GPU rendering by default.
- Show GPU view updates: Displays any onscreen element drawn with the GPU.
- Debug GPU overdraw: Overdraw displays color-coding on your device so you can visualize interface elements based on how often they are drawn underneath other elements. The visualization shows where an app might be doing more rendering work than necessary, and helps you see where you might be able to reduce rendering overhead. For more information, see Debug GPU Overdraw Walkthrough.
- Debug non-rectangular clip operations: Turns off the clipping area on the canvas to create unusual (non-rectangular) canvas areas. Normally, the clipping area prevents drawing anything outside the bounds of the circular clipping area.
- Force 4x MSAA: Enables multisample anti-aliasing (MSAA) in Open GL ES 2.0 apps.
- Disable HW overlays: Using the hardware overlay enables each app that displays something on the screen to use less processing power. Without the overlay, an app shares the video memory and has to constantly check for collision and clipping to render a proper image. The checking uses a lot of processing power.
Enable Disable USB audio routing to disable automatic routing to external audio devices connected to a computer through a USB port. Automatic routing can interfere with apps that are USB-aware.
Monitoring options provide visual information about app performance, such as long thread and GPU operations.
Tap Profile GPU rendering to see a visual representation of how hard the GPU is working. The rendering can be stored to a file or displayed on the screen as a bar, as shown in figure 9. For more information, see Profile GPU Rendering Walkthrough.
App options help you understand how your app operates on the target device.
Tap Background process limit to set the number of processes that can run in the background at one time. Possible settings are shown in figure 10.
Tap Reset ShortcutManager rate-limiting during testing so background apps can continue
to call shortcut APIs until the rate limit is reached again. For more information about shortcuts
and rate limits, see
Enable Don't keep activities to increase battery life by destroying every activity as soon as the user leaves the activity's main view.