How to Use Android Dynamic System Updates (DSU) for GSI Installation

Dynamic System Updates (DSU) is an Android system feature, introduced in Android 10, designed to streamline the process of testing and experimenting with different Android system images. It allows users to:

  • Download a new GSI (Generic System Image) or another Android system image onto your device.
  • Create a dedicated dynamic partition.
  • Load the downloaded GSI onto this newly created partition.
  • Boot the GSI as a separate, guest operating system on the device.

DSU provides a safe and efficient way to try out GSIs without the risk of corrupting your device’s current system image, enabling seamless switching between your original system and the GSI for testing purposes. While not directly an “APK Android partition tool” in the sense of a user-installed application for managing partitions, DSU is a powerful system-level feature that inherently works with dynamic partitions to facilitate system image updates and testing.

DSU Prerequisites

The functionality of DSU is built upon the Android Dynamic Partition feature. Furthermore, for security and trust, the GSIs utilized with DSU must be signed by Google or your device’s Original Equipment Manufacturer (OEM) as trusted system images.

It’s important to note that DSU is a feature implemented by your device’s manufacturer. To check if your device supports DSU, it’s best to consult your device manufacturer’s support documentation. Google has enabled DSU on Pixel 3 and later Pixel devices starting from the Android 10 Beta 4 release.

Installing GSIs via DSU and Command Line

This section outlines the steps to install a GSI using DSU through the command line interface.

Launching DSU

You can initiate DSU using the adb (Android Debug Bridge) tool.

  1. Download a GSI: Obtain a GSI from the GSI release page or another trusted GSI image server.

  2. Compress the GSI: Use gzip to compress the GSI image file.

    gzip -c system_raw.img > system_raw.gz
  3. Push the GSI to your device: Transfer the compressed GSI file to your device’s storage.

    adb push system_raw.gz /storage/emulated/0/Download/
  4. Start DSU Installation: Launch the DSU installation process using the following adb command:

    adb shell am start-activity  -n com.android.dynsystem/com.android.dynsystem.VerificationActivity  -a android.os.image.action.START_INSTALL  -d file:///storage/emulated/0/Download/system_raw.gz  --el KEY_SYSTEM_SIZE $(du -b system_raw.img|cut -f1)  --el KEY_USERDATA_SIZE 8589934592

    Upon executing this command, a notification will appear on your device, displaying the installation progress.

Booting into the GSI

Figure 1. The DSU control notification, providing options to manage the GSI.

Once DSU has successfully installed the GSI, a persistent notification, labeled as “DSU menu,” will be displayed in your system notification drawer, as shown in Figure 1.

From this notification, you have the following choices:

  • Restart into GSI: Tap Restart to boot your device into the newly installed GSI.
  • Discard GSI: Tap Discard to remove the installed GSI and revert back to your original system image upon the next reboot.

Switching Back to the Original System Image

After you have finished testing your applications or exploring the GSI environment, you can easily return to your device’s original system image by performing a cold reboot (simply restarting your device).

DSU offers a “sticky mode” which determines whether the GSI persists across multiple reboots. When sticky mode is enabled, the GSI will remain installed until you explicitly discard it. If sticky mode is disabled, the device will boot back into the original system image after a single GSI boot cycle.

To enable sticky mode, use this command:

adb shell gsi_tool enable

To disable sticky mode, use these commands:

adb shell gsi_tool disable

or

adb shell gsi_tool enable -s
adb shell gsi_tool disable

Installing GSIs via DSU Loader (Android 11+)

Android 11 introduced the DSU Loader, a user-friendly tool integrated into the device’s developer options. DSU Loader provides a graphical interface to download, install, and manage GSIs directly through the system UI, eliminating the need for command-line operations.

To install a GSI using the DSU Loader on devices running Android 11 or later:

  1. Enable Developer Options: If you haven’t already, enable developer options on your Android device.

  2. Access DSU Loader: Open your device’s Settings app, then navigate to Developer options > DSU Loader.

  3. Select a GSI: Choose the specific GSI you wish to install from the list presented in the DSU Loader.

  4. Accept Terms and Conditions: Review and agree to the GSI terms and conditions as prompted.

    Once you accept the terms, the selected GSI will begin downloading. You can monitor the download progress via the DSU notification.

  5. Restart into GSI: After the download is complete, tap Restart from the DSU notification to boot your device into the GSI.

  6. Switch back to Original System: To return to your device’s original system image at any time, simply tap Restart from the DSU system notification.

Providing Feedback

Your feedback is invaluable in improving DSU and other GSI-related features. Please share your experiences, report any issues you encounter with GSIs by filing GSI bugs, and engage in discussions on Stack Overflow to contribute to the GSI community.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

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