And Now, Your 'L' API Change WTFs

With each Android release, Google issues an API differences report, outlining things that were added, changed, or removed in a new API level compared to the previous one.

For whatever reason, the “L” Developer Preview’s differences report is published, along with the JavaDocs, in a poorly-structured ZIP archive.

I always review this to see what’s different beyond the sorts of changes that get more disclosure, coverage in Google I|O presentations, etc. And “L” has some significant changes.

NOTE: This analysis is based on the preview. It is entirely possible that some of the things in here will revert back to previous implementations by the time “L” ships as Android 5.0 (or whatever they call it). Hence, while this blog post represent areas of concern, be sure to double-check with the shipping version when it actually does ship.

NOTE #2: In Android, “deprecated” means “we think that there is a better solution, and we can’t guarantee that we will support what’s here indefinitely, but at the moment at least, it should work”.

Of note, with regressions bolded:

  • Action bar navigation, of all forms, is deprecated. This includes both action bar tabs and drop-down (“list”) navigation. It does not include the “custom view navigation” (e.g., browser address bar). I suppose the eliminates my concerns over the behavior of action bar tabs…

  • Part of the reason for this is that the action bar is being pulled out into something more readily manipulable by us developers. Activity has a setActionBar() method, taking a Toolbar parameter. Toolbar basically looks like a simplified action bar and can be placed in arbitrary spots elsewhere in your view hierarchy, in contrast with the locked-to-the-top action bar.

  • Activities can be “persistable”, in that they “persist across reboots”. I am guessing that this is tied into the new extension of “recents” to include documents. As a side effect of this, we have new flavors of onSaveInstanceState() and kin on Activity that allow us to populate both a Bundle and a PersistableBundle, the latter of which presumably survives the reboot.

  • getRecentTasks() and getRunningTasks() on ActivityManager are now deprecated and will return a reduced result set on L and higher devices.

  • BatteryManager now gives us the ability to directly access battery information, without having to fuss with registering a null receiver for ACTION_BATTERY_CHANGED.

  • bindService() now requires an explicit Intent, if your targetSdkVersion is set to L or higher. I would consider using implicit Intents here to be a code smell anyway, but if you are using them with your service, be forewarned. UPDATE: According to Alex Curran, this breaks the in-app purchasing (IAP) integration code.

  • We now have getExternalMediaDirs(), which is a bit like getExternalFileDirs(), but represent directories that will be scanned by the MediaStore.

  • A boatload of new stuff has been added to DevicePolicyManager for those of you using the device admin APIs.

  • FragmentBreadCrumbs is now deprecated, for the six of you who were using that class. :-)

  • There is a new LauncherApps class that helps simplify finding the relevant launchable activities. This is tied into the new managed profiles system.

  • MediaStore has been augmented with MediaStore.Audio.Radio. It is largely undocumented, and so it is unclear if this is referring to streaming radio stations, classic broadcast radio (e.g., FM), or something else.

  • The TOP_LEVEL_* patterns in Patterns are now deprecated, presumably reflecting the fact that the number of top-level domains is expanding rapidly.

  • Android now has some amount of tracking of “power save mode”, with an isPowerSaveMode() on PowerManager and an ACTION_POWER_SAVE_MODE_CHANGED broadcast. Whether this is for OEM-specific modes or for some new common power save framework in Android, I cannot say.

  • In what might be a first, something was “undeprecated”, specifically INSTALL_NON_MARKET_APPS on Settings.Secure, as it was moved back there from Settings.Global.

  • WebSettings now lets you control mixed-content mode, referring to whether WebView should load insecure content from a secure origin.

There are many other changes as well, particularly ones tied to “big ticket” changes in L, but these were ones that caught my eye.