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

Commit db27b55b authored by Anton Potapov's avatar Anton Potapov Committed by Android (Google) Code Review
Browse files

Merge "Fix notification channel creation for screen recording" into main

parents 10b712cb fdae974e
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -22,8 +22,6 @@ import com.android.systemui.screenrecord.ScreenRecordingAudioSource
/** Notifies user about different stages of screen recording flow. */
interface NotificationInteractor {

    fun createChannel()

    fun notifyRecording(notificationId: Int, audioSource: ScreenRecordingAudioSource)

    fun notifyProcessing(notificationId: Int, audioSource: ScreenRecordingAudioSource)
+0 −15
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.systemui.screenrecord.notification

import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.app.Service
@@ -55,20 +54,6 @@ class ScreenRecordingServiceNotificationInteractor(
    private val serviceClass: Class<out Service>,
) : NotificationInteractor {

    override fun createChannel() {
        notificationManager.createNotificationChannel(
            NotificationChannel(
                    channelId,
                    context.getString(R.string.screenrecord_title),
                    NotificationManager.IMPORTANCE_DEFAULT,
                )
                .apply {
                    description = context.getString(R.string.screenrecord_channel_description)
                    enableVibration(true)
                }
        )
    }

    override fun notifyProcessing(notificationId: Int, audioSource: ScreenRecordingAudioSource) {
        val notificationTitle: String =
            if (audioSource == ScreenRecordingAudioSource.NONE) {
+2 −1
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

private const val TAG = "ScreenRecordingService"
private const val CHANNEL_ID = "screen_record"

open class ScreenRecordingService
protected constructor(
@@ -242,6 +241,8 @@ protected constructor(

    companion object {

        const val CHANNEL_ID = "screen_record"

        const val ACTION_STOP =
            "com.android.systemui.screenrecord.ScreenRecordingService.ACTION_STOP"
        const val ACTION_SHARE =
+14 −0
Original line number Diff line number Diff line
@@ -24,7 +24,9 @@ import android.provider.Settings;

import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.CoreStartable;
import com.android.systemui.Flags;
import com.android.systemui.res.R;
import com.android.systemui.screenrecord.service.ScreenRecordingService;
import com.android.wm.shell.pip.tv.TvPipNotificationController;

import java.util.Arrays;
@@ -115,6 +117,18 @@ public class NotificationChannels implements CoreStartable {
                    context.getString(com.android.wm.shell.R.string.notification_channel_tv_pip),
                    NotificationManager.IMPORTANCE_MAX));
        }

        if (Flags.thinScreenRecordingService()) {
            NotificationChannel notificationChannel = new NotificationChannel(
                    ScreenRecordingService.CHANNEL_ID,
                    context.getString(R.string.screenrecord_title),
                    NotificationManager.IMPORTANCE_DEFAULT
            );
            notificationChannel.setDescription(
                    context.getString(R.string.screenrecord_channel_description));
            notificationChannel.enableVibration(true);
            nm.createNotificationChannel(notificationChannel);
        }
    }

    /**