immutable flag for PendingIntent
This commit is contained in:
parent
ec73c4b0cb
commit
74dfe80433
7 changed files with 14 additions and 14 deletions
|
@ -311,15 +311,15 @@ open class LoopPlugin @Inject constructor(
|
|||
if (sp.getBoolean(R.string.key_enable_carbs_required_alert_local, true) && sp.getBoolean(R.string.key_raise_notifications_as_android_notifications, true)) {
|
||||
val intentAction5m = Intent(context, CarbSuggestionReceiver::class.java)
|
||||
intentAction5m.putExtra("ignoreDuration", 5)
|
||||
val pendingIntent5m = PendingIntent.getBroadcast(context, 1, intentAction5m, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val pendingIntent5m = PendingIntent.getBroadcast(context, 1, intentAction5m, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val actionIgnore5m = NotificationCompat.Action(R.drawable.ic_notif_aaps, resourceHelper.gs(R.string.ignore5m, "Ignore 5m"), pendingIntent5m)
|
||||
val intentAction15m = Intent(context, CarbSuggestionReceiver::class.java)
|
||||
intentAction15m.putExtra("ignoreDuration", 15)
|
||||
val pendingIntent15m = PendingIntent.getBroadcast(context, 1, intentAction15m, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val pendingIntent15m = PendingIntent.getBroadcast(context, 1, intentAction15m, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val actionIgnore15m = NotificationCompat.Action(R.drawable.ic_notif_aaps, resourceHelper.gs(R.string.ignore15m, "Ignore 15m"), pendingIntent15m)
|
||||
val intentAction30m = Intent(context, CarbSuggestionReceiver::class.java)
|
||||
intentAction30m.putExtra("ignoreDuration", 30)
|
||||
val pendingIntent30m = PendingIntent.getBroadcast(context, 1, intentAction30m, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val pendingIntent30m = PendingIntent.getBroadcast(context, 1, intentAction30m, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val actionIgnore30m = NotificationCompat.Action(R.drawable.ic_notif_aaps, resourceHelper.gs(R.string.ignore30m, "Ignore 30m"), pendingIntent30m)
|
||||
val builder = NotificationCompat.Builder(context, CHANNEL_ID)
|
||||
builder.setSmallIcon(R.drawable.notif_icon)
|
||||
|
@ -441,7 +441,7 @@ open class LoopPlugin @Inject constructor(
|
|||
stackBuilder.addParentStack(MainActivity::class.java)
|
||||
// Adds the Intent that starts the Activity to the top of the stack
|
||||
stackBuilder.addNextIntent(resultIntent)
|
||||
val resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
builder.setContentIntent(resultPendingIntent)
|
||||
builder.setVibrate(longArrayOf(1000, 1000, 1000, 1000, 1000))
|
||||
val mNotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
|
|
|
@ -128,7 +128,7 @@ class NotificationStore @Inject constructor(
|
|||
private fun deleteIntent(id: Int): PendingIntent {
|
||||
val intent = Intent(context, DismissNotificationService::class.java)
|
||||
intent.putExtra("alertID", id)
|
||||
return PendingIntent.getService(context, id, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
return PendingIntent.getService(context, id, intent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
}
|
||||
|
||||
fun createNotificationChannel() {
|
||||
|
|
|
@ -171,7 +171,7 @@ class PersistentNotificationPlugin @Inject constructor(
|
|||
val msgReadPendingIntent = PendingIntent.getBroadcast(context,
|
||||
notificationHolder.notificationID,
|
||||
msgReadIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val msgReplyIntent = Intent()
|
||||
.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
|
||||
.setAction(REPLY_ACTION)
|
||||
|
@ -181,7 +181,7 @@ class PersistentNotificationPlugin @Inject constructor(
|
|||
context,
|
||||
notificationHolder.notificationID,
|
||||
msgReplyIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
// Build a RemoteInput for receiving voice input from devices
|
||||
val remoteInput = RemoteInput.Builder(EXTRA_VOICE_REPLY).build()
|
||||
// Create the UnreadConversation
|
||||
|
|
|
@ -40,6 +40,6 @@ class NotificationHolderImpl @Inject constructor(
|
|||
override fun openAppIntent(context: Context): PendingIntent? = TaskStackBuilder.create(context).run {
|
||||
addParentStack(MainActivity::class.java)
|
||||
addNextIntent(Intent(context, MainActivity::class.java))
|
||||
getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
getPendingIntent(0, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -302,17 +302,17 @@ public class InsightAlertService extends DaggerService implements InsightConnect
|
|||
notificationBuilder.setContentText(HtmlHelper.INSTANCE.fromHtml(description).toString());
|
||||
|
||||
Intent fullScreenIntent = new Intent(this, InsightAlertActivity.class);
|
||||
PendingIntent fullScreenPendingIntent = PendingIntent.getActivity(this, 0, fullScreenIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
PendingIntent fullScreenPendingIntent = PendingIntent.getActivity(this, 0, fullScreenIntent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
notificationBuilder.setFullScreenIntent(fullScreenPendingIntent, true);
|
||||
|
||||
switch (alert.getAlertStatus()) {
|
||||
case ACTIVE:
|
||||
Intent muteIntent = new Intent(this, InsightAlertService.class).putExtra("command", "mute");
|
||||
PendingIntent mutePendingIntent = PendingIntent.getService(this, 1, muteIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
PendingIntent mutePendingIntent = PendingIntent.getService(this, 1, muteIntent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
notificationBuilder.addAction(0, resourceHelper.gs(R.string.mute_alert), mutePendingIntent);
|
||||
case SNOOZED:
|
||||
Intent confirmIntent = new Intent(this, InsightAlertService.class).putExtra("command", "confirm");
|
||||
PendingIntent confirmPendingIntent = PendingIntent.getService(this, 2, confirmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
PendingIntent confirmPendingIntent = PendingIntent.getService(this, 2, confirmIntent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
notificationBuilder.addAction(0, resourceHelper.gs(R.string.confirm), confirmPendingIntent);
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ public class ComplicationTapBroadcastReceiver extends BroadcastReceiver {
|
|||
// Pass complicationId as the requestCode to ensure that different complications get
|
||||
// different intents.
|
||||
return PendingIntent.getBroadcast(
|
||||
context, complicationId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
context, complicationId, intent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -161,7 +161,7 @@ public class ComplicationTapBroadcastReceiver extends BroadcastReceiver {
|
|||
// Pass complicationId as the requestCode to ensure that different complications get
|
||||
// different intents.
|
||||
return PendingIntent.getBroadcast(
|
||||
context, complicationId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
context, complicationId, intent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -589,7 +589,7 @@ public class ListenerService extends WearableListenerService implements GoogleAp
|
|||
intent.putExtras(params);
|
||||
|
||||
PendingIntent resultPendingIntent =
|
||||
PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
builder = builder.setContentIntent(resultPendingIntent);
|
||||
|
||||
|
|
Loading…
Reference in a new issue