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

Commit 652ac963 authored by Cole Faust's avatar Cole Faust
Browse files

Add FLAG_IMMUTABLE to PendingIntents

If your app targets Android 12, you must specify the mutability of each
PendingIntent object that your app creates. This additional requirement
improves your app's security.
https://developer.android.com/about/versions/12/behavior-changes-12#pending-intent-mutability

Android Lint is being updated, and adds an error-level check for this.

Bug: 247885568
Test: Presubmits
Change-Id: Ib82e2b0bbea3c1dd1810c56c4ea70f7809aa122a
parent f55958fc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ public class FixVibrateSetting extends Activity implements View.OnClickListener

    private void test() {
        Intent intent = new Intent(this, FixVibrateSetting.class);
        PendingIntent pending = PendingIntent.getActivity(this, 0, intent, 0);
        PendingIntent pending = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);

        Notification n = new Notification.Builder(this)
                .setSmallIcon(R.drawable.stat_sys_warning)