Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56d358cd authored by Mark Harman's avatar Mark Harman
Browse files

Enable scoped storage for Android 10+.

parent d2c4ee6d
Loading
Loading
Loading
Loading
+27 −15
Original line number Diff line number Diff line
@@ -265,7 +265,7 @@ has a hardware menu button, pressing that should also open the settings.)</p>
photo/video (by default saved in the OpenCamera folder). If you get the message "No Gallery app available", then you should install
a Gallery app.
You can also "long press" on the Gallery icon - this will let you switch between the recent save locations, or take you straight to a
file dialog to choose a save location if additional locations have yet been defined. See
dialog to choose a save location if additional locations have yet been defined. See
<a href="#save_location">Save location</a> under Settings/More camera controls for more details.</p>

<p><b><img src="ic_pause_circle_outline_white_48dp.png" alt="Pause video icon" width="32" height="32">Pause video</b> - When recording
@@ -540,19 +540,27 @@ be in portrait. This option allows fixing the camera to either be in portrait or
<a href="#auto_stabilise">auto-level</a> is also enabled, it will have the effect of aligning photos to the nearest
90 degrees.</p>

<p><a name="save_location"><b>Save location</b></a> - Select the folder to store the photos in. Click on a folder
(or "Parent Folder") to navigate through the filesystem. Select "New Folder" to create a new folder in the currently
displayed folder. Select "Use Folder" to choose the currently displayed folder. Note that on Android, there are some
folders that cannot be written to - Open Camera will display a message if you try to use one of these folders. Once
you have specified a new save location, you can long press on the Gallery icon to quickly switch between recent save
locations. Note that if "Use Storage Access Framework" is selected, this option will instead show up the Android standard
file chooser - navigate to the desired folder, and click "SELECT". If you want to save to an SD card, see "How can I
save to my external SD card?" under the <a href="#faq">FAQ</a>.</p>
<p><a name="save_location"><b>Save location</b></a> - Select the folder to store the photos in.</p>
<ul>
    <li><b>On Android 9 or earlier:</b> This opens a file dialog. Click on a folder (or "Parent Folder") to navigate through
        the filesystem. Select "New Folder" to create a new folder in the currently displayed folder. Select "Use Folder"
        to choose the currently displayed folder. Note that on Android, there are some folders that cannot be written
        to - Open Camera will display a message if you try to use one of these folders.</li>
    <li><b>On Android 10 or later:</b> This opens a dialog to type the name of the folder. This
        will be a subfolder of DCIM on your internal storage. You can specify subfolders with the "/"
        character. For example, specifying Camera/holiday will save inside DCIM/Camera/holiday/
        on your internal storage.</li>
    <li><b>If "Use Storage Access Framework" is enabled</b>: Then on any Android version, this option
        will show up the Android standard file chooser - navigate to the desired folder, and click "SELECT" or
        "ALLOW ACCESS" (wording varies depending on Android version).</li>
</ul>
<p>Once you have specified a new save location, you can long press on the Gallery icon to quickly switch between recent save
    locations. If you want to save to an SD card, see "How can I save to my external SD card?" under the <a href="#faq">FAQ</a>.</p>

<p><b>Use Storage Access Framework</b> - If selected, Open Camera will instead use the Android
<a href="https://developer.android.com/guide/topics/providers/document-provider.html">Storage Access Framework</a>. This
has some advantages, such as using the standard Android file picker, and being the only way to save to SD cards on Android 5
- though it may be slightly slower to take photos. (Requires Android 5.0 or higher.)</p>
has some advantages, such as using the standard Android file picker, and being the only way to save to SD cards on Android 5+.
Furthermore on Android 10+, it is the only way to save outside of the DCIM/ folder. (Requires Android 5.0 or higher.)</p>

<!--Enter the folder to store the photos in. This can be either a relative path (e.g.,
OpenCamera or even something like MyPics/Camera) in which case the folder will be located inside the "DCIM"
@@ -891,8 +899,9 @@ Disabling this option will show the full extent of the panorama, but will leave
<p><b>Panorama original images</b> - Whether to save the original shots in <a href="#pano">Panorama</a> mode. This can be useful
if you want to use a third party application to stitch the images together to create a panorama. Note that these original
images are always saved in PNG format. This option can also be useful for debugging purposes, to send me example images when
reporting problems with panorama - for this, it's best to select to include the debug XML file (note that you'll typically need
a third party File Explorer application to see and delete XML files on Android).</p>
reporting problems with panorama - for this, it's best to select to include the debug XML file. Note the XML files will be
saved inside <small>Android/data/net.sourceforge.opencamera/files/</small>, and you'll typically need
a third party File Explorer application to see and delete XML files.</p>

