summaryrefslogtreecommitdiff
path: root/tests/src/com/android/phone/SubscriptionInfoHelperTest.java
diff options
context:
space:
mode:
authorMichael Bestas <mkbestas@lineageos.org>2022-01-15 04:28:01 +0200
committerMichael Bestas <mkbestas@lineageos.org>2022-01-15 04:28:01 +0200
commitc057258f3dc7c2fd21773692b5e54bd00d669ccd (patch)
tree4a28a36899ec610761e61fde9e8b9440bea4e64a /tests/src/com/android/phone/SubscriptionInfoHelperTest.java
parentf469ca2456dc6c6ac75b4150829927ea0b52dfa4 (diff)
parentdbf896f79319c215af27bacaed25d0ee506414f4 (diff)
Merge tag 'android-12.0.0_r27' into staging/lineage-19.0_merge-android-12.0.0_r27HEADs12.0
Android 12.0.0 release 27 # -----BEGIN PGP SIGNATURE----- # # iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCYeHDugAKCRDorT+BmrEO # eEk2AJ48vhUAokS8m8v/D7ZVhIo+gtvuwgCfQ1Su9Nlo9mAysjr/aiAelc9/FE0= # =JkRZ # -----END PGP SIGNATURE----- # gpg: Signature made Fri Jan 14 20:40:58 2022 EET # gpg: using DSA key 4340D13570EF945E83810964E8AD3F819AB10E78 # gpg: Good signature from "The Android Open Source Project <initial-contribution@android.com>" [marginal] # gpg: initial-contribution@android.com: Verified 1042 signatures in the past # 2 months. Encrypted 4 messages in the past 4 days. # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 4340 D135 70EF 945E 8381 0964 E8AD 3F81 9AB1 0E78 # By Brad Ebinger (1) and Tyler Gunn (1) # Via Android Build Coastguard Worker * tag 'android-12.0.0_r27': Ensure PIN/PUK status is taken into account on HAL 1.4+ Fix crash in SubscriptionInfoHelper for null display name. Change-Id: I4ffa38b0d37c60e5c66395e964c4818b17de6b8b
Diffstat (limited to 'tests/src/com/android/phone/SubscriptionInfoHelperTest.java')
-rw-r--r--tests/src/com/android/phone/SubscriptionInfoHelperTest.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/src/com/android/phone/SubscriptionInfoHelperTest.java b/tests/src/com/android/phone/SubscriptionInfoHelperTest.java
new file mode 100644
index 000000000..90f682ffd
--- /dev/null
+++ b/tests/src/com/android/phone/SubscriptionInfoHelperTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.phone;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import android.content.Intent;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
+
+import org.junit.Test;
+
+public class SubscriptionInfoHelperTest {
+ private static final String EXTRA_SUBSCRIPTION_LABEL =
+ "com.android.phone.settings.SubscriptionInfoHelper.SubscriptionLabel";
+
+ /**
+ * Ensures {@link SubscriptionInfoHelper#addExtrasToIntent(Intent, SubscriptionInfo)} can
+ * properly handle a null display name without crashing.
+ */
+ @Test
+ public void testAddExtrasToIntentWithNullDisplayName() {
+ Intent intent = new Intent();
+ SubscriptionInfo info = new SubscriptionInfo(1, // id
+ "90210", // iccId
+ 1, // simSlotIndex
+ null, // displayName
+ null, // carrierName
+ SubscriptionManager.NAME_SOURCE_CARRIER_ID, // nameSource
+ 0, //iconTint
+ "555-1212", // number
+ 0, // roaming
+ null, // icon
+ "401", // mcc
+ "384", // mnc
+ "us", // countryIso
+ false, // isEmbedded
+ null, // nativeAccessRules
+ ""); // cardString
+ SubscriptionInfoHelper.addExtrasToIntent(intent, info);
+ assertNull(intent.getStringExtra(EXTRA_SUBSCRIPTION_LABEL));
+ assertTrue(intent.hasExtra(EXTRA_SUBSCRIPTION_LABEL));
+ }
+}