The second developer preview of Android 16 is here, offering exciting updates and tools for developers to enhance app performance, improve battery efficiency, and optimize user experiences. This release provides a glimpse into the future of Android development, focusing on performance profiling, adaptive refresh rates, haptic feedback, job execution, and accessibility improvements.
In this article, I’ll explore the standout features of Android 16 Developer Preview 2 and their implications for developers.
1. System-Triggered Profiling for Enhanced Diagnostics
Android 16 expands the capabilities of the ProfilingManager
, introduced in Android 15, by adding System Triggered Profiling. Developers can now collect profiling data for challenging scenarios such as:
- App startups
- ANRs (Application Not Responding)
Using the ProfilingManager#addProfilingTriggers()
API, apps can register interest in system-triggered flows like onFullyDrawn
for activity-based cold starts.
val anrTrigger = ProfilingTrigger.Builder(
ProfilingTrigger.TRIGGER_TYPE_ANR
).setRateLimitingPeriodHours(1).build()
val startupTrigger = ProfilingTrigger.Builder(
ProfilingTrigger.TRIGGER_TYPE_STARTUP
).build()
mProfilingManager.addProfilingTriggers(listOf(anrTrigger, startupTrigger))
This feature enables developers to debug complex performance bottlenecks more effectively, ensuring smoother app performance.
2. Improved App Startup Insights
With the addition of the getStartComponent()
method in ApplicationStartInfo
, apps can now determine the component type that triggered a startup. This provides valuable diagnostic information, such as:
- Process start reasons
- Startup types
- Throttling data
This new functionality allows developers to fine-tune the app’s startup flow, reducing latency and optimizing performance.
3. Richer Haptics for Better User Interaction
Android 16 introduces advanced haptic APIs to offer a more immersive tactile experience. These APIs allow developers to control amplitude and frequency curves, ensuring haptic feedback adapts to different device capabilities.
For example:
- Define amplitude curves for precise feedback.
- Enhance interactions like gaming or media playback with custom haptic effects.
By supporting a broader range of actuators, Android 16 enables apps to deliver a consistent and engaging experience across devices.
4. Adaptive Refresh Rate (ARR) Enhancements
First introduced in Android 15, Adaptive Refresh Rate (ARR) dynamically adjusts the display refresh rate to match the app’s content frame rate. Android 16 DP2 enhances this feature by:
- Adding APIs like
hasArrSupport()
andgetSuggestedFrameRate(int)
. - Restoring
getSupportedRefreshRates()
for easier integration.
These updates reduce power consumption while eliminating visual jank. RecyclerView 1.4 now supports ARR, ensuring smooth scrolling and animations.
5. Job Execution and Quota Optimization
Android 16 introduces improvements to the JobScheduler
API, ensuring efficient job execution and quota management. Changes include:
- Adjusted runtime quotas based on the app standby bucket.
- Stricter adherence to quotas when jobs run concurrently with foreground services.
For long-running tasks like data transfers, developers are encouraged to use User-Initiated Data Transfers (UIDT) for better resource management.
6. Accessibility Improvements
Android 16 deprecates disruptive accessibility announcements, like announceForAccessibility
, to improve user experiences for TalkBack and other assistive technologies. Alternatives include:
- Live Region Updates: Use
setAccessibilityLiveRegion()
for polite or assertive updates. - Error Notifications: Leverage
AccessibilityEvent.CONTENT_CHANGE_TYPE_ERROR
for error announcements.
These updates align with Android’s commitment to inclusive and seamless accessibility.
7. Cloud Search in Photo Picker
The Android photo picker now includes cloud search functionality, allowing users to access both local and cloud-stored media seamlessly. Integration is straightforward with the associated Jetpack library, making it easier for apps to provide a secure and user-friendly media selection experience.
8. Enhanced WiFi Ranging with Better Security
Android 16 adds robust security features for WiFi location using WiFi 6’s 802.11az. This update improves accuracy, scalability, and scheduling, enabling apps to leverage advanced location services without compromising user privacy.
Why Developers Should Test Android 16 Now
Testing Android 16 Developer Preview 2 is crucial for ensuring app compatibility and leveraging its new features. Google recommends developers use the preview to:
- Identify and fix potential issues early.
- Optimize app performance with new APIs.
- Provide feedback to improve the final release.
Conclusion
Android 16 Developer Preview 2 offers a range of updates designed to improve performance, usability, and security for both developers and end users. From adaptive refresh rates to advanced profiling tools and richer haptics, this release promises to set a new standard for Android apps.
As a developer, testing these features early will help you stay ahead of the curve and ensure your apps deliver a seamless experience when Android 16 is officially launched.
Stay tuned for more updates as Android 16 evolves, and don’t forget to explore the official Android Developer Guide for detailed documentation.