Discovering the Android APIs evolution.

According to IDC  Android is the most popular mobile operating system in the world. Nothing new there, for many years android was the leader. But, what’s amazing is the growth percent between 2011 and 2014.

Android8

Each day many new android apps are available, these apps are developed using the Android APIs, Google provides on a regular basis new updates and improvements to their APIs. Let’s discover the evolution  of the Android APIs by comparing the Android4.4.4 with the new major version Android5.0.0 using JArchitect.

Here’s a summary of changes between the two versions:

android1

The API growths by 15%. Many packages, classes and methods are added which is a good a indicator that many new features were introduced in the new major API.  However the cyclomatic complexity average was increased  by 4%.

Features added

The Android APIs adopt the package by feature approach. Package-by-feature uses packages to reflect the feature set. It places all items related to a single feature (and only that feature) into a single directory/package. This results in packages with high cohesion and high modularity, and with minimal coupling between packages. Items that work closely together are placed next to each other.

Therefore the best way to discover the features added is to search for the new packages introduced:

Android2

Some of them existed before like com.android.mms.*. they were  present on the device but not in the sdk. In the new major sdk version, these packages and their classes are now prenst in the SDK.

Some others were added to structure better the SDK, like android.server.backup which contains now classes like BackupManagerService moved from android.server.

And others are added to provide new features:

com.android.okioOkio is a new library that complements java.io and java.nio to make it much easier to access, store, and process your data. And now its included to the Android SDK.

com.android.server.usage which provides  a service that collects, aggregates, and persists application usage data.

com.android.server.voiceinteraction which provides classes needed to  treat the interaction with the user by using voice.

com.android.server.tv which provides useful classes to manage the televesion features.

com.android.ims which provides many classes to manage IMS feature.

android.telecom which provides access to Telecom-related functionality.

android.service.fingerprint which provides  classes to manage the fingerprint feature.

Added Annotations

Android10

Some annotations were added. Maybe the most interesting one is the Nullable one which denotes that a parameter, field or method return value can be null. When decorating a method call parameter, this denotes that the parameter can legitimately be null and the method will gracefully deal with it. Typically used on optional parameters.When decorating a method, this denotes the method might legitimately return null.

Added Interfaces

Android11

Interfaces are the recommended way to define the contract of provided features. Many interfaces were added in the new packages to abstract these new features. And the best way to know each feature capabilities is to search for its interfaces, and discover the methods defined by them.

Added Classes to the existing packages

Many useful classes were added to the existing packages to provide some recurrent technical needs.

Android12

As we can remark, many of them are internals and exist in the com.android.internal.* packages. However, we can search for added classes not in the internal packages:

Android14

Classes are added in many packages, developers should care about some of them, they could facilitate the developement of some features. For example the PdfRenderer could be useful when rendering to pdf capability is needed.

Methods added to the existing Classes:

Android4

Many useful methods were added to the existing classes, The following metric view shows their distribution inside the code base.

Android5

 

In the Metric View, the code base is represented through a Treemap. Treemapping is a method for displaying tree-structured data by using nested rectangles. The tree structure used  is the usual code hierarchy:

  • Project contains packages.
  • Package contains types.
  • Type contains methods and fields.

The treemap view provides a useful way to represent the result of a CQLinq request; the blue rectangles represent this result, so we can visually see the methods concerned by the request.And as we can observe the added methods are distributed in almost all packages. Therefore all the Android API features are concerned by the API improvement.

Methods becoming obsolete

Android15

Only few methods become obsolete. It’s interesting to know them and avoid their use when using the new major API version.

Visibility changes for methods:

Android7

Some methods become private to enforce the encapsulation, others become public to let them accessible to apps developers, and some others become protected to make them visible to child classes.

Summary

The new major version contains many new interesting features, many packages, classes, methods and fields were added. Thanks to google many new features are added in each new major version. The android developers will benefit from all these improvements which help them to produce amazing games and utilities to the end users.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *