FM: Mutability changes in PendingIntent object

Added FLAG_IMMUTABLE flag in PendingIntent object creation.

Change-Id: I7598066c8ccc7b0cd1713fe3be6c68bb784039d6
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index c88fa1a..7029ca2 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -1065,7 +1065,7 @@
        Intent mediaButtonIntent =
                new Intent(Intent.ACTION_MEDIA_BUTTON).setComponent(fmRadio);
        PendingIntent pi = PendingIntent.getBroadcast(getApplicationContext(), 0,
-                          mediaButtonIntent, 0);
+                          mediaButtonIntent, PendingIntent.FLAG_IMMUTABLE);
        mSession.setMediaButtonReceiver(pi);
 
        mStoppedOnFocusLoss = false;
@@ -1721,7 +1721,7 @@
             .setCustomContentView(views)
             .setSmallIcon(R.drawable.stat_notify_fm)
             .setContentIntent(PendingIntent.getActivity(this,
-                0, new Intent("com.caf.fmradio.FMRADIO_ACTIVITY"), 0))
+                0, new Intent("com.caf.fmradio.FMRADIO_ACTIVITY"), PendingIntent.FLAG_IMMUTABLE))
             .setOngoing(true)
             .build();
 
@@ -3777,7 +3777,7 @@
    private void setAlarmSleepExpired (long duration) {
        Intent i = new Intent(SLEEP_EXPIRED_ACTION);
        AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
+       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, PendingIntent.FLAG_IMMUTABLE);
        Log.d(LOGTAG, "delayedStop called" + SystemClock.elapsedRealtime() + duration);
        am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + duration, pi);
        mSleepActive = true;
@@ -3785,33 +3785,33 @@
    private void cancelAlarmSleepExpired() {
        Intent i = new Intent(SLEEP_EXPIRED_ACTION);
        AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
+       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, PendingIntent.FLAG_IMMUTABLE);
        am.cancel(pi);
        mSleepActive = false;
    }
    private void setAlarmRecordTimeout(long duration) {
        Intent i = new Intent(RECORD_EXPIRED_ACTION);
        AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
+       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, PendingIntent.FLAG_IMMUTABLE);
        Log.d(LOGTAG, "delayedStop called" + SystemClock.elapsedRealtime() + duration);
        am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + duration, pi);
    }
    private void cancelAlarmRecordTimeout() {
        Intent i = new Intent(RECORD_EXPIRED_ACTION);
        AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
+       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, PendingIntent.FLAG_IMMUTABLE);
        am.cancel(pi);
    }
    private void setAlarmDelayedServiceStop() {
        Intent i = new Intent(SERVICE_DELAYED_STOP_ACTION);
        AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
+       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, PendingIntent.FLAG_IMMUTABLE);
        am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + IDLE_DELAY, pi);
    }
    private void cancelAlarmDealyedServiceStop() {
        Intent i = new Intent(SERVICE_DELAYED_STOP_ACTION);
        AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
+       PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, PendingIntent.FLAG_IMMUTABLE);
        am.cancel(pi);
    }
    private void cancelAlarms() {
diff --git a/fmapp2/src/com/caf/fmradio/FMStats.java b/fmapp2/src/com/caf/fmradio/FMStats.java
index 4d3b9d0..9fe4cb2 100644
--- a/fmapp2/src/com/caf/fmradio/FMStats.java
+++ b/fmapp2/src/com/caf/fmradio/FMStats.java
@@ -3768,14 +3768,14 @@
     private void setAlarm(long duration, String action) {
         Intent i = new Intent(action);
         AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-        PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
+        PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, PendingIntent.FLAG_IMMUTABLE);
         am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + duration, pi);
     }
 
     private void cancelAlarm(String action) {
         Intent i = new Intent(action);
         AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
-        PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);
+        PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, PendingIntent.FLAG_IMMUTABLE);
         am.cancel(pi);
     }