Merge "Fix AppPermission to work with legacy apps"