Android M Preview comes with several breaking changes, related to Permissions, Dozing, WiFi, ART, and several others.
Besides some new capabilities and interface tweaks – new font, the app drawer and widget picker scale vertically, search inside apps, a new Pay system, black theme, improved battery life, etc. – Android M, which is now available as Preview for developers, comes with several behavioral changes which may impact many applications. We emphasize the following changes:
Users will no longer be asked during install if they agree with all permissions. Applications targeting Android M are automatically provided a few basic permissions (PROTECTION_NORMAL
– Internet access, alarm) during installation. For any other permission needed, the user is asked at runtime when the app requests for it. The user can accept or deny the permission. Also, the user can turn on/off individual permissions for applications via a settings page. For an app to target M it has to use the new permission model. Applications targeting M will still work with previous Android versions by using the old permissions model.
Developers are recommended to:
- Always check for existing permission for any action that requires one.
- Handle lack of permission gracefully by disabling a certain feature of the app, or disabling all features and informing the user.
- Consider that permissions are revocable, and apps are not notified when a permission is turned off.
Google recommends testing apps for M to make sure they perform correctly and react gracefully when certain permissions are denied or revoked. This page provides detailed instructions on how to tests apps for the new permissions system.
Android M introduces a new sleep mode that is supposed to lengthen the life of the battery. This mode introduces a few restrictions for apps:
- Network access is disabled, except for high priority GCM messages.
- Wake locks are ignored.
- Alarms set up with
AlarmManager
are disabled, except forsetAlarmClock()
andAlarmManager.setAndAllowWhileIdle.
- No WiFi scans.
- Syncs and jobs for a sync adapter and
JobScheduler
are disabled.
The device is waked up from dozing from time to time to execute any jobs and syncs that are pending. According to Google, preliminary tests showed that dozing doubles the life span of the battery for a device left in stand by mode.
Auto Backup and Device Identifiers
Google will back up application data to a user’s Google Drive account every 24 hours when the device is idle, charging and connected to WiFi. Data is encrypted before backing it up. A limit of 25 MB per app exists for M Preview. We don’t know if there will be a limit when M is released. This data won’t be counted against a user’s Drive limit, and the user can opt out.
Application developers do not need to write any code for this feature to work, but they need to specify which files are to be backed up or not. They can also forbid certain resourced from being backed up on Google’s cloud. It is recommended device identifiers, caches and temporary data to be excluded from back up.
Other Android M behavior changes need developers’ attention: Adoptable Storage Devices, Apache HTTP Client Removal, AudioManager Changes, Text Selection, Android Keystore Changes, Wi-Fi and Networking Changes, Camera Service Changes, ART Runtime, APK Validation, Android for Work Changes.
Android M Preview images are available for Nexus 5, 6, 9, Player, as well as emulator. Google intends to release other two previews in June and July, followed by the GA of Android M in Q3/2015.