Revert "Public EuiccManager APIs."

This reverts commit 4d59805cd9a6ad9e0f5a5dc87c1fd2a619150b36.

Reason for revert: <INSERT REASONING HERE>

Change-Id: I18af805c5678c14af9926010b5cd7f3e100cad97
(cherry picked from commit e79f45616235fedf152658ce5998cd0586d240e8)
diff --git a/src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java b/src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java
index ec3f382..94138f7 100644
--- a/src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java
+++ b/src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java
@@ -710,25 +710,20 @@
         }
 
         final EuiccProfileInfo[] embeddedProfiles;
-        if (result.getResult() == EuiccService.RESULT_OK) {
-            List<EuiccProfileInfo> list = result.getProfiles();
-            if (list == null || list.size() == 0) {
-                embeddedProfiles = null;
-            } else {
-                embeddedProfiles = list.toArray(new EuiccProfileInfo[list.size()]);
-            }
+        if (result.result == EuiccService.RESULT_OK) {
+            embeddedProfiles = result.profiles;
         } else {
-            logd("updatedEmbeddedSubscriptions: error " + result.getResult() + " listing profiles");
+            logd("updatedEmbeddedSubscriptions: error " + result.result + " listing profiles");
             // If there's an error listing profiles, treat it equivalently to a successful
             // listing which returned no profiles under the assumption that none are currently
             // accessible.
             embeddedProfiles = new EuiccProfileInfo[0];
         }
-        final boolean isRemovable = result.getIsRemovable();
+        final boolean isRemovable = result.isRemovable;
 
         final String[] embeddedIccids = new String[embeddedProfiles.length];
         for (int i = 0; i < embeddedProfiles.length; i++) {
-            embeddedIccids[i] = embeddedProfiles[i].getIccid();
+            embeddedIccids[i] = embeddedProfiles[i].iccid;
         }
 
         // Note that this only tracks whether we make any writes to the DB. It's possible this will
@@ -746,30 +741,25 @@
         ContentResolver contentResolver = mContext.getContentResolver();
         for (EuiccProfileInfo embeddedProfile : embeddedProfiles) {
             int index =
-                    findSubscriptionInfoForIccid(existingSubscriptions, embeddedProfile.getIccid());
+                    findSubscriptionInfoForIccid(existingSubscriptions, embeddedProfile.iccid);
             if (index < 0) {
                 // No existing entry for this ICCID; create an empty one.
                 SubscriptionController.getInstance().insertEmptySubInfoRecord(
-                        embeddedProfile.getIccid(), SubscriptionManager.SIM_NOT_INSERTED);
+                        embeddedProfile.iccid, SubscriptionManager.SIM_NOT_INSERTED);
             } else {
                 existingSubscriptions.remove(index);
             }
             ContentValues values = new ContentValues();
             values.put(SubscriptionManager.IS_EMBEDDED, 1);
-            List<UiccAccessRule> ruleList = embeddedProfile.getUiccAccessRules();
-            boolean isRuleListEmpty = false;
-            if (ruleList == null || ruleList.size() == 0) {
-                isRuleListEmpty = true;
-            }
             values.put(SubscriptionManager.ACCESS_RULES,
-                    isRuleListEmpty ? null : UiccAccessRule.encodeRules(
-                            ruleList.toArray(new UiccAccessRule[ruleList.size()])));
+                    embeddedProfile.accessRules == null ? null :
+                            UiccAccessRule.encodeRules(embeddedProfile.accessRules));
             values.put(SubscriptionManager.IS_REMOVABLE, isRemovable);
-            values.put(SubscriptionManager.DISPLAY_NAME, embeddedProfile.getNickname());
+            values.put(SubscriptionManager.DISPLAY_NAME, embeddedProfile.nickname);
             values.put(SubscriptionManager.NAME_SOURCE, SubscriptionManager.NAME_SOURCE_USER_INPUT);
             hasChanges = true;
             contentResolver.update(SubscriptionManager.CONTENT_URI, values,
-                    SubscriptionManager.ICC_ID + "=\"" + embeddedProfile.getIccid() + "\"", null);
+                    SubscriptionManager.ICC_ID + "=\"" + embeddedProfile.iccid + "\"", null);
 
             // refresh Cached Active Subscription Info List
             SubscriptionController.getInstance().refreshCachedActiveSubscriptionInfoList();
diff --git a/src/java/com/android/internal/telephony/euicc/EuiccController.java b/src/java/com/android/internal/telephony/euicc/EuiccController.java
index 27018b5..95ac641 100644
--- a/src/java/com/android/internal/telephony/euicc/EuiccController.java
+++ b/src/java/com/android/internal/telephony/euicc/EuiccController.java
@@ -259,12 +259,12 @@
                 GetDownloadableSubscriptionMetadataResult result) {
             Intent extrasIntent = new Intent();
             final int resultCode;
-            switch (result.getResult()) {
+            switch (result.result) {
                 case EuiccService.RESULT_OK:
                     resultCode = OK;
                     extrasIntent.putExtra(
                             EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION,
-                            result.getDownloadableSubscription());
+                            result.subscription);
                     break;
                 case EuiccService.RESULT_MUST_DEACTIVATE_SIM:
                     resultCode = RESOLVABLE_ERROR;
@@ -278,7 +278,7 @@
                     resultCode = ERROR;
                     extrasIntent.putExtra(
                             EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE,
-                            result.getResult());
+                            result.result);
                     break;
             }
 
@@ -346,7 +346,7 @@
         @Override
         public void onGetMetadataComplete(
                 GetDownloadableSubscriptionMetadataResult result) {
-            if (result.getResult() == EuiccService.RESULT_MUST_DEACTIVATE_SIM) {
+            if (result.result == EuiccService.RESULT_MUST_DEACTIVATE_SIM) {
                 // If we need to deactivate the current SIM to even check permissions, go ahead and
                 // require that the user resolve the stronger permission dialog.
                 Intent extrasIntent = new Intent();
@@ -360,18 +360,14 @@
                 return;
             }
 
-            if (result.getResult() != EuiccService.RESULT_OK) {
+            if (result.result != EuiccService.RESULT_OK) {
                 // Just propagate the error as normal.
                 super.onGetMetadataComplete(result);
                 return;
             }
 
-            DownloadableSubscription subscription = result.getDownloadableSubscription();
-            UiccAccessRule[] rules = null;
-            List<UiccAccessRule> rulesList = subscription.getAccessRules();
-            if (rulesList != null) {
-                rules = rulesList.toArray(new UiccAccessRule[rulesList.size()]);
-            }
+            DownloadableSubscription subscription = result.subscription;
+            UiccAccessRule[] rules = subscription.getAccessRules();
             if (rules == null) {
                 Log.e(TAG, "No access rules but caller is unprivileged");
                 sendResult(mCallbackIntent, ERROR, null /* extrasIntent */);
@@ -566,15 +562,12 @@
         public void onGetDefaultListComplete(GetDefaultDownloadableSubscriptionListResult result) {
             Intent extrasIntent = new Intent();
             final int resultCode;
-            switch (result.getResult()) {
+            switch (result.result) {
                 case EuiccService.RESULT_OK:
                     resultCode = OK;
-                    List<DownloadableSubscription> list = result.getDownloadableSubscriptions();
-                    if (list != null && list.size() > 0) {
-                        extrasIntent.putExtra(
-                                EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS,
-                                list.toArray(new DownloadableSubscription[list.size()]));
-                    }
+                    extrasIntent.putExtra(
+                            EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS,
+                            result.subscriptions);
                     break;
                 case EuiccService.RESULT_MUST_DEACTIVATE_SIM:
                     resultCode = RESOLVABLE_ERROR;
@@ -589,7 +582,7 @@
                     resultCode = ERROR;
                     extrasIntent.putExtra(
                             EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE,
-                            result.getResult());
+                            result.result);
                     break;
             }
 
@@ -718,7 +711,7 @@
                     return;
                 }
                 if (!callerCanWriteEmbeddedSubscriptions
-                        && !mSubscriptionManager.canManageSubscription(sub, callingPackage)) {
+                        && !sub.canManageSubscription(mContext, callingPackage)) {
                     Log.e(TAG, "Not permitted to switch to subscription: " + subscriptionId);
                     sendResult(callbackIntent, ERROR, null /* extrasIntent */);
                     return;
@@ -1070,9 +1063,7 @@
         int size = subInfoList.size();
         for (int subIndex = 0; subIndex < size; subIndex++) {
             SubscriptionInfo subInfo = subInfoList.get(subIndex);
-
-            if (subInfo.isEmbedded()
-                    && mSubscriptionManager.canManageSubscription(subInfo, callingPackage)) {
+            if (subInfo.isEmbedded() && subInfo.canManageSubscription(mContext, callingPackage)) {
                 return true;
             }
         }
diff --git a/src/java/com/android/internal/telephony/euicc/EuiccOperation.java b/src/java/com/android/internal/telephony/euicc/EuiccOperation.java
index b0a18a3..148d9dc 100644
--- a/src/java/com/android/internal/telephony/euicc/EuiccOperation.java
+++ b/src/java/com/android/internal/telephony/euicc/EuiccOperation.java
@@ -207,37 +207,37 @@
         switch (mAction) {
             case ACTION_GET_METADATA_DEACTIVATE_SIM:
                 resolvedGetMetadataDeactivateSim(
-                        resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT),
+                        resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT),
                         callbackIntent);
                 break;
             case ACTION_DOWNLOAD_DEACTIVATE_SIM:
                 resolvedDownloadDeactivateSim(
-                        resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT),
+                        resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT),
                         callbackIntent);
                 break;
             case ACTION_DOWNLOAD_NO_PRIVILEGES:
                 resolvedDownloadNoPrivileges(
-                        resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT),
+                        resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT),
                         callbackIntent);
                 break;
             case ACTION_DOWNLOAD_CONFIRMATION_CODE:
                 resolvedDownloadConfirmationCode(
-                        resolutionExtras.getString(EuiccService.EXTRA_RESOLUTION_CONFIRMATION_CODE),
+                        resolutionExtras.getString(EuiccService.RESOLUTION_EXTRA_CONFIRMATION_CODE),
                         callbackIntent);
                 break;
             case ACTION_GET_DEFAULT_LIST_DEACTIVATE_SIM:
                 resolvedGetDefaultListDeactivateSim(
-                        resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT),
+                        resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT),
                         callbackIntent);
                 break;
             case ACTION_SWITCH_DEACTIVATE_SIM:
                 resolvedSwitchDeactivateSim(
-                        resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT),
+                        resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT),
                         callbackIntent);
                 break;
             case ACTION_SWITCH_NO_PRIVILEGES:
                 resolvedSwitchNoPrivileges(
-                        resolutionExtras.getBoolean(EuiccService.EXTRA_RESOLUTION_CONSENT),
+                        resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT),
                         callbackIntent);
                 break;
             default:
diff --git a/src/java/com/android/internal/telephony/uicc/euicc/EuiccCard.java b/src/java/com/android/internal/telephony/uicc/euicc/EuiccCard.java
index bbbbcdb..d33d4b9 100644
--- a/src/java/com/android/internal/telephony/uicc/euicc/EuiccCard.java
+++ b/src/java/com/android/internal/telephony/uicc/euicc/EuiccCard.java
@@ -51,7 +51,6 @@
 import com.android.internal.telephony.uicc.euicc.async.AsyncResultCallback;
 import com.android.internal.telephony.uicc.euicc.async.AsyncResultHelper;
 
-import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -190,10 +189,7 @@
                             loge("Profile must have an ICCID.");
                             continue;
                         }
-                        String strippedIccIdString =
-                                stripTrailingFs(profileNode.getChild(Tags.TAG_ICCID).asBytes());
-                        EuiccProfileInfo.Builder profileBuilder =
-                                new EuiccProfileInfo.Builder(strippedIccIdString);
+                        EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder();
                         buildProfile(profileNode, profileBuilder);
 
                         EuiccProfileInfo profile = profileBuilder.build();
@@ -226,10 +222,7 @@
                         return null;
                     }
                     Asn1Node profileNode = profileNodes.get(0);
-                    String strippedIccIdString =
-                            stripTrailingFs(profileNode.getChild(Tags.TAG_ICCID).asBytes());
-                    EuiccProfileInfo.Builder profileBuilder =
-                            new EuiccProfileInfo.Builder(strippedIccIdString);
+                    EuiccProfileInfo.Builder profileBuilder = new EuiccProfileInfo.Builder();
                     buildProfile(profileNode, profileBuilder);
                     return profileBuilder.build();
                 },
@@ -519,7 +512,7 @@
                         for (int j = 0; j < opIdSize; j++) {
                             opIds[j] = buildCarrierIdentifier(opIdNodes.get(j));
                         }
-                        builder.add(node.getChild(Tags.TAG_CTX_0).asBits(), Arrays.asList(opIds),
+                        builder.add(node.getChild(Tags.TAG_CTX_0).asBits(), opIds,
                                 node.getChild(Tags.TAG_CTX_2).asBits());
                     }
                     return builder.build();
@@ -984,6 +977,10 @@
 
     private static void buildProfile(Asn1Node profileNode, EuiccProfileInfo.Builder profileBuilder)
             throws TagNotFoundException, InvalidAsn1DataException {
+        String strippedIccIdString =
+                stripTrailingFs(profileNode.getChild(Tags.TAG_ICCID).asBytes());
+        profileBuilder.setIccid(strippedIccIdString);
+
         if (profileNode.hasChild(Tags.TAG_NICKNAME)) {
             profileBuilder.setNickname(profileNode.getChild(Tags.TAG_NICKNAME).asString());
         }
@@ -1027,12 +1024,7 @@
         if (profileNode.hasChild(Tags.TAG_CARRIER_PRIVILEGE_RULES)) {
             List<Asn1Node> refArDoNodes = profileNode.getChild(Tags.TAG_CARRIER_PRIVILEGE_RULES)
                     .getChildren(Tags.TAG_REF_AR_DO);
-            UiccAccessRule[] rules = buildUiccAccessRule(refArDoNodes);
-            List<UiccAccessRule> rulesList = null;
-            if (rules != null) {
-                rulesList = Arrays.asList(rules);
-            }
-            profileBuilder.setUiccAccessRule(rulesList);
+            profileBuilder.setUiccAccessRule(buildUiccAccessRule(refArDoNodes));
         }
     }
 
diff --git a/tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java
index 88a7d9d..c490f5d 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java
@@ -73,7 +73,6 @@
 
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
-import java.util.Arrays;
 import java.util.Collections;
 
 @RunWith(AndroidJUnit4.class)
@@ -101,8 +100,7 @@
             DownloadableSubscription.forActivationCode("abcde");
     static {
         SUBSCRIPTION_WITH_METADATA.setCarrierName("test name");
-        SUBSCRIPTION_WITH_METADATA.setAccessRules(
-                Arrays.asList(new UiccAccessRule[] { ACCESS_RULE }));
+        SUBSCRIPTION_WITH_METADATA.setAccessRules(new UiccAccessRule[] { ACCESS_RULE });
     }
 
     private static final String OS_VERSION = "1.0";
@@ -266,7 +264,7 @@
 
     @Test
     public void testGetEuiccInfo_success() {
-        assertEquals(OS_VERSION, callGetEuiccInfo(true /* success */, EUICC_INFO).getOsVersion());
+        assertEquals(OS_VERSION, callGetEuiccInfo(true /* success */, EUICC_INFO).osVersion);
     }
 
     @Test
