What Is New in Android 4.2
Android 4.2 Jelly Bean was a significant update that refined the user experience and expanded developer capabilities. It introduced a smoother UI, new interaction models, and enhanced security features. This release built upon the foundation of 4.1 to make the platform more powerful and versatile.
| Category | Key Changes |
|---|---|
| User Experience | Lock screen widgets, Daydream screensavers, expanded Notification access |
| Input & Interaction | Gesture typing for keyboard, Miracast wireless display support |
| Security & Administration | Multiple user accounts (tablets), SELinux, Verify apps feature |
| Camera & Media | Photo Sphere, redesigned camera UI |
| Accessibility | Gesture mode navigation for blind users, magnification gestures |
| Developer Tools | Secondary display support, MediaCodec and MediaMuxer APIs |
How did Android 4.2 improve the lock screen?
Android 4.2 transformed the lock screen into a widget host. You could now add widgets directly to the lock screen, like a calendar or Gmail widget, for instant access to information without unlocking the device. This was a major shift in how users interacted with their devices at a glance. In practice, it required developers to consider how their app's widgets would function in a secure, limited-access environment.
What developer APIs were added for secondary displays?
The release added official support for secondary displays through the Presentation class. This API allowed an app to show different content on an external display, like a TV via Miracast, while showing a control interface on the device screen. It abstracted away the complexities of managing different display metrics and configurations. This was a game-changer for building presentation, kiosk, or dashboard apps.
Why was SELinux introduced in Android 4.2?
SELinux was first introduced in Android 4.2 to enforce mandatory access control (MAC) on key system daemons. This was a foundational step towards sandboxing core system processes to contain potential damage from vulnerabilities. It initially ran in permissive mode, only logging policy violations without enforcing them, to allow for testing and policy development. This move laid the groundwork for the stronger security model in later Android versions.
How did multiple user accounts work on tablets?
This feature allowed multiple people to share a single tablet, each with their own separate space for apps, homescreens, and data. Users could switch between accounts directly from the lock screen. For developers, it meant your app needed to handle multi-user storage paths correctly, as each user's data is isolated. The Context.getUser() API helped manage this.
FAQ
How do I create a lock screen widget for my app?
You use the same App Widget framework, but you must declare your widget to be available on the lock screen by including android:widgetCategory="keyguard" in your AppWidgetProviderInfo XML. The system imposes stricter size and interaction limitations on keyguard widgets compared to home screen ones.
What is the difference between the old secondary display methods and the new Presentation API?
Previously, you might have used DisplayManager directly, which was more complex. The Presentation class is a Dialog that automatically inherits the context and visual properties of the specified display, making it much simpler to build a UI tailored for a TV or projector.
Does the Photo Sphere API allow third-party apps to create immersive photos?
Yes, the android.graphics.Camera class was updated with new APIs for working with panoramic imagery. Third-party apps could leverage this to create and process their own Photo Sphere-like content, opening doors for new camera applications.
My app uses a custom video player. How can I use the new MediaMuxer class?MediaMuxer is for multiplexing encoded audio and video into a container format (like MP4). It's useful if your app is recording video, allowing you to take encoded tracks from MediaCodec and write them to a single file efficiently. It doesn't replace a playback engine.
Should I be worried about SELinux in Android 4.2 breaking my app?
No. In 4.2, SELinux runs in permissive mode only for the system, meaning it logs violations but does not block anything. Your app's functionality won't be affected. The enforcement was gradually rolled out to apps in much later Android versions.