I am using a android board with a custom ROM based on Android 4.4.2. I was trying to override a /system/priv-app/ app by installing an updated version in normal partition.

While testing I realised that the override only stays till reboot.So I started digging into AOSP source which is when I came across the call to disableSystemPackageLPw which in turn calls writeLPr.

If writeLPr goes through I expect to see my package listed in the "/data/system/packages.xml" file. However that is not the case here and hence I suspect that to be the root cause.

It would be great to know view on expected usage of packages.xml from the community users to confirm the same.

  • 1
    i don't believe this. where does system get old apk from after you replaced?
    – alecxs
    Commented Jan 4, 2020 at 14:21
  • 1
    As @alecxs said that should not happen because the new apk is immediately saved to /data/app on update. Settings might be cached for some time. Try clearing app's data after update. Or force write pm's cached data: dumpsys package write. Commented Jan 4, 2020 at 15:11
  • @alecxs The old apk is still in /system/priv-app. Based on what I read in PackageManager scan code. It scans the files system for paths /system/priv-app, /system/app, /vendor/app and /data/app for registering installed packages after boot. Since system/priv-app gets scanned first the old apk gets the oackage registered and the apk in /data is treated as duplicate. I get a log saying Skipping duplicate package in logcat from "PackageManager" tag,
    – Gamble
    Commented Jan 5, 2020 at 6:41
  • @IrfanLatif I tried out another android board. There I could verify that packages.xml had two entries for my package; one with tag <updated-package> and another with <package>. On this android board my update is retained after boot as expected. And I also do not see the Skipping Duplicate log. So overall I have come to a conclusion it is ROM specific problem.
    – Gamble
    Commented Jan 5, 2020 at 6:43
  • 1
    @alecxs I was able to get through to the person maintaining the ROM. packages.xml not having that entry was the root cause. Thanks
    – Gamble
    Commented Jan 8, 2020 at 14:26

1 Answer 1


As per stock android code. (AOSP) packages.xml needs to have the entry for installed packages for retaining any fancy priv-app kind of configuration/overrides/updates that we do.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .