Search code examples
androidandroid-source

How does an AOSP OTA update deal with installed system app updates?


This is for a custom AOSP ROM for a custom kiosk mode device. Currently we have a system where the main kiosk app in /system/priv-app can download and install updated APKs of itself using PackageManager. We're now looking at implementing OTA updates so we can actually update the rest of the OS. My question is what happens if we use both types of update? I.e. the kiosk mode app downloads a new update of itself and installs the updated APK to the data partition, then we issue an OTA update which has a newer version of the app. Would Android delete the older update automatically from /data and revert back to the now newer version in /system/priv-app? Also, what happens if the OTA update has an updated app but is still older than the latest update installed?

The reason for not exclusively using OTA updates is that some of our older devices can't be updated with OTA, so we just push the app updates, so ideally we can continue with the same process for all devices then push extra OTA updates for the newer devices when needed.


Solution

  • The answer seems to be that even if the OTA update updates the APK to a newer version, PackageManager still has the original version number cached somewhere so thinks the version on /system/priv-app is the older one. I haven't had chance to look into it any further, but it appears to be that any updates installed to /data will always take precedence but only because PackageManager doesn't recognise that the /system/priv-app version has been updated by the OTA update.