@@ -839,8 +837,6 @@
         SubscriptionInfo subInfo = new SubscriptionInfo(
                 0, "", 0, "", "", 0, 0, "", 0, null, 0, 0, "", true /* isEmbedded */,
                 hasPrivileges ? new UiccAccessRule[] { ACCESS_RULE } : null);
-        when(mSubscriptionManager.canManageSubscription(subInfo, PACKAGE_NAME)).thenReturn(
-                hasPrivileges);
         when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(
                 Collections.singletonList(subInfo));
     }
@@ -849,8 +845,6 @@
         SubscriptionInfo subInfo = new SubscriptionInfo(
                 SUBSCRIPTION_ID, ICC_ID, 0, "", "", 0, 0, "", 0, null, 0, 0, "",
                 true /* isEmbedded */, hasPrivileges ? new UiccAccessRule[] { ACCESS_RULE } : null);
-        when(mSubscriptionManager.canManageSubscription(subInfo, PACKAGE_NAME)).thenReturn(
-                hasPrivileges);
         when(mSubscriptionManager.getAvailableSubscriptionInfoList()).thenReturn(
                 Collections.singletonList(subInfo));
     }
diff --git a/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/EuiccCardTest.java b/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/EuiccCardTest.java
index 7b57597..a995499 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/EuiccCardTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/EuiccCardTest.java
@@ -259,7 +259,7 @@
                                         "ABCD92CBB156B280FA4E1429A6ECEEB6E5C1BFE4"),
                                 "com.google.android.apps.myapp", 1)
                 },
-                profile.getUiccAccessRules().toArray());
+                profile.getUiccAccessRules());
         verifyStoreData(channel, "BF2D195A0A896700000000004523015C0B5A909192B79F709599BF76");
     }
 
diff --git a/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/data/EuiccRulesAuthTableTest.java b/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/data/EuiccRulesAuthTableTest.java
index 65849cf..6312832 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/data/EuiccRulesAuthTableTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/data/EuiccRulesAuthTableTest.java
@@ -27,8 +27,6 @@
 
 import org.junit.Test;
 
-import java.util.Arrays;
-
 public class EuiccRulesAuthTableTest {
     @Test
     public void testFindIndex() {
@@ -40,11 +38,11 @@
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
                                 // Matches none
-                                Arrays.asList(new CarrierIdentifier[] {}),
+                                new CarrierIdentifier[] {},
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         // Matches none
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, (byte) 0xF3, 0x54},
@@ -53,23 +51,23 @@
                                         // Matches opA
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         // Matches none
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "5"),
                                         // Matches opA and opB
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, null)
-                                ),
+                                },
                                 0)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         // Matches none
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x69, 0x54}, "5", null),
@@ -79,7 +77,7 @@
                                         // Matches opA
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .build();
 
@@ -103,13 +101,13 @@
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         // Matches none
                                         new CarrierIdentifier(
                                                 new byte[] {(byte) 0xEE, (byte) 0xEE, (byte) 0xEE},
                                                 null,
                                                 null)
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .build();
         assertEquals(0, rat.findIndex(EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE, opA));
@@ -124,7 +122,7 @@
         CarrierIdentifier opB = new CarrierIdentifier(
                 new byte[] {0x78, (byte) 0xF4, 0x25}, "4", null);
         EuiccRulesAuthTable rat = new EuiccRulesAuthTable.Builder(1)
-                .add(0, Arrays.asList(new CarrierIdentifier[] {}), 0).build();
+                .add(0, new CarrierIdentifier[] {}, 0).build();
         assertEquals(-1, rat.findIndex(EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE, opA));
         assertEquals(-1, rat.findIndex(EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE, opB));
         assertEquals(-1, rat.findIndex(EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE, opA));
