A/B Seamless Update in Android R, painful for OEM?

Published: Last Updated on 559 views 9 minutes read
A+A-
Reset

Still many devices are yet to get Android 10 update, Google is working on next Android version which will be called Android 11 and code named Android R for now. Google is changing way to deliver seamless updates in Android R.

Last year Google changed naming culture for their Android version.

According to a commit in Android Open Source Project (AOSP) Gerrit, a new piece of code has emerged as first reported by XDA-Developers.

If this commit is merged, then it will make compulsory for all Android Phone makers (OEMs) to apply this feature for getting approval for GMS (Google Mobile Services). According to this commit titled, “Require Virtual A/B on R launches.” device will have to support of A/B partitions.

What is A/B System Update (Seamless Updates)?

If it has to be described in simple words, the device will have two partitions for Android System code where one will be active and another will be inactive by default. When any Android update is released via OTA, the update will be installed in inactive partition and Android System will be updated with new one.

After doing all optimizations, device will ask for reboot, Once rebooted, the earlier inactive partition will be active and active one will become inactive. In next update, the same process is repeated.

Let’s understand this better with below graphics.

A/B Partition working illustrations for Seamless Updates
A/B Partition working illustrations

As you can see in above diagram, A/B partition enabled device will have two partition for Low level Operating System code (/system folder in Android). Lets understand better with bullet points.

  • Both will come pre-installed with same version of code.
  • A will be primary partition (Booting Operating System)
  • B will be inactive just waiting for updates. (Just similar to recovery partion)
  • Once new update hits phone, this new update will be installed in B partition.
  • This process is called seamless updates.
  • After installation is completed, device reboots and makes B partition as boot partition.
  • B partition is active and running new Android while A partition will be inactive and wait for next update.

What is Custom ROM?

AOSP (Android Open Source Project) is the base of every Android ROM. Either you use Google’s device that come with Stock ROM, other Android One phones, slightly customized near Stock ROMs (like Motorola), or heavily customized MIUI (Xiaomi) or EMUI (Huawei).

All these custom ROMs communicate with AOSP. You can simply tell Custom ROMs are cloths which a man wears on different cultures/occasions. They have added multiple layers of skins above core Android system and whenever they update software, this has to take part on overall skin (custom rom).

What is Project Treble?

Project Treble started back in the days of Android N (7.0) to tackle the security problem with Android devices. Most of the vendors are told to make all future devices compatible with Project Treble. So that updates that Google’s AOSP team delivers can be delivered to devices as soon as possible with least efforts.

As every Android device is unique in itself. ROM designed for a device can’t be installed in other. This is because, every device has different set of hardware and chip-makers share code with OEMs for particular variant of hardware.

Understanding from general prospective, a phone contains Camera, Processor, Storage, Memory, Network Antenna, Graphics Card, Audio Card etc. These all parts are from different manufacturers and different phone has different properties attached to these hardware.

For understanding, Qualcomm Snapdragon 845 in POCO F1 might have different hardware optimization as compared to Qualcomm Snapdragon 845 in Zenfone 5Z.

So, Google changed architecture of Android starting Android 8.0 and make all different layers. Understand by below graphics directly from Android Architecture page.

Android system architecture for Seamless Updates
Android system architecture © Android Project

Why it is difficult for OEMs (Original Equipment Manufacturer) to comply with this A/B partition?

There are few points to be considered for OEMs which make them unhappy to comply this settings related to seamless updates..

  1. Adding a new partition means additional storage. If you already own Android device, you can see almost 4GB to 15GB of storage is consumed by device operating system. If they have to replicate the system partition and create a new partition, they will be selling device with lesser available space for user
  2. Additional working. As most of device manufacturer have developed own custom ROM and they have unique features compared to other phone maker, there will be problem with update process as simultaneously other custom apps will also have to be updated and linked with the base OS.
  3. They may not want to change their workflow which has been established.

Benefits of Seamless Updates (A/B System Updates)

A. OTA updates can occur while the system is running, without interrupting the user. Users can continue to use their devices during an OTA—the only downtime during an update is when the device reboots into the updated disk partition.
B. After an update, rebooting takes no longer than a regular reboot.
C. If an OTA fails to apply (for example, because of a bad flash), the user will not be affected. The user will continue to run the old OS, and the client is free to re-attempt the update.
D. If an OTA update is applied but fails to boot, the device will reboot back into the old partition and remains usable. The client is free to re-attempt the update.
E. Any errors (such as I/O errors) affect only the unused partition set and can be retried. Such errors also become less likely because the I/O load is deliberately low to avoid degrading the user experience.
F. Updates can be streamed to A/B devices, removing the need to download the package before installing it. Streaming means it’s not necessary for the user to have enough free space to store the update package on /data or /cache.
G.The cache partition is no longer used to store OTA update packages, so there is no need to ensure that the cache partition is large enough for future updates.
H. dm-verity guarantees a device will boot an uncorrupted image. If a device doesn’t boot due to a bad OTA or dm-verity issue, the device can reboot into an old image. (Android Verified Boot does not require A/B updates.)

Benefits of Seamless Updates from Android Update documentation page
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <android-base/properties.h>
#include <gtest/gtest.h>

static constexpr const char kEnabled[] = "ro.virtual_ab.enabled";
static constexpr const char kRetrofit[] = "ro.virtual_ab.retrofit";

using android::base::GetBoolProperty;

TEST(VirtualAbRequirementTest, EnabledOnLaunchR) {
  EXPECT_TRUE(GetBoolProperty(kEnabled, false))
      << "Device must use Virtual A/B.";
  EXPECT_FALSE(GetBoolProperty(kRetrofit, false))
      << "Device must not retrofit Virtual A/B.";
}

This piece of code is from the said commit which is created on Gerrit Code Review system of Android Open Source Project by Google Engineer Yifan Hong. If this is merged and integrated in Android, then device manufacturer has to comply with this A/B partition setting to get approval for using Google Play Services and in return they will be able to deliver seamless updates on Android R onward.

Related Posts

Leave a Reply

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Index

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.