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

Commit 5e130253 authored by Joey's avatar Joey
Browse files

Recorder: set minSdk to api 29 and cleanup



We are using MediaProvider now, which is unavailable
on api level < 29.
Moreover the aosp build env already sets the minSdk to
the current api level if unspecified.

Let's drop compatibility code and cleanup

Signed-off-by: default avatarJoey <joey@lineageos.org>
Change-Id: I13570f47d733a3f5be8c1d0c42ef60892f4971c9
parent a7fa15c7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2,9 +2,10 @@ apply plugin: 'com.android.application'

android {
    compileSdkVersion 29

    defaultConfig {
        applicationId "org.lineageos.recorder"
        minSdkVersion 26
        minSdkVersion 29
        targetSdkVersion 29
        versionCode 1
        versionName "1.1"
+2 −12
Original line number Diff line number Diff line
@@ -31,7 +31,8 @@
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        android:theme="@style/AppTheme"
        tools:ignore="GoogleAppIndexingWarning">

        <activity
            android:name=".RecorderActivity"
@@ -83,16 +84,5 @@
                <action android:name="org.lineageos.recorder.screen.ACTION_STOP_SCREENCAST" />
            </intent-filter>
        </receiver>

        <!-- File provider -->
        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="org.lineageos.recorder.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths" />
        </provider>
    </application>
</manifest>
+5 −6
Original line number Diff line number Diff line
@@ -21,12 +21,6 @@ import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -36,6 +30,11 @@ import android.widget.LinearLayout;
import android.widget.Switch;
import android.widget.TextView;

import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import org.lineageos.recorder.utils.LastRecordHelper;
import org.lineageos.recorder.utils.Utils;

+1 −0
Original line number Diff line number Diff line
@@ -358,6 +358,7 @@ public class RecorderActivity extends AppCompatActivity implements
        return hasAudioPermission() && hasPhoneReaderPermission();
    }

    @SuppressWarnings("SameReturnValue")
    private boolean hasAllScreenRecorderPermissions() {
        // None for now
        return true;
+8 −5
Original line number Diff line number Diff line
@@ -64,11 +64,11 @@ public class ScreencastService extends Service implements MediaProviderHelper.On
    private static final String SCREENCAST_NOTIFICATION_CHANNEL =
            "screencast_notification_channel";

    public static final String EXTRA_RESULT_CODE = "extra_resultCode";
    public static final String EXTRA_DATA = "extra_data";
    public static final String EXTRA_USE_AUDIO = "extra_useAudio";
    private static final String EXTRA_RESULT_CODE = "extra_resultCode";
    private static final String EXTRA_DATA = "extra_data";
    private static final String EXTRA_USE_AUDIO = "extra_useAudio";

    public static final String ACTION_START_SCREENCAST =
    private static final String ACTION_START_SCREENCAST =
            "org.lineageos.recorder.screen.ACTION_START_SCREENCAST";
    public static final String ACTION_STOP_SCREENCAST =
            "org.lineageos.recorder.screen.ACTION_STOP_SCREENCAST";
@@ -157,6 +157,9 @@ public class ScreencastService extends Service implements MediaProviderHelper.On
                "ScreenRecords/ScreenRecord-" + videoDate + ".mp4");

        File recordingDir = mPath.getParentFile();
        if (recordingDir == null) {
            throw new SecurityException("Cannot access scoped Movies/ScreenRecords directory");
        }
        //noinspection ResultOfMethodCallIgnored
        recordingDir.mkdirs();
        if (!(recordingDir.exists() && recordingDir.canWrite())) {
@@ -284,7 +287,7 @@ public class ScreencastService extends Service implements MediaProviderHelper.On
    }

    private boolean hasNoAvailableSpace() {
        StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath());
        StatFs stat = new StatFs(Environment.getDataDirectory().getPath());
        long bytesAvailable = stat.getBlockSizeLong() * stat.getBlockCountLong();
        long megAvailable = bytesAvailable / 1048576;
        return megAvailable < 100;
Loading