Class UpdateService

All Implemented Interfaces:
CtxEventListener, ContextHandleAware, HandleAware, Ready, ReadyListener

public final class UpdateService extends AbstractService
This service handles USB based updates to the device. The service is very simple and provides two key functions:
  • Find available updates: The service will mount each attached storage device (usb drive) and search all the kabs in the root directory to see if there are any compatible manifest chains.
  • Install a particular chain: Using the results from the fist step to identify a particular manifestId and deviceId, install the release.
This service automatically search all connected usb storage devices and will only mount them while they are needed, allowing them to be removed immediately upon completion of the installation.

This service can be used in conjunction with StorageService which generates events when usb storage devices are inserted / removed. This can be used to trigger the check for available updates which effectively identifies updates immediately upon device insertion.

Version:
2024-05-03
  • Method Details

    • getAvailableUpdates

      public List<UpdateInfo> getAvailableUpdates()
      Return the list of available software that exists on storage devices that can be installed on this device. This automatically iterates through all available usb storage devices to check for compatible manifest chains, utilizing ManifestChainResolver . The results of all compatible releases are returned such that they can be presented for a user to pick from the options and trigger an install.
    • installUpdate

      public FutureWork installUpdate(String manifestId, String deviceId)
      Install an update with the specified manifestId on the storage device with the specified deviceId. This information is available in UpdateInfo objects returned from getAvailableUpdates() . This will mount the storage device for the duration of the install and then unmount it when complete, allowing it to be safely removed immediately after install.

      As this process is meant to be triggered from a user in front of the device, it will activate the new release once installed. For deferred updates such as those delivered over the air, refer to OTAService which provides extensive OTA functionality.

      Parameters:
      manifestId - id of the first manifest in the chain
      deviceId - id of the storage device that contains the update
    • installUpdate

      public FutureWork installUpdate(String manifestId, File dir)
      Install an update with the specified manifestId from the specified directory. This can be used to install from an internal source such as an internal drive which is not detected by the standard update process which is primarily focused at usb storage devices. This can be used along with ManifestChainResolver to support installations from internal sources with minimal effort.

      As this process is meant to be triggered from a user in front of the device, it will activate the new release once installed. For deferred updates such as those delivered over the air, refer to OTAService which provides extensive OTA functionality.

      Parameters:
      manifestId - id of the first manifest in the chain
      dir - the directory to install from