Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
BriarWithLoRa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas
BriarWithLoRa
Commits
1614e72c
Verified
Commit
1614e72c
authored
3 years ago
by
Torsten Grote
Browse files
Options
Downloads
Patches
Plain Diff
Add FLAG_GRANT_READ_URI_PERMISSION when getting content
parent
a53a49e5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
briar-android/src/main/java/org/briarproject/briar/android/util/ActivityLaunchers.java
+10
-0
10 additions, 0 deletions
...rg/briarproject/briar/android/util/ActivityLaunchers.java
with
10 additions
and
0 deletions
briar-android/src/main/java/org/briarproject/briar/android/util/ActivityLaunchers.java
+
10
−
0
View file @
1614e72c
...
...
@@ -10,12 +10,14 @@ import androidx.activity.result.contract.ActivityResultContract;
import
androidx.activity.result.contract.ActivityResultContracts.CreateDocument
;
import
androidx.activity.result.contract.ActivityResultContracts.GetContent
;
import
androidx.activity.result.contract.ActivityResultContracts.GetMultipleContents
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
static
android
.
app
.
Activity
.
RESULT_CANCELED
;
import
static
android
.
bluetooth
.
BluetoothAdapter
.
ACTION_REQUEST_DISCOVERABLE
;
import
static
android
.
bluetooth
.
BluetoothAdapter
.
EXTRA_DISCOVERABLE_DURATION
;
import
static
android
.
content
.
Intent
.
EXTRA_MIME_TYPES
;
import
static
android
.
content
.
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
;
import
static
android
.
os
.
Build
.
VERSION
.
SDK_INT
;
import
static
org
.
briarproject
.
bramble
.
util
.
AndroidUtils
.
getSupportedImageContentTypes
;
...
...
@@ -23,6 +25,7 @@ import static org.briarproject.bramble.util.AndroidUtils.getSupportedImageConten
public
class
ActivityLaunchers
{
public
static
class
CreateDocumentAdvanced
extends
CreateDocument
{
@NonNull
@Override
public
Intent
createIntent
(
Context
context
,
String
input
)
{
Intent
i
=
super
.
createIntent
(
context
,
input
);
...
...
@@ -32,20 +35,24 @@ public class ActivityLaunchers {
}
public
static
class
GetContentAdvanced
extends
GetContent
{
@NonNull
@Override
public
Intent
createIntent
(
Context
context
,
String
input
)
{
Intent
i
=
super
.
createIntent
(
context
,
input
);
putShowAdvancedExtra
(
i
);
i
.
addFlags
(
FLAG_GRANT_READ_URI_PERMISSION
);
return
i
;
}
}
public
static
class
GetImageAdvanced
extends
GetContent
{
@NonNull
@Override
public
Intent
createIntent
(
Context
context
,
String
input
)
{
Intent
i
=
super
.
createIntent
(
context
,
input
);
putShowAdvancedExtra
(
i
);
i
.
setType
(
"image/*"
);
i
.
addFlags
(
FLAG_GRANT_READ_URI_PERMISSION
);
if
(
SDK_INT
>=
19
)
i
.
putExtra
(
EXTRA_MIME_TYPES
,
getSupportedImageContentTypes
());
return
i
;
...
...
@@ -54,11 +61,13 @@ public class ActivityLaunchers {
@TargetApi
(
18
)
public
static
class
GetMultipleImagesAdvanced
extends
GetMultipleContents
{
@NonNull
@Override
public
Intent
createIntent
(
Context
context
,
String
input
)
{
Intent
i
=
super
.
createIntent
(
context
,
input
);
putShowAdvancedExtra
(
i
);
i
.
setType
(
"image/*"
);
i
.
addFlags
(
FLAG_GRANT_READ_URI_PERMISSION
);
if
(
SDK_INT
>=
19
)
i
.
putExtra
(
EXTRA_MIME_TYPES
,
getSupportedImageContentTypes
());
return
i
;
...
...
@@ -67,6 +76,7 @@ public class ActivityLaunchers {
public
static
class
RequestBluetoothDiscoverable
extends
ActivityResultContract
<
Integer
,
Boolean
>
{
@NonNull
@Override
public
Intent
createIntent
(
Context
context
,
Integer
duration
)
{
Intent
i
=
new
Intent
(
ACTION_REQUEST_DISCOVERABLE
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment