From a24192a7494a94d8952011b28aa2e9e9ddbc77b1 Mon Sep 17 00:00:00 2001
From: Jiashen Wang <jiashenwang@google.com>
Date: Mon, 26 Oct 2020 16:39:57 -0700
Subject: [PATCH] Add the immutable flag to EuiccManager calls in
 RecoverySystem

Bug: 170432460
Test: refactoring CL. Existing unit tests still pass
Change-Id: Ibce939eec341cb9f572d13a33762cc5bc6e2ef42
---
 core/java/android/os/RecoverySystem.java | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java
index 8cdcd49cb2cc..13b30f43ff7a 100644
--- a/core/java/android/os/RecoverySystem.java
+++ b/core/java/android/os/RecoverySystem.java
@@ -908,7 +908,11 @@ public class RecoverySystem {
             Intent intent = new Intent(ACTION_EUICC_FACTORY_RESET);
             intent.setPackage(packageName);
             PendingIntent callbackIntent = PendingIntent.getBroadcastAsUser(
-                    context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT, UserHandle.SYSTEM);
+                    context,
+                    0,
+                    intent,
+                    PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT,
+                    UserHandle.SYSTEM);
             IntentFilter filterConsent = new IntentFilter();
             filterConsent.addAction(ACTION_EUICC_FACTORY_RESET);
             HandlerThread euiccHandlerThread = new HandlerThread("euiccWipeFinishReceiverThread");
@@ -1002,7 +1006,11 @@ public class RecoverySystem {
         Intent intent = new Intent(ACTION_EUICC_REMOVE_INVISIBLE_SUBSCRIPTIONS);
         intent.setPackage(PACKAGE_NAME_EUICC_DATA_MANAGEMENT_CALLBACK);
         PendingIntent callbackIntent = PendingIntent.getBroadcastAsUser(
-                context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT, UserHandle.SYSTEM);
+                context,
+                0,
+                intent,
+                PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT,
+                UserHandle.SYSTEM);
         IntentFilter intentFilter = new IntentFilter();
         intentFilter.addAction(ACTION_EUICC_REMOVE_INVISIBLE_SUBSCRIPTIONS);
         HandlerThread euiccHandlerThread =
-- 
GitLab