Skip to content

Commit 345fa98

Browse files
authored
[camerax] Revert "Explicitly remove READ_EXTERNAL_STORAGE permission" (#7826)
Reverts logic to remove `READ_EXTERNAL_STORAGE` permission from merged Android manifest (between plugins and Flutter app) by default. Turns out that this logic conflicts with Flutter plugins/apps that actually require the `READ_EXTERNAL_STORAGE` permission. Specifically, reverts #4716 and adds documentation so that users know how to manually remove `READ_EXTERNAL_STORAGE` from the merged manifest if they wish. Fixes flutter/flutter#156198 and adds documentation to address flutter/flutter#131116.
1 parent 9d00fb1 commit 345fa98

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

packages/camera/camera_android_camerax/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.6.10
2+
3+
* Removes logic that explicitly removes `READ_EXTERNAL_STORAGE` permission that may be implied
4+
from `WRITE_EXTERNAL_STORAGE` and updates the README to tell users how to manually
5+
remove it from their app's merged manifest if they wish.
6+
17
## 0.6.9+2
28

39
* Updates Java compatibility version to 11.

packages/camera/camera_android_camerax/README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,21 @@ and thus that parameter will silently be ignored.
5757

5858
In order to save captured images and videos to files on Android 10 and below, CameraX
5959
requires specifying the `WRITE_EXTERNAL_STORAGE` permission (see [the CameraX documentation][10]).
60-
This is already done in the plugin, so no further action is required on your end. To understand
61-
the implications of specificying this permission, see [the `WRITE_EXTERNAL_STORAGE` documentation][11].
60+
This is already done in the plugin, so no further action is required on your end.
61+
62+
To understand the privacy impact of specifying the `WRITE_EXTERNAL_STORAGE` permission, see the
63+
[`WRITE_EXTERNAL_STORAGE` documentation][11]. We have seen apps also have the [`READ_EXTERNAL_STORAGE`][13]
64+
permission automatically added to the merged Android manifest; it appears to be implied from
65+
`WRITE_EXTERNAL_STORAGE`. If you do not want the `READ_EXTERNAL_STORAGE` permission to be included
66+
in the merged Android manifest of your app, then take the following steps to remove it:
67+
68+
1. Ensure that your app nor any of the plugins that it depends on require the `READ_EXTERNAL_STORAGE` permission.
69+
2. Add the following to your app's `your_app/android/app/src/main/AndroidManifest.xml`:
70+
71+
```xml
72+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
73+
tools:node="remove" />
74+
```
6275

6376
### Allowing image streaming in the background
6477

@@ -91,4 +104,5 @@ For more information on contributing to this plugin, see [`CONTRIBUTING.md`](CON
91104
[10]: https://developer.android.com/media/camera/camerax/architecture#permissions
92105
[11]: https://developer.android.com/reference/android/Manifest.permission#WRITE_EXTERNAL_STORAGE
93106
[12]: https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE_CAMERA
107+
[13]: https://developer.android.com/reference/android/Manifest.permission#READ_EXTERNAL_STORAGE
94108
[148013]: https://github.com/flutter/flutter/issues/148013
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:tools="http://schemas.android.com/tools"
32
package="io.flutter.plugins.camerax">
43
<uses-feature android:name="android.hardware.camera.any" />
54
<uses-permission android:name="android.permission.CAMERA" />
65
<uses-permission android:name="android.permission.RECORD_AUDIO" />
76
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
87
android:maxSdkVersion="28" />
9-
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
10-
tools:node="remove" />
118
</manifest>

packages/camera/camera_android_camerax/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: camera_android_camerax
22
description: Android implementation of the camera plugin using the CameraX library.
33
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
5-
version: 0.6.9+2
5+
version: 0.6.10
66

77
environment:
88
sdk: ^3.5.0

0 commit comments

Comments
 (0)