Remove privilege if a priv_app is removed via OTA

If a priv_app is removed from the system via an OTA, any update
to that application retains its privilege for the entirety of
that boot cycle. Once the device reboots a second time, any
update will lose its privilege.

We want to ensure the application loses its privilege as
soon as the version has been removed from the system image.

NOTE: It's still an open question about whether or not the
application's data should be cleared. It potentially had
access to privileged data, so, we may consider clearing
data in this scenario.

Fixes: 122806918
Test: Manual
Test: Put any application into /system/priv-app
Test: Verify application is PRIVILEGED
Test: Install application using 'adb install'
Test: Verify application is still PRIVILEGED
Test: Remove application from /system/priv-app
Test: Restart shell
Test: Verify application is NOT PRIVILEGED
Test: Repeat above up to removing /system/priv-app
Test: Corrupt APK on /data/app [eg. cat /dev/null > base.apk]
Test: Restart shell
Test: Verify application is no longer on the system
Change-Id: I6e9b2806aa1fbc681b56c55d2eba8495836726ef
1 file changed