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

1.1k Views Asked by At

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?

2

There are 2 best solutions below

0
On BEST ANSWER

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.

0
On

Please make sure newer versions of system apps have higher version code than old existing version code.

PackageManagerService looks for the better version by comparing the version code. After OTA update if your system/priv-app has a higher version than data/app version, system/priv-app will take the precedence.