@@ -149,14 +147,13 @@
 
     @Test(expected = ArrayIndexOutOfBoundsException.class)
     public void testBuild_TooManyRules() {
-        new EuiccRulesAuthTable.Builder(0)
-                .add(0, Arrays.asList(new CarrierIdentifier[] {}), 0).build();
+        new EuiccRulesAuthTable.Builder(0).add(0, new CarrierIdentifier[] {}, 0).build();
     }
 
     @Test(expected = ArrayIndexOutOfBoundsException.class)
     public void testHasPolicyRuleFlag_OutOfBounds() {
         EuiccRulesAuthTable rat = new EuiccRulesAuthTable.Builder(1)
-                .add(0, Arrays.asList(new CarrierIdentifier[] {}), 0).build();
+                .add(0, new CarrierIdentifier[] {}, 0).build();
         rat.hasPolicyRuleFlag(1, EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED);
     }
 
@@ -184,39 +181,39 @@
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(new CarrierIdentifier[] {}),
+                                new CarrierIdentifier[] {},
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, (byte) 0xF3, 0x54},
                                                 "4",
                                                 null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "5"),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, null)
-                                ),
+                                },
                                 0)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x69, 0x54}, "5", null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, "4", null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .build();
 
@@ -264,39 +261,39 @@
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(new CarrierIdentifier[] {}),
+                                new CarrierIdentifier[] {},
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, (byte) 0xF3, 0x54},
                                                 "4",
                                                 null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "5"),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, null)
-                                ),
+                                },
                                 0)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x69, 0x54}, "5", null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, "4", null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .build();
 
@@ -310,39 +307,39 @@
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(new CarrierIdentifier[] {}),
+                                new CarrierIdentifier[] {},
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, (byte) 0xF3, 0x54},
                                                 "4",
                                                 null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "5"),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, null)
-                                ),
+                                },
                                 0)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x69, 0x54}, "5", null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, "4", null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .build();
         assertTrue(rat.equals(that));
@@ -357,27 +354,27 @@
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(new CarrierIdentifier[] {}),
+                                new CarrierIdentifier[] {},
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, (byte) 0xF3, 0x54},
                                                 "4",
                                                 null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "5"),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, null)
-                                ),
+                                },
                                 0)
                         .build();
         assertFalse(rat.equals(that));
@@ -387,38 +384,38 @@
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(new CarrierIdentifier[] {}),
+                                new CarrierIdentifier[] {},
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         // Only one item
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, (byte) 0xF3, 0x54},
                                                 "4",
                                                 null)
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "5"),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, null)
-                                ),
+                                },
                                 0)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x69, 0x54}, "5", null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, "4", null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .build();
         assertFalse(rat.equals(that));
@@ -428,11 +425,11 @@
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(new CarrierIdentifier[] {}),
+                                new CarrierIdentifier[] {},
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         // Different value from rat
                                         new CarrierIdentifier(
                                                 new byte[] {0x22, (byte) 0xF3, 0x54},
@@ -440,28 +437,28 @@
                                                 null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "5"),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, null)
-                                ),
+                                },
                                 0)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x69, 0x54}, "5", null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, "4", null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .build();
         assertFalse(rat.equals(that));
@@ -476,77 +473,77 @@
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, (byte) 0xF3, 0x54},
                                                 "4",
                                                 null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "5"),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, null)
-                                ),
+                                },
                                 0)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x69, 0x54}, "5", null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, "4", null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .build();
-        assertTrue(rat.equals(that));
+        assertFalse(rat.equals(that));
 
         that =
                 new EuiccRulesAuthTable.Builder(4)
                         .add(
                                 // Different policy rules
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE,
-                                Arrays.asList(new CarrierIdentifier[] {}),
+                                new CarrierIdentifier[] {},
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, (byte) 0xF3, 0x54},
                                                 "4",
                                                 null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x63, 0x54}, null, "5"),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, null)
-                                ),
+                                },
                                 0)
                         .add(
                                 EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE
                                         | EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE,
-                                Arrays.asList(
+                                new CarrierIdentifier[] {
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x69, 0x54}, "5", null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, "4", null),
                                         new CarrierIdentifier(
                                                 new byte[] {0x21, 0x6E, 0x54}, null, "4")
-                                ),
+                                },
                                 EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED)
                         .build();
         assertFalse(rat.equals(that));