@@ -78,6 +78,10 @@ public static boolean isActivated() {
7878 return activated ;
7979 }
8080
81+ private static int getPendingIntent (int flag ) {
82+ return Build .VERSION .SDK_INT >= Build .VERSION_CODES .M ? PendingIntent .FLAG_IMMUTABLE | flag : flag ;
83+ }
84+
8185 @ Override
8286 public void onCreate () {
8387 super .onCreate ();
@@ -144,7 +148,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
144148 Intent settingsIntent = new Intent (StatusBarBroadcastReceiver .STATUS_BAR_BTN_SETTINGS_CLICK_ACTION );
145149 settingsIntent .setClass (this , StatusBarBroadcastReceiver .class );
146150 PendingIntent pIntent = PendingIntent .getActivity (this , 0 ,
147- new Intent (this , MainActivity .class ), PendingIntent .FLAG_UPDATE_CURRENT );
151+ new Intent (this , MainActivity .class ), getPendingIntent ( PendingIntent .FLAG_UPDATE_CURRENT ) );
148152 builder .setWhen (0 )
149153 .setContentTitle (getResources ().getString (R .string .notice_activated ))
150154 .setDefaults (NotificationCompat .DEFAULT_LIGHTS )
@@ -156,10 +160,10 @@ public int onStartCommand(Intent intent, int flags, int startId) {
156160 .setContentIntent (pIntent )
157161 .addAction (R .drawable .ic_clear , getResources ().getString (R .string .button_text_deactivate ),
158162 PendingIntent .getBroadcast (this , 0 ,
159- deactivateIntent , PendingIntent .FLAG_UPDATE_CURRENT ))
163+ deactivateIntent , getPendingIntent ( PendingIntent .FLAG_UPDATE_CURRENT ) ))
160164 .addAction (R .drawable .ic_settings , getResources ().getString (R .string .action_settings ),
161165 PendingIntent .getBroadcast (this , 0 ,
162- settingsIntent , PendingIntent .FLAG_UPDATE_CURRENT ));
166+ settingsIntent , getPendingIntent ( PendingIntent .FLAG_UPDATE_CURRENT ) ));
163167
164168 Notification notification = builder .build ();
165169
@@ -289,7 +293,7 @@ public void run() {
289293 .setSession ("Daedalus" )
290294 .setConfigureIntent (PendingIntent .getActivity (this , 0 ,
291295 new Intent (this , MainActivity .class ).putExtra (MainActivity .LAUNCH_FRAGMENT , MainActivity .FRAGMENT_SETTINGS ),
292- PendingIntent .FLAG_ONE_SHOT ));
296+ getPendingIntent ( PendingIntent .FLAG_ONE_SHOT ) ));
293297
294298 if (Daedalus .getPrefs ().getBoolean ("settings_app_filter_switch" , false )) {
295299 ArrayList <String > apps = Daedalus .configurations .getAppObjects ();
0 commit comments