Search code examples
androidandroid-sourceandroid-rom

AOSP OTA - Updating system apps with newer version does not override previously installed, older apk updates


We manage our own AOSP based firmware for our Set Top Boxes.

When we create a new OTA firmware, with newer versions of system apps. The newer versions of the system apps do not override the older versions installed in /data.

Is there any post install scripts, or other methods to enforce this?


Solution

  • Android sourcecode for PackageManagerService has following lines:

    mIsUpgrade = !Build.FINGERPRINT.equals(ver.fingerprint);
    ... some other code
    
    if (mIsUpgrade && !onlyCore) {
                    Slog.i(TAG, "Build fingerprint changed; clearing code caches");
                    ... cache clearing logic
                    ver.fingerprint = Build.FINGERPRINT;
    }
    

    That is, code caches will be cleared if build fingerprint is changed. Uncleared cache means package info for your app will seem the same (version info, flags etc.).

    This problem might occur because your OTA package has same fingerprint as the system it is installed on.

    Check your makefile and make sure you are generating a unique fingerprint for each build.

    Fingerprint value can be found in "system/buildprops" file. So you can check if that is the problem.