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

Commit a1220a75 authored by Joey's avatar Joey
Browse files

Recorder: support down to api24



Change-Id: I31595a77c939877de5f4c69d96f135e551fc181a
Signed-off-by: default avatarJoey <joey@lineageos.org>
parent 53a78807
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ android {
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "org.lineageos.recorder"
        minSdkVersion 26
        minSdkVersion 24
        targetSdkVersion 27
        versionCode 1
        versionName "1.1"
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <!-- This is needed for aosp build env -->
    <uses-sdk android:minSdkVersion='25'
    <uses-sdk android:minSdkVersion='24'
        tools:ignore="GradleOverrides" />

    <application
+8 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.os.Build;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;

@@ -82,6 +83,13 @@ public class OverlayService extends Service {
        super.onCreate();

        NotificationManager notificationManager = getSystemService(NotificationManager.class);

        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O ||
                notificationManager == null || notificationManager
                .getNotificationChannel(SCREENCAST_OVERLAY_NOTIFICATION_CHANNEL) != null) {
            return;
        }

        CharSequence name = getString(R.string.screen_overlay_channel_title);
        String description = getString(R.string.screen_overlay_channel_desc);
        NotificationChannel notificationChannel =
+13 −5
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.IntentFilter;
import android.graphics.Point;
import android.hardware.display.DisplayManager;
import android.hardware.display.VirtualDisplay;
import android.os.Build;
import android.os.Environment;
import android.os.IBinder;
import android.os.StatFs;
@@ -113,7 +114,19 @@ public class ScreencastService extends Service {
    public void onCreate() {
        super.onCreate();

        IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_USER_BACKGROUND);
        filter.addAction(Intent.ACTION_SHUTDOWN);
        registerReceiver(mBroadcastReceiver, filter);

        mNotificationManager = getSystemService(NotificationManager.class);

        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O ||
                mNotificationManager == null || mNotificationManager.getNotificationChannel(
                        SCREENCAST_NOTIFICATION_CHANNEL) != null) {
            return;
        }

        CharSequence name = getString(R.string.screen_channel_title);
        String description = getString(R.string.screen_channel_desc);
        NotificationChannel notificationChannel =
@@ -121,11 +134,6 @@ public class ScreencastService extends Service {
                        name, NotificationManager.IMPORTANCE_LOW);
        notificationChannel.setDescription(description);
        mNotificationManager.createNotificationChannel(notificationChannel);

        IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_USER_BACKGROUND);
        filter.addAction(Intent.ACTION_SHUTDOWN);
        registerReceiver(mBroadcastReceiver, filter);
    }

    @Override
+10 −2
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.IntentFilter;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaRecorder;
import android.os.Build;
import android.os.Environment;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
@@ -111,7 +112,16 @@ public class SoundRecorderService extends Service {
    public void onCreate() {
        super.onCreate();

        registerReceiver(mShutdownReceiver, new IntentFilter(Intent.ACTION_SHUTDOWN));

        mNotificationManager = getSystemService(NotificationManager.class);

        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O ||
                mNotificationManager == null || mNotificationManager.getNotificationChannel(
                        SOUNDRECORDER_NOTIFICATION_CHANNEL) != null) {
            return;
        }

        CharSequence name = getString(R.string.sound_channel_title);
        String description = getString(R.string.sound_channel_desc);
        NotificationChannel notificationChannel =
@@ -119,8 +129,6 @@ public class SoundRecorderService extends Service {
                        name, NotificationManager.IMPORTANCE_LOW);
        notificationChannel.setDescription(description);
        mNotificationManager.createNotificationChannel(notificationChannel);

        registerReceiver(mShutdownReceiver, new IntentFilter(Intent.ACTION_SHUTDOWN));
    }

    @Override
Loading