private boolean isPermissionGranted ( String permission ) { if ( permission == null ) { throw new IllegalArgumentException ( "permission is null" ) ; } return context . checkPermission ( permission , android . os . Process . myPid ( ) , Process . myUid ( ) ) == PackageManager . PERMISSION_GRANTED ; }
Copied from android . support . v4 . content . ContextCompat for backwards compatibility