private boolean isGrantedForBackwardsCompatibility ( String pkgName , PackageInfo permissionsInfo ) { // Note: it might be cleaner to auto-grant these permissions when the package is added to the // PackageManager. But many existing tests modify the requested permissions _after_ adding the // package to the PackageManager, without updating the requestedPermissionsFlags. return permissionsInfo . requestedPermissionsFlags == null // Robolectric uses the PackageParser to create the current test package's PackageInfo from // the manifest XML. The parser populates the requestedPermissionsFlags, but doesn't grant // the permissions. Several tests rely on the test package being granted all permissions, so // we treat this as a special case. || pkgName . equals ( RuntimeEnvironment . application . getPackageName ( ) ) ; }
Returns whether a permission should be treated as granted to the package for backward compatibility reasons .