Block the upgrade of persistent apps

Currently when upgrading a persistent app the persistent flag will
be silently stripped from the newly installed app, resulting in
inconsitent app behaviour.

Persistent apps by definiton should not be possible to upgrade via
adb or any 3rd party installer. This commit adds a check which will
fail the upgrade of an app marked as persistent.

Bug: 66889554
Test: Manual
      - Create an app with the persistent flag set to true,
        push to /system/priv-app and reboot
      - Increment the app versionCode, build and install using
        adb install -r
      The attempted adb install should fail with:
      INSTALL_FAILED_INVALID_APK
Change-Id: Iaa00addcfbbb2adba319bea96b37e8bfb6e11372
1 file changed