1

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 Jan 4 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. – Irfan Latif Jan 4 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 Jan 5 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 Jan 5 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 Jan 8 at 14:26
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.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.