Why does my app work fine without the needed permissions?

I have FileProvider:

		<provider
			android:name="androidx.core.content.FileProvider"
			android:authorities="com.bignerdranch.android.criminalintent.fileprovider"
			android:exported="false"
			android:grantUriPermissions="true">

			<meta-data
				android:name="android.support.FILE_PROVIDER_PATHS"
				android:resource="@xml/files"/>

		</provider>

files.xml:

<paths>
	<files-path name="crime-photos" path="."/>
</paths>

also i have the following listener:

			public void onClick(View v) {
				Uri uri = FileProvider.getUriForFile(getActivity(),
					"com.bignerdranch.android.criminalintent.fileprovider",
					mPhotoFile);
				captureImage.putExtra(MediaStore.EXTRA_OUTPUT,uri);

				List<ResolveInfo> cameraActivities =
					packageManager.queryIntentActivities(captureImage,
						PackageManager.MATCH_DEFAULT_ONLY);

				for(ResolveInfo activity : cameraActivities){
					getActivity().grantUriPermission(activity.activityInfo.packageName,
						uri,Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
				}

				startActivityForResult(captureImage, REQUEST_PHOTO);

			}

It works fine. I press the button, then i can take a photo and then i get back to the activity. But then i tried to comment some lines:

			public void onClick(View v) {
				Uri uri = FileProvider.getUriForFile(getActivity(),
					"com.bignerdranch.android.criminalintent.fileprovider",
					mPhotoFile);
				captureImage.putExtra(MediaStore.EXTRA_OUTPUT,uri);

//				List<ResolveInfo> cameraActivities =
//					packageManager.queryIntentActivities(captureImage,
//						PackageManager.MATCH_DEFAULT_ONLY);
//
//				for(ResolveInfo activity : cameraActivities){
//					getActivity().grantUriPermission(activity.activityInfo.packageName,
//						uri,Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
//				}

				startActivityForResult(captureImage, REQUEST_PHOTO);

			}

I expected that my app will crash after taking a photo because the activity that do this doesn’t have the FLAG_GRANT_WRITE_URI_PERMISSION permission. But it still works fine as if i didn’t comment that lines. Why ?