Diabetes moves on! :) #AndroidLollipop

As you probably already know, today the Android team has released the latest version of Android (Lollipop – V21) to all the developers across the World.
This version is full of new APIs and it will definitely be an important milestone for the green platform. As Holo did a while ago, Material is going to change the way in which we’re used to use our devices enchanting animations, transitions, colors and usability.

At the same time, developers will have a new set of API’s (some of them back ported by support libraries) that should be around 5K if what Ankur Kotwal says it’s true. Google has provided a diff between Android L and preview at the following link and another one against KitkatWatch here.

I would like to spend this post not trying to explain some philosophical thoughts, but just creating a list of things those in my opinion are definitely a plus and that in some ways will offer new possibilities for devs. So let’s move on without wasting any character.

What’s New(description per package):

  • android.app.job: one of the most famous things presented at the Google I/O this year was Project Volta and finally it’s possible to schedule jobs those can be executed under particular circumstances. Through the JobInfo.Builder you’ll create a JobInfo that will hold some informations regarding the executor and some constraints. Then, when the required conditions will be met, the OS will call the supplied component to execute the expected Job. In this way it’s possible to give to the OS more control and granularity, having benefits on the battery life.
  • android.app.usage:  contains a new framework that allows to obtain informations about the apps usage by time intervals.
    • this new set of info is protected by a system-level permission (PACKAGE_USAGE_STATS) that will not grant to third-party apps the access to the data
  • android.media.projection: through a MediaProjectionManager it’s now possible to create an Intent that will be launched in order to get a screen capture token. If everything succeed, the app will be able to capture screen contents and/or record system audio.
    • the user will be prompted to accept/reject the request.
    • this looks a little bit like an OAuth flow where the user has the right to decide what to do with the app request. In this case dynamically without having to ask any permission (weird and cool at the same).
    • potential vulnerabilities
    • potential cool stuff
  • android.service.restrictions.RestrictionsReceiver + android.content.RestrictionsManager: it’s now possible to query and override apps restrictions governed by an Administrator. The platform provides static and dynamics configurations those can be modified locally or remotely.
    • when an ongoing request receives a response, this result is notified through an Intent protected by ACTION_PERMISSION_RESPONSE_RECEIVED
    • static restrictions are declared in an XML
  • android.service.mediaandroid.media.browse: through MediaBrowserService(s) applications can now browse media content provided by an application and request to playing it.
    • a MediaSession allows to control and interact with media controllers and media keys. Once a session is established, as soon as the app finishes what it wanted to do, it MUST RELEASE THE CURRENT SESSION to clean up and release controllers. The owner of the session can decide to pass tokens to other processes in order to create remote controllers.

What’s Changed?

  • Deprecated GET_TASK permission
  • If you’re using DayDream now you must specify BIND_DREAM_SERVICE to be sure that only the system can bind to the Dream service.
  • Scene transitions for Activities and Fragments
  • PackageInstaller: installs, upgrades and deletes APK on the device
    • a session is opened in order to accomplish the APK operation(s)
    • the user intervention may be required in order to accomplish the expected result (the doc doesn’t say much but I guess that it’ll maybe ask for un-granted permissions and-or show what’s happening)
  • Drawables now support tinting
    • this allows to have a single drawable that can be then tinted with the color needed and that grants more flexibility with concept like the Palette (un-predictable result that would definitely bring UI inconsistency)
  • VectorDrawable and AnimatedVectorDrawable: those new drawables offers the interesting feature of Vectors declaration through XML. In this way through a format like SVG is possible to create drawables those can scale without loosing in quality…. AWESOME! 🙂
    • the SVG path for the AnimatedVectorDrawable must have the same length in terms of commands and parameters
  • AnimatedStateListDrawable, RippleDrawable
  • Deprecated android.hardware.Camera* in favor of android.hardware.camera2
    • it sounds weird but it’s
    • obviously deprecated doesn’t mean removed but it might happen in coming releases
  • Deprecated Soundpool, Ringtone, RemoteController, MediaRecorder,… Zzz Zzz
  • Added support for WebM, Vorbis and V8
  • Added support for TV in android.media.tv
  • In java.util.concurrent added support for:
    • ForkJoin
    • Phaser
    • RecursiveTask
    • … and more here
  • Added TtsSpan builders
  • android.transition: added transitions those will allow to follow the Material Guidlines (like explosion).

What’s Removed?

Bye bye android.hardware.location package.


Another important thing that I don’t to forget to mention is RecyclerView, a new widget that provides more flexibility and better performances compared to ListView. Actually, I’d say that it’s totally a different component that can have a similar behaviors to ListView under certain circumstances.
The main aspects that in my opinion make this component flexible, powerful and performant are:

  • A LayoutManager that allows to position, measure views inside the RecyclerView
    • the library already offers support for Grid, vertical and horizontal list, staggered list
  • RecycledViewPool allows to share views across different RecyclerViews
    • I haven’t tried it yet but in this way you can save the time for view inflation
  • ViewHolder: it took 21 versions of Android to enforce developers to use this concept and now even people those are not taking advantage of holding view references will be enforced to do it.
  • ItemAnimator allows to animate views modified by the Adapter. Possibly the massive issues that a component like ListView has, are solved
  • Part of support library and the dependency can be added in Gradle as compile ‘com.android.support:recyclerview-v7:+’

In the next coming months, I’ll give a try to some of the features those touching my current projects and I’d like to try the widgets those look really promising and definitely more extensible that the old ones.


About alchemiasoft

Android Developer at Bloomberg LP. Algorithms and performance passionate. Curious. Eager to learn.

Posted on October 18, 2014, in Android and tagged , , , , , , , , , , , , , , , , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: