Improve the logic for determining whether the caller is a system app

Bug: 10024554
Change-Id: I742e918840a98dd83d713bdf7a43a919674e65fe
16 files changed