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