User-Interaction

Because fewer people lose their data when an OTA update fails thanks to the UDC feature, users have a better OTA update experience. As a result, fewer people may contact customer service with update-related problems. Users may observe numerous device reboots when an OTA update fails, though. We will now be discussing the various APIs which are a part of the Data Checkpoint one by one.

Particulars

API Used

Description

To Mark a Checkpoint void startCheckpoint(int retry) When the framework is prepared to begin an update, it calls this function. Before checkpointed file systems, like userdata, are mounted R/W after a reboot, the checkpoint is created. The updater calls needsRollback to determine whether a rollback of the update is necessary if the retry count is positive. The API defers to the A/B bootloader’s judgment if the retry count is zero.
To Mark the Changes void commitChanges() When the modifications are ready to be committed after a reboot, the framework invokes this function. This is invoked prior to BootComplete and before data (such as images, videos, SMS, and server reception of receipt) is written to userdata. This approach is ineffective if there are no ongoing checkpointed updates.
To Check if a RollBack is required bool needsRollback() When the system needs to enquire that does the fallback needs to be called, it can use this API and get the status in the form of a boolean value. A true means yes, a rollback is required.
To Cancel all the Changes Made abortChanges() If you want to cancel all the changes made, and also stop the process in between you can call the abort API to handle that, and use it to stop the process in between.

GeekTip #2: When performing a typical A/B update, this procedure is not invoked.

User Data Checkpoint (UDC) in Android 13

User Data Checkpoint is a crucial feature, which was initially introduced in Android 10, but has now improved over time, and now in Android 13, is better than ever. In this article, we will understand more about the concept of UDC, and how we can avail it in case our app ever differs from the OTA update policy and the update fails.

GeekTip #1: The User Data Checkpoint (UDC) is a fallback support, and is not ensured to act always when a crash or software update fails.

Similar Reads

What is User Data Checkpoint?

When an Android over-the-air (OTA) update fails, Android 10 introduces User Data Checkpoint (UDC), which enables Android to revert to its previous state. If an Android OTA update fails, the device can safely revert to its prior state thanks to UDC. While rollback is not supported when the user data partition (mounted on /data) is changed, A/B updates do solve this issue during early boot....

User-Interaction

Because fewer people lose their data when an OTA update fails thanks to the UDC feature, users have a better OTA update experience. As a result, fewer people may contact customer service with update-related problems. Users may observe numerous device reboots when an OTA update fails, though. We will now be discussing the various APIs which are a part of the Data Checkpoint one by one....

How to Implement UDC in Android?

To add the User Data Checkpoint, you will have to add several lines of code in your application, to let the Android system know that your app is ready to support UDC....

Conclusion

The User Data Checkpoint is a vital feature that is introduced and greatly improved over time, if your app is an app that handles the OTA updates on a user device, as part of the policy, or otherwise, then you can use these APIs to make the upgrade experience better for the users and save some time as well....