<p><b>Front camera mirror</b> - Normally for front cameras, the preview will behave like a mirror, but resultant
photos will still be as the camera (or other people) view the scene. This option can be used to mirror the
@@ -1034,7 +1043,9 @@ the video itself, it stores the text in a separate subtitles
SRT files, and use them to display the information as subtitles. The subtitles will record the date and time. If "Store location data" is enabled (see
"Location settings" below), then the current location latitude and longitude coordinates will also be recorded (if the location is
known). Similarly for "Store compass direction". Note that you can control the formatting style for date, time and location using
the options under the "Photo settings" menu (Datestamp format, Timestamp format, GPS stamp format, Distance unit).</p>
the options under the "Photo settings" menu (Datestamp format, Timestamp format, GPS stamp format, Distance unit).
Note that on Android 10+, using this option means the ".SRT" files will show in most gallery apps as separate unplayable video
files. A workaround is to enable Settings/More camera controls/"Use Storage Access Framework".</p>

<p><b>Video bitrate (approx)</b> - If set to a value other than "default", the default video bitrate is overridden. Higher values mean better
    quality video, but the files take up more disk space. Note that some values may be unsupported by your device, and may
@@ -1155,7 +1166,8 @@ this information to the clipboard.</p>
    is the risk that settings on some devices may be incompatible with other devices. Also if the
    saved settings file specified a save location, this may not be valid on the new device (or if
    using "Storage Access Framework", you may have to reselect the folder in Open Camera, to grant
    write permission for the folder).</p>
    write permission for the folder). Note that on Android 10+, the file dialog will only let you
    select a file inside <small>Android/data/net.sourceforge.opencamera/files/</small>.</p>

<p><b>Reset settings</b> - Resets all Open Camera settings to their default. Selecting this option will cause
Open Camera to restart. Note that this will not delete any saved settings (see above options).</p>
+13 −0
Original line number Diff line number Diff line
@@ -65,8 +65,21 @@ FIXED Possible problem taking photos on some devices with LIMITED Camera2 API
FIXED   Possible problem with default edge mode and noise reduction mode behaviours on some devices
        with LIMITED Camera2 API support.
FIXED   UI would become sluggish if camera or storage permission denied with "Don't ask again".
UPDATED Now supporting "scoped storage" on Android 10+. This means storage permission is no longer
        required. However this means the following changes:
          * Saving outside of DCIM/ is no longer possible unless using the Storage Access Framework.
            If you had set up a custom save folder outside of DCIM/ and are on Android 10+, it will
            be reset to the default DCIM/OpenCamera/ folder. If you want to continue saving outside
            of DCIM/, you can enable Settings/More camera controls/"Use Storage Access Framework"
            and choose a new folder.
          * If using Video subtitles option, then the .SRT files will show up in gallery
            applications, unless Settings/More camera controls/"Use Storage Access Framework" is
            enabled.
        Note that these changes are required due to changes being made in Android that applications
        are required to support.
UPDATED Use seekbar for more settings (audio control sensitivity, image quality, photo stamp font
        size).
UPDATED Debug XML files for panorama now saved in Android/data/net.sourceforge.opencamera/files/.
UPDATED Camera now closed when in settings or preview otherwise in background.

Version 1.48.2 (2020/07/12)
+2 −2
Original line number Diff line number Diff line
@@ -54,8 +54,8 @@
<p>Open Camera accesses and records camera sensor and microphone data, which is used for the purpose
of taking photos and recording videos, to fulfil its purpose as a camera. Microphone permission is also used for the optional "Audio control" options.</p>

<p>Open Camera requires permission to "access photos, media and files on your devices", as this permission is required for Android to
save resultant files such as photos and videos to your device.</p>
<p>Open Camera requires permission (at least for Android 9 and earlier, or using versions of Open Camera older than 1.48.3) to
    "access photos, media and files on your devices" (storage permission), as this permission is required for Android to save resultant files such as photos and videos to your device.</p>

<p>Location permission is required for the optional geotagging features (for photos and videos, including stamp and subtitles options).
    When relevant option(s) are enabled, your device location will be stored in photo/video/subtitle files.
+2 −2
Original line number Diff line number Diff line
@@ -12,7 +12,8 @@

    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        android:maxSdkVersion="28"/>
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
@@ -28,7 +29,6 @@
        android:name=".OpenCameraApplication"
        android:theme="@style/AppTheme"
        android:largeHeap="true"
        android:requestLegacyExternalStorage="true"
        >
        <!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
        <activity
+2 −2
Original line number Diff line number Diff line
@@ -688,9 +688,9 @@ public class MainActivity extends Activity {
    /** Whether to use codepaths that are compatible with scoped storage.
     */
    public static boolean useScopedStorage() {
        return false;
        //return false;
        //return true;
        //return Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
    }

    public int getNavigationGap() {
Loading