public AppSecurityPermissions(android.content.Context context, string packageName ) { mContext = context; mPm = mContext.getPackageManager(); mPermsList = new java.util.ArrayList <android.content.pm.PermissionInfo>(); java.util.Set <android.content.pm.PermissionInfo> permSet = new java.util.HashSet < android.content.pm.PermissionInfo>(); android.content.pm.PackageInfo pkgInfo; try { pkgInfo = mPm.getPackageInfo(packageName, android.content.pm.PackageManager.GET_PERMISSIONS ); } catch (android.content.pm.PackageManager.NameNotFoundException) { android.util.Log.w(TAG, "Could'nt retrieve permissions for package:" + packageName ); return; } // Extract all user permissions if ((pkgInfo.applicationInfo != null) && (pkgInfo.applicationInfo.uid != -1)) { getAllUsedPermissions(pkgInfo.applicationInfo.uid, permSet); } foreach (android.content.pm.PermissionInfo tmpInfo in Sharpen.IterableProxy.Create (permSet)) { mPermsList.add(tmpInfo); } }
private bool isPackageUnavailable(android.content.pm.PackageManager pm) { try { return(pm.getPackageInfo(packageName, 0) == null); } catch (android.content.pm.PackageManager.NameNotFoundException) { return(true); } }
private void getPermissionsForPackage(string packageName, java.util.Set <android.content.pm.PermissionInfo > permSet) { android.content.pm.PackageInfo pkgInfo; try { pkgInfo = mPm.getPackageInfo(packageName, android.content.pm.PackageManager.GET_PERMISSIONS ); } catch (android.content.pm.PackageManager.NameNotFoundException) { android.util.Log.w(TAG, "Could'nt retrieve permissions for package:" + packageName ); return; } if ((pkgInfo != null) && (pkgInfo.requestedPermissions != null)) { extractPerms(pkgInfo.requestedPermissions, permSet); } }