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

Commit 634f04b7 authored by Moez Bhatti's avatar Moez Bhatti
Browse files

Explicitly define mutability for PendingIntents

parent 2c332c06
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public class DownloadManager {
        download.putExtra(MmsReceivedReceiver.EXTRA_TRIGGER_PUSH, byPush);
        download.putExtra(MmsReceivedReceiver.EXTRA_URI, uri);
        final PendingIntent pendingIntent = PendingIntent.getBroadcast(
                context, 0, download, PendingIntent.FLAG_CANCEL_CURRENT);
                context, 0, download, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);

        final SmsManager smsManager = SmsManagerFactory.INSTANCE.createSmsManager(subscriptionId);
        Bundle configOverrides = new Bundle();
+1 −1
Original line number Diff line number Diff line
@@ -309,7 +309,7 @@ public class RetryScheduler implements Observer {
                    Intent service = new Intent(TransactionService.ACTION_ONALARM,
                                        null, context, TransactionService.class);
                    PendingIntent operation = PendingIntent.getService(
                            context, 0, service, PendingIntent.FLAG_ONE_SHOT);
                            context, 0, service, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
                    AlarmManager am = (AlarmManager) context.getSystemService(
                            Context.ALARM_SERVICE);
                    am.set(AlarmManager.RTC, retryAt, operation);
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ class Transaction @JvmOverloads constructor(private val context: Context, settin

            sentIntent.putExtra(EXTRA_CONTENT_URI, messageUri.toString())
            sentIntent.putExtra(EXTRA_FILE_PATH, sendFile.path)
            val sentPI = PendingIntent.getBroadcast(context, 0, sentIntent, PendingIntent.FLAG_CANCEL_CURRENT)
            val sentPI = PendingIntent.getBroadcast(context, 0, sentIntent, PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE)

            val updatedIntent = Intent(MMS_UPDATED).putExtra("uri", messageUri.toString())
            BroadcastUtils.addClassName(context, updatedIntent, MMS_UPDATED)
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ class AlarmManagerImpl @Inject constructor(private val context: Context) : Alarm

    override fun getScheduledMessageIntent(id: Long): PendingIntent {
        val intent = Intent(context, SendScheduledMessageReceiver::class.java).putExtra("id", id)
        return PendingIntent.getBroadcast(context, id.toInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT)
        return PendingIntent.getBroadcast(context, id.toInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
    }

    override fun setAlarm(date: Long, intent: PendingIntent) {
+3 −3
Original line number Diff line number Diff line
@@ -445,13 +445,13 @@ class MessageRepositoryImpl @Inject constructor(

        val sentIntents = parts.map {
            val intent = Intent(context, SmsSentReceiver::class.java).putExtra("id", message.id)
            PendingIntent.getBroadcast(context, message.id.toInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT)
            PendingIntent.getBroadcast(context, message.id.toInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
        }

        val deliveredIntents = parts.map {
            val intent = Intent(context, SmsDeliveredReceiver::class.java).putExtra("id", message.id)
            val pendingIntent = PendingIntent
                    .getBroadcast(context, message.id.toInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT)
                    .getBroadcast(context, message.id.toInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
            if (prefs.delivery.get()) pendingIntent else null
        }

@@ -495,7 +495,7 @@ class MessageRepositoryImpl @Inject constructor(

    private fun getIntentForDelayedSms(id: Long): PendingIntent {
        val intent = Intent(context, SendSmsReceiver::class.java).putExtra("id", id)
        return PendingIntent.getBroadcast(context, id.toInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT)
        return PendingIntent.getBroadcast(context, id.toInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
    }

    override fun insertSentSms(subId: Int, threadId: Long, address: String, body: String, date: Long): Message {
Loading