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

Commit ec0f0a48 authored by Erfan Abdi's avatar Erfan Abdi Committed by nift4
Browse files

FMRadio: Use FLAG_IMMUTABLE for notifications

* in preparation for targetSdk 31

Change-Id: I9d2d9c60655e3e165d3639436c5a18d8ce33710e
parent cc294227
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1824,7 +1824,7 @@ public class FmService extends Service implements FmRecorder.OnRecorderStateChan
        aIntent.addCategory(Intent.CATEGORY_LAUNCHER);
        aIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        aIntent.setClassName(getPackageName(), mTargetClassName);
        PendingIntent pAIntent = PendingIntent.getActivity(mContext, 0, aIntent, 0);
        PendingIntent pAIntent = PendingIntent.getActivity(mContext, 0, aIntent, PendingIntent.FLAG_IMMUTABLE);

        NotificationManager notificationManager = getSystemService(NotificationManager.class);
        if (notificationManager.getNotificationChannel(CHANNEL_ID) == null) {
@@ -1843,17 +1843,17 @@ public class FmService extends Service implements FmRecorder.OnRecorderStateChan

            Intent intent = new Intent(FM_SEEK_PREVIOUS);
            intent.setClass(mContext, FmService.class);
            PendingIntent pIntent = PendingIntent.getService(mContext, 0, intent, 0);
            PendingIntent pIntent = PendingIntent.getService(mContext, 0, intent, PendingIntent.FLAG_IMMUTABLE);
            mNotificationBuilder.addAction(R.drawable.btn_fm_prevstation,
                    getString(R.string.notif_previous), pIntent);
            intent = new Intent(FM_TURN_OFF);
            intent.setClass(mContext, FmService.class);
            pIntent = PendingIntent.getService(mContext, 0, intent, 0);
            pIntent = PendingIntent.getService(mContext, 0, intent, PendingIntent.FLAG_IMMUTABLE);
            mNotificationBuilder.addAction(R.drawable.btn_fm_rec_stop_enabled,
                    getString(R.string.notif_stop), pIntent);
            intent = new Intent(FM_SEEK_NEXT);
            intent.setClass(mContext, FmService.class);
            pIntent = PendingIntent.getService(mContext, 0, intent, 0);
            pIntent = PendingIntent.getService(mContext, 0, intent, PendingIntent.FLAG_IMMUTABLE);
            mNotificationBuilder.addAction(R.drawable.btn_fm_nextstation,
                    getString(R.string.notif_next) , pIntent);
        }