Posted by: Dave Burke, VP of Engineering
With billions of Android devices around the world, Android has surpassed our wildest expectations. Today at Google I/O, we showcased a number of ways we’re pushing Android forward, with the O Release, new tools for developers to help create more performant apps, and an early preview of a project we call Android Go -- a new experience that we’re building for entry-level devices.
On the Android team, we view each dessert release as an opportunity to make Android better for our users and our ecosystem partners. One thing we've consistently heard from our device-maker partners is that updating existing devices to a new version of Android is incredibly time consuming and costly.
With Android O, we've been working very closely with device makers and silicon manufacturers to take steps toward solving this problem, and we're excited to give you a sneak peek at Project Treble, the biggest change to the low-level system architecture of Android to date.
First, it's helpful to understand the "life of an Android release". There are several steps a new Android release goes through before getting into the hands of users:
With Project Treble, we're re-architecting Android to make it easier, faster and less costly for manufacturers to update devices to a new version of Android.
Android was unveiled in 2007 as a free, open-source mobile operating system. From the beginning, we intended Android to be scaled across a variety of manufacturers. We knew that consistency of API was important for developers, so we created a compatibility program for the Developer API specified by the Compatibility Definition Document (CDD) and its associated Compatibility Test Suite (CTS), now comprising over a million tests.
The result today is that app developers can write a single app that works across over a billion devices running on different hardware from different manufacturers.
Project Treble aims to do what CTS did for apps, for the Android OS framework. The core concept is to separate the vendor implementation — the device-specific, lower-level software written in large part by the silicon manufacturers — from the Android OS Framework.
This is achieved by the introduction of a new vendor interface between the Android OS framework and the vendor implementation. The new vendor interface is validated by a Vendor Test Suite (VTS), analogous to the CTS, to ensure forward compatibility of the vendor implementation.
Today, with no formal vendor interface, a lot of code across Android needs to be updated when a device moves to a newer version of Android:
With a stable vendor interface providing access to the hardware-specific parts of Android, device makers can choose to deliver a new Android release to consumers by just updating the Android OS framework without any additional work required from the silicon manufacturers:
Project Treble will be coming to all new devices launched with Android O and beyond. In fact, the new Project Treble architecture is already running on the Developer Preview of O for Pixel phones.
In addition to the architectural changes, we're working with our silicon and device partners to take their code changes, such as features for a carrier network in a specific country, and move them into the common Android Open Source Project (AOSP) codebase. For example, Sony and Qualcomm contributed dozens of features and hundreds of bugfixes to Android O so they no longer need to rework these patches with each new release of Android.
We plan to publish the full documentation for Project Treble on source.android.com with the launch of O later this summer.
Back in 2012, we introduced free trials support for Android app subscriptions. A free trial runs for a period of time that you set and then automatically converts to a full subscription based on the subscription's billing interval and price. Google Play supports free trials for all subscription types. Check out Free trials in our documentation for more details.
This feature is an important tool for user conversion because the user can try your app or game before committing to paying. To help you track the subscription status better, we are adding a third "paymentState" value to the Purchases.subscriptions API (on Google Play Developer API) to represent that the user is in a free trial. Possible values are:
Since there is a new possible value, it is necessary to check how your back end is handling the paymentState parameter. If you are doing something like this, you potentially could have a problem:
// WARNING: Don't do this! if (paymentState == 1) { // User is in normal state } else { // Handle user in grace period # this would now be a bug }
As a best practice, and to avoid issues on future updates, we recommend checking specifically for each possible case, like this:
if (paymentState == 0) { // Subscriber with payment pending } else if (paymentState == 1) { // Subscriber in good standing (paid) } else if (paymentState == 2) { // Subscriber in free trial }
You can check the Purchases.subscriptions documentation for more details. And if you're not offering free trials in your app or game, don't miss the chance to increase user conversions by letting them have a taste of your app - check out our documentation on Free trials.