From 5c3b76b838d0014a8052a4bd62b801ddd3242674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Tue, 13 Jun 2023 00:14:04 +0100 Subject: [PATCH] Add missing mutability flags to PendingIntents --- .../gadgetbridge/externalevents/CMWeatherReceiver.java | 3 ++- .../gadgetbridge/externalevents/LineageOsWeatherReceiver.java | 3 ++- .../gadgetbridge/service/devices/um25/Support/UM25Support.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/CMWeatherReceiver.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/CMWeatherReceiver.java index de2fa9f3c..785456529 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/CMWeatherReceiver.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/CMWeatherReceiver.java @@ -38,6 +38,7 @@ import nodomain.freeyourgadget.gadgetbridge.BuildConfig; import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.model.Weather; import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; +import nodomain.freeyourgadget.gadgetbridge.util.PendingIntentUtils; import nodomain.freeyourgadget.gadgetbridge.util.Prefs; import static cyanogenmod.providers.WeatherContract.WeatherColumns.TempUnit.FAHRENHEIT; @@ -103,7 +104,7 @@ public class CMWeatherReceiver extends BroadcastReceiver implements CMWeatherMan if (enable) { Intent intent = new Intent("GB_UPDATE_WEATHER"); intent.setPackage(BuildConfig.APPLICATION_ID); - mPendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0); + mPendingIntent = PendingIntentUtils.getBroadcast(mContext, 0, intent, 0, false); am.setInexactRepeating(AlarmManager.RTC_WAKEUP, Calendar.getInstance().getTimeInMillis() + 10000, AlarmManager.INTERVAL_HOUR, mPendingIntent); } else { am.cancel(mPendingIntent); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/LineageOsWeatherReceiver.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/LineageOsWeatherReceiver.java index 991ca6da8..6d5f0fefc 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/LineageOsWeatherReceiver.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/LineageOsWeatherReceiver.java @@ -49,6 +49,7 @@ import nodomain.freeyourgadget.gadgetbridge.BuildConfig; import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.model.Weather; import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; +import nodomain.freeyourgadget.gadgetbridge.util.PendingIntentUtils; import nodomain.freeyourgadget.gadgetbridge.util.Prefs; @RequiresApi(api = Build.VERSION_CODES.M) @@ -107,7 +108,7 @@ public class LineageOsWeatherReceiver extends BroadcastReceiver implements Linea if (enable) { Intent intent = new Intent("GB_UPDATE_WEATHER"); intent.setPackage(BuildConfig.APPLICATION_ID); - mPendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0); + mPendingIntent = PendingIntentUtils.getBroadcast(mContext, 0, intent, 0, false); am.setInexactRepeating(AlarmManager.RTC_WAKEUP, Calendar.getInstance().getTimeInMillis() + 10000, AlarmManager.INTERVAL_HOUR, mPendingIntent); } else { am.cancel(mPendingIntent); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25Support.java index 25c6d413c..176b023d8 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25Support.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25Support.java @@ -34,6 +34,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.SetDeviceStateA import nodomain.freeyourgadget.gadgetbridge.service.devices.um25.Data.CaptureGroup; import nodomain.freeyourgadget.gadgetbridge.service.devices.um25.Data.MeasurementData; import nodomain.freeyourgadget.gadgetbridge.util.GB; +import nodomain.freeyourgadget.gadgetbridge.util.PendingIntentUtils; import nodomain.freeyourgadget.gadgetbridge.util.StringUtils; public class UM25Support extends UM25BaseSupport { @@ -194,7 +195,7 @@ public class UM25Support extends UM25BaseSupport { .setSmallIcon(R.drawable.ic_notification_low_battery) .setContentTitle("USB current") .setContentText("USB current below threshold") - .setContentIntent(PendingIntent.getActivity(getContext(), 0, activityIntent, PendingIntent.FLAG_CANCEL_CURRENT)) + .setContentIntent(PendingIntentUtils.getActivity(getContext(), 0, activityIntent, PendingIntent.FLAG_CANCEL_CURRENT, false)) .build(); GB.notify(