The point of this patch is to deal with the following case:
- A system application exists in the system partition. As such its
native code lies under /system/lib
- An upgrade for it is installed through Market and overrides the
version on the system partition. This places its native libraries
under /data/data/<pkgname>/lib/
- Finally, the system is upgraded through an OTA, with an even more
recent of the system application. We thus must remove the Market
package as well as the native libraries that are in <dataDir>/lib
since the new versions in /system/lib will be more recent.
The patch itself removes the files in <dataDir>/lib when such a
situation is detected. Note that this directory is created by the
PackageManager service and owned by the 'system' userID. The application
cannot create files there so simply erasing the content of the directory
is enough (and avoids reparsing the market package file to list
the installed binaries).
The patch also fixes a different issue which can be reproduced with:
- have system app installed on /system partition
- install an update (e.g. adb install -r Term.apk)
- uninstall the update (e.g. adb uninstall com.android.term)
the logcat shows that the PackageManager will unpack the native libraries
from the original /system/app/Term.apk into <dataDir>/lib, while they
already are in /system/lib. The patch fixes that too.
Change-Id: I5dfe27b91b6b31972e9cd4c196d15c3692732127