]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
android: Explicitly mark receiver as not exported during registration
authorTobias Brunner <tobias@strongswan.org>
Mon, 5 Aug 2024 08:35:05 +0000 (10:35 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 6 Aug 2024 16:01:54 +0000 (18:01 +0200)
src/frontends/android/app/src/main/java/org/strongswan/android/logic/Scheduler.java

index 7ad181bc1ccbd6e70ad76f8c8bfcdadd241c5079..7288b287ac3aa49331995ce633d96f774c6b4d8a 100644 (file)
@@ -16,6 +16,7 @@
 
 package org.strongswan.android.logic;
 
+import android.annotation.SuppressLint;
 import android.app.AlarmManager;
 import android.app.PendingIntent;
 import android.content.BroadcastReceiver;
@@ -37,6 +38,7 @@ public class Scheduler extends BroadcastReceiver
        private final AlarmManager mManager;
        private final PriorityQueue<ScheduledJob> mJobs;
 
+       @SuppressLint("UnspecifiedRegisterReceiverFlag")
        public Scheduler(Context context)
        {
                mContext = context;
@@ -45,7 +47,14 @@ public class Scheduler extends BroadcastReceiver
 
                IntentFilter filter = new IntentFilter();
                filter.addAction(EXECUTE_JOB);
-               mContext.registerReceiver(this, filter);
+               if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
+               {
+                       mContext.registerReceiver(this, filter, Context.RECEIVER_NOT_EXPORTED);
+               }
+               else
+               {
+                       mContext.registerReceiver(this, filter);
+               }
        }
 
        /**