-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix file attachment crash #8908
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Can you sign the CLA please so that I may be able to merge this PR?
context.grantUriPermission(context.applicationContext.packageName, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION) | ||
} catch (e: SecurityException) { | ||
// Handle the exception, e.g., log it or notify the user | ||
Timber.w("Picker", "Failed to grant URI permission for $uri: ${e.message}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the permission is not granted, I guess the issue will appear later, when the app will try to access the file? What will happen in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use MDM, and having two containers, Personal space and Work space. Space is restricted with certain policies for accessing file in between.
Even though the explicit call grantUriPermission
fails, the intent with flag Intent.FLAG_GRANT_READ_URI_PERMISSION
succeed.
This ability to share files using intents with FLAG_GRANT_READ_URI_PERMISSION while grantUriPermission fails is likely a result of MDM policies that enforce strict separation between work and personal profiles. These policies are designed to protect user data while still allowing some level of interaction through standard Android intent mechanisms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks for the clarification!
Type of change
Content
Exception is handled when there is issue on granting permission.
Motivation and context
Steps to reproduce
Having Work / Personal MDM workspace container.
Restriction is there for file sharing from Work to Personal container.
Install and open the element android in the Work container.
Try to attach any file in the Personal workspace.
The app crashes when trying to grant permission
Closes #8907
Screenshots / GIFs
Tests
Tested devices
Checklist