Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5df95853 authored by Michael W's avatar Michael W
Browse files

Dialer: PendingIntents need mutability flags

* Mostly immutable but LocationManager wants to modify the intent,
  so needs to be mutable

Change-Id: I59219f008bff0aab561fda50f6c7658ccdcb3fe8
parent c7119a1d
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ public class CallLogNotificationsService extends IntentService {
  public static PendingIntent createMarkAllNewVoicemailsAsOldIntent(@NonNull Context context) {
    Intent intent = new Intent(context, CallLogNotificationsService.class);
    intent.setAction(CallLogNotificationsService.ACTION_MARK_ALL_NEW_VOICEMAILS_AS_OLD);
    return PendingIntent.getService(context, 0, intent, 0);
    return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
  }

  public static PendingIntent createMarkSingleNewVoicemailAsOldIntent(
@@ -107,13 +107,13 @@ public class CallLogNotificationsService extends IntentService {
    Intent intent = new Intent(context, CallLogNotificationsService.class);
    intent.setAction(CallLogNotificationsService.ACTION_MARK_SINGLE_NEW_VOICEMAIL_AS_OLD);
    intent.setData(voicemailUri);
    return PendingIntent.getService(context, 0, intent, 0);
    return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
  }

  public static PendingIntent createCancelAllMissedCallsPendingIntent(@NonNull Context context) {
    Intent intent = new Intent(context, CallLogNotificationsService.class);
    intent.setAction(ACTION_CANCEL_ALL_MISSED_CALLS);
    return PendingIntent.getService(context, 0, intent, 0);
    return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
  }

  public static PendingIntent createCancelSingleMissedCallPendingIntent(
@@ -121,7 +121,7 @@ public class CallLogNotificationsService extends IntentService {
    Intent intent = new Intent(context, CallLogNotificationsService.class);
    intent.setAction(ACTION_CANCEL_SINGLE_MISSED_CALL);
    intent.setData(callUri);
    return PendingIntent.getService(context, 0, intent, 0);
    return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
  }

  public static PendingIntent createLegacyVoicemailDismissedPendingIntent(
@@ -129,7 +129,7 @@ public class CallLogNotificationsService extends IntentService {
    Intent intent = new Intent(context, CallLogNotificationsService.class);
    intent.setAction(ACTION_LEGACY_VOICEMAIL_DISMISSED);
    intent.putExtra(EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle);
    return PendingIntent.getService(context, 0, intent, 0);
    return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
  }

  @Override
+6 −3
Original line number Diff line number Diff line
@@ -434,7 +434,8 @@ public class MissedCallNotifier implements Worker<Pair<Integer, String>, Void> {

    // TODO (a bug): scroll to call
    contentIntent.setData(callUri);
    return PendingIntent.getActivity(context, 0, contentIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    return PendingIntent.getActivity(context, 0, contentIntent,
            PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
  }

  private PendingIntent createCallBackPendingIntent(String number, @NonNull Uri callUri) {
@@ -444,7 +445,8 @@ public class MissedCallNotifier implements Worker<Pair<Integer, String>, Void> {
    intent.setData(callUri);
    // Use FLAG_UPDATE_CURRENT to make sure any previous pending intent is updated with the new
    // extra.
    return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    return PendingIntent.getService(context, 0, intent,
            PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
  }

  private PendingIntent createSendSmsFromNotificationPendingIntent(
@@ -455,7 +457,8 @@ public class MissedCallNotifier implements Worker<Pair<Integer, String>, Void> {
    intent.setData(callUri);
    // Use FLAG_UPDATE_CURRENT to make sure any previous pending intent is updated with the new
    // extra.
    return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    return PendingIntent.getActivity(context, 0, intent,
            PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
  }

  /** Configures a notification to emit the blinky notification light. */
+2 −1
Original line number Diff line number Diff line
@@ -225,7 +225,8 @@ final class VisualVoicemailNotifier {
    if (voicemail != null) {
      intent.setData(voicemail.voicemailUri);
    }
    return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    return PendingIntent.getActivity(context, 0, intent,
            PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
  }

  /**
+2 −2
Original line number Diff line number Diff line
@@ -113,8 +113,8 @@ public class CountryDetector {
    LogUtil.i("CountryDetector.registerForLocationUpdates", "registering for location updates");

    final Intent activeIntent = new Intent(context, LocationChangedReceiver.class);
    final PendingIntent pendingIntent =
        PendingIntent.getBroadcast(context, 0, activeIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    final PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, activeIntent,
                PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);

    locationManager.requestLocationUpdates(
        LocationManager.PASSIVE_PROVIDER,
+2 −1
Original line number Diff line number Diff line
@@ -259,7 +259,8 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
                      isVideoCall
                          ? R.string.notification_take_video_call
                          : R.string.notification_take_call),
                  PendingIntent.getBroadcast(context, info.getNotificationId(), intent, 0))
                  PendingIntent.getBroadcast(context, info.getNotificationId(), intent,
                          PendingIntent.FLAG_IMMUTABLE))
              .build());
    }

Loading