-
Notifications
You must be signed in to change notification settings - Fork 6k
SecurityException: Permission Denial #21290
Changes from 14 commits
5d197bd
01f2153
9e4c909
795da8a
dce34fd
9443f65
8046589
6b74aa6
f1326fb
3a1fb98
8187b1a
1a28095
ccd25ef
8f5417c
d9ea4ae
9668074
b51174b
7d5a882
075248d
a67c6be
e57ea8a
ccc1bb3
051e3bd
c87294f
00b6be8
8d04b8c
5ebfcf4
06ca28b
e06d03b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,8 @@ | |
| import android.content.ClipData; | ||
| import android.content.ClipboardManager; | ||
| import android.content.Context; | ||
| import android.media.RingtoneManager; | ||
| import android.net.Uri; | ||
| import android.view.View; | ||
| import android.view.Window; | ||
| import io.flutter.embedding.engine.systemchannels.PlatformChannel; | ||
|
|
@@ -61,6 +63,18 @@ public void platformPlugin_getClipboardData() { | |
| ClipData clip = ClipData.newPlainText("label", "Text"); | ||
| clipboardManager.setPrimaryClip(clip); | ||
| assertNotNull(platformPlugin.mPlatformMessageHandler.getClipboardData(clipboardFormat)); | ||
|
|
||
| Uri uri = Uri.parse("content://media/external_primary/images/media/"); | ||
| clip = ClipData.newUri(fakeActivity.getContentResolver(), "URI", uri); | ||
| clipboardManager.setPrimaryClip(clip); | ||
| assertNull(platformPlugin.mPlatformMessageHandler.getClipboardData(clipboardFormat)); | ||
|
|
||
| uri = | ||
| RingtoneManager.getActualDefaultRingtoneUri( | ||
| fakeActivity.getApplicationContext(), RingtoneManager.TYPE_RINGTONE); | ||
| clip = ClipData.newUri(fakeActivity.getContentResolver(), "URI", uri); | ||
| clipboardManager.setPrimaryClip(clip); | ||
| assertNotNull(platformPlugin.mPlatformMessageHandler.getClipboardData(clipboardFormat)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we do better than assertNotNull here? Maybe assert the data is the string we expect?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not possible, The Uri will be converted to InputStreamReader in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't we just read the inputstream and make sure it contains what we'd expect?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dnfield wdyt : assertEquals
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. If there's something slightly less complicated where we can just check that it's an InputStream and that its contents are sane that's probably fine too.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will test with another Build Tools version and I will come back with feedback
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dnfield Test Updated. Thanks |
||
| } | ||
|
|
||
| @Test | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.