This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
SecurityException: Permission Denial #21290
Merged
chinmaygarde
merged 29 commits into
flutter-team-archive:master
from
hamdikahloun:hamdikahloun-patch-SecurityException
Oct 8, 2020
Merged
Changes from 6 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
5d197bd
SecurityException: Permission Denial
hamdikahloun 01f2153
SecurityException: Permission Denial
hamdikahloun 9e4c909
Update PlatformPlugin.java
hamdikahloun 795da8a
Update PlatformPlugin.java
hamdikahloun dce34fd
Merge branch 'master' into hamdikahloun-patch-SecurityException
hamdikahloun 9443f65
Update PlatformPlugin.java
hamdikahloun 8046589
Update PlatformPlugin.java
hamdikahloun 6b74aa6
Update PlatformPlugin.java
hamdikahloun f1326fb
Update PlatformPlugin.java
hamdikahloun 3a1fb98
TAG & Log
hamdikahloun 8187b1a
SecurityException for Build Tools 29 and below
hamdikahloun 1a28095
Add Test Uri ClipData
hamdikahloun ccd25ef
Add Test for Null Uri ClipData
hamdikahloun 8f5417c
Update PlatformPluginTest.java
hamdikahloun d9ea4ae
Update PlatformPluginTest.java
hamdikahloun 9668074
Update PlatformPluginTest.java
hamdikahloun b51174b
Update PlatformPluginTest.java
hamdikahloun 7d5a882
Update PlatformPluginTest.java
hamdikahloun 075248d
Update PlatformPluginTest.java
hamdikahloun a67c6be
Update PlatformPluginTest.java
hamdikahloun e57ea8a
Update PlatformPluginTest.java
hamdikahloun ccc1bb3
Update PlatformPluginTest.java
hamdikahloun 051e3bd
Update PlatformPluginTest.java
hamdikahloun c87294f
platformPlugin_getClipboardData: assertEquals Test
hamdikahloun 00b6be8
Update PlatformPluginTest.java
hamdikahloun 8d04b8c
Update PlatformPluginTest.java
hamdikahloun 5ebfcf4
Update shell/platform/android/io/flutter/plugin/platform/PlatformPlug…
dnfield 06ca28b
Update PlatformPlugin.java
hamdikahloun e06d03b
Merge remote-tracking branch 'upstream/master' into hamdikahloun-patc…
hamdikahloun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 suspect what we really want to do here is to use https://developer.android.com/reference/android/content/ClipData.Item#coerceToText(android.content.Context) - wdyt?
Uh oh!
There was an error while loading. Please reload this page.
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.
@dnfield i think it's SecurityException in
clip.getItemAt(0).coerceToText(activity)If getUri() is non-null and try to retrieve its data as a text stream from its content provider :So that's why i have to check if it's a MIMETYPE_TEXT_PLAIN:
Maybe we should use checkUriPermission :
Or :
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 think checking for the permission is pretty reasonable. I would say that if the app doesn't have permission, it would probably be helpful to have a debug log in there informing the developer that they should add it to their application to support this kind of copying and pasting.
What if the clip is the intent type?
Uh oh!
There was an error while loading. Please reload this page.
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.
The intent will be converted to String without any problem
Other Option :
Or
Try...Catch for SecurityException with debug log
coerceToText Source Code
URI
If ClipData.Item is a URI (getUri() is not null), coerceToText() tries to use it as a content URI:
If the URI is a content URI and the provider can return a text stream, coerceToText() returns a text stream.
If the URI is a content URI but the provider does not offer a text stream, coerceToText() returns a representation of the URI. The representation is the same as that returned by Uri.toString().
If the URI is not a content URI, coerceToText() returns a representation of the URI. The representation is the same as that returned by Uri.toString().
Intent
If ClipData.Item is an Intent (getIntent() is not null), coerceToText() converts it to an Intent URI and returns it. The representation is the same as that returned by Intent.toUri(URI_INTENT_SCHEME).
Source : CoerceToText
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.
@dnfield FYI :
flutter/flutter#66108 (comment)
Thanks