Merge ab/AP4A.240925.013 into aosp-main-future
Bug: 370570306
Merged-In: Ie97ef69f6f9e7209e65c600ac78639a1c40e0fd5
Change-Id: I2cc14a5ca39f0e219bea472fdb7c0ceda6ef4430
diff --git a/Android.bp b/Android.bp
index c3b4373..da32208 100644
--- a/Android.bp
+++ b/Android.bp
@@ -116,4 +116,7 @@
obfuscate: false,
proguard_flags_files: ["proguard.flags"],
},
+ lint: {
+ baseline_filename: "lint-baseline.xml",
+ },
}
diff --git a/flags/subscription.aconfig b/flags/subscription.aconfig
index 76485be..87c7408 100644
--- a/flags/subscription.aconfig
+++ b/flags/subscription.aconfig
@@ -58,6 +58,14 @@
}
}
+# OWNER=jmattis TARGET=25Q2
+flag {
+ name: "subscription_plan_allow_status_and_end_date"
+ namespace: "telephony"
+ description: "Provide APIs to retrieve the status and recurrence rule info on a subscription plan"
+ bug: "357272015"
+}
+
# OWNER=songferngwang TARGET=24Q3
flag {
name: "reset_primary_sim_default_values"
diff --git a/lint-baseline.xml b/lint-baseline.xml
new file mode 100644
index 0000000..491d013
--- /dev/null
+++ b/lint-baseline.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<issues format="6" by="lint 8.4.0-alpha08" type="baseline" client="" dependencies="true" name="" variant="all" version="8.4.0-alpha08">
+
+ <issue
+ id="SimpleManualPermissionEnforcement"
+ message="IEuiccCardController permission check should be converted to @EnforcePermission annotation"
+ errorLine1=" mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, "Requires DUMP");"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="frameworks/opt/telephony/src/java/com/android/internal/telephony/euicc/EuiccCardController.java"
+ line="1525"
+ column="9"/>
+ </issue>
+
+ <issue
+ id="SimpleManualPermissionEnforcement"
+ message="IEuiccController permission check can be converted to @EnforcePermission annotation"
+ errorLine1=" mContext.enforceCallingPermission(Manifest.permission.MASTER_CLEAR,"
+ errorLine2=" ^">
+ <location
+ file="frameworks/opt/telephony/src/java/com/android/internal/telephony/euicc/EuiccController.java"
+ line="1679"
+ column="9"/>
+ </issue>
+
+ <issue
+ id="SimpleManualPermissionEnforcement"
+ message="IEuiccController permission check should be converted to @EnforcePermission annotation"
+ errorLine1=" mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, "Requires DUMP");"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="frameworks/opt/telephony/src/java/com/android/internal/telephony/euicc/EuiccController.java"
+ line="1812"
+ column="9"/>
+ </issue>
+
+ <issue
+ id="SimpleManualPermissionEnforcement"
+ message="ISub permission check should be converted to @EnforcePermission annotation"
+ errorLine1=" mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP,"
+ errorLine2=" ^">
+ <location
+ file="frameworks/opt/telephony/src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java"
+ line="4800"
+ column="9"/>
+ </issue>
+
+</issues>
diff --git a/src/java/com/android/internal/telephony/FdnUtils.java b/src/java/com/android/internal/telephony/FdnUtils.java
index 23cab44..453b3fc 100644
--- a/src/java/com/android/internal/telephony/FdnUtils.java
+++ b/src/java/com/android/internal/telephony/FdnUtils.java
@@ -121,7 +121,8 @@
try {
PhoneNumber phoneNumber = phoneNumberUtil.parse(dialStr, defaultCountryIso);
dialStrE164 = phoneNumberUtil.format(phoneNumber, PhoneNumberFormat.E164);
- dialStrNational = String.valueOf(phoneNumber.getNationalNumber());
+ dialStrNational = String.valueOf(
+ phoneNumberUtil.getNationalSignificantNumber(phoneNumber));
} catch (NumberParseException ignored) {
Rlog.w(LOG_TAG, "isFDN: could not parse dialStr");
dialStr = extractSMSC(dialStr);
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
index 88ead6f..34ac832 100644
--- a/src/java/com/android/internal/telephony/RIL.java
+++ b/src/java/com/android/internal/telephony/RIL.java
@@ -178,6 +178,9 @@
/** @hide */
public static final HalVersion RADIO_HAL_VERSION_2_2 = new HalVersion(2, 2);
+ /** @hide */
+ public static final HalVersion RADIO_HAL_VERSION_2_3 = new HalVersion(2, 3);
+
// Hal version
private final Map<Integer, HalVersion> mHalVersion = new HashMap<>();
@@ -6212,6 +6215,7 @@
case 1: return RADIO_HAL_VERSION_2_0;
case 2: return RADIO_HAL_VERSION_2_1;
case 3: return RADIO_HAL_VERSION_2_2;
+ case 4: return RADIO_HAL_VERSION_2_3;
default: return RADIO_HAL_VERSION_UNKNOWN;
}
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/FdnUtilsTest.java b/tests/telephonytests/src/com/android/internal/telephony/FdnUtilsTest.java
index 9da19bc..996fa2d 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/FdnUtilsTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/FdnUtilsTest.java
@@ -181,4 +181,13 @@
assertTrue(FdnUtils.isFDN("1234560000@ims.mnc.org", "US", fdnList));
}
+
+ @Test
+ public void dialStrInNationalFormat_returnsTrue() {
+ ArrayList<AdnRecord> fdnList = initializeFdnList();
+ AdnRecord adnRecord = new AdnRecord(null, "0469887529");
+ fdnList.add(8, adnRecord);
+
+ assertTrue(FdnUtils.isFDN("0469887529", "US", fdnList));
+ }
}
\ No newline at end of file
diff --git a/tests/telephonytests/src/com/android/internal/telephony/subscription/SubscriptionPlanTest.java b/tests/telephonytests/src/com/android/internal/telephony/subscription/SubscriptionPlanTest.java
new file mode 100644
index 0000000..2c13d3b
--- /dev/null
+++ b/tests/telephonytests/src/com/android/internal/telephony/subscription/SubscriptionPlanTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2024 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.internal.telephony.subscription;
+
+import static android.telephony.SubscriptionPlan.SUBSCRIPTION_STATUS_ACTIVE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThrows;
+
+import android.platform.test.annotations.RequiresFlagsEnabled;
+import android.telephony.SubscriptionPlan;
+import android.testing.AndroidTestingRunner;
+
+import com.android.internal.telephony.flags.Flags;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.time.Period;
+import java.time.ZonedDateTime;
+
+@RunWith(AndroidTestingRunner.class)
+public class SubscriptionPlanTest {
+ private static final ZonedDateTime ZONED_DATE_TIME_START =
+ ZonedDateTime.parse("2007-03-14T00:00:00.000Z");
+
+ @Test
+ @RequiresFlagsEnabled(Flags.FLAG_SUBSCRIPTION_PLAN_ALLOW_STATUS_AND_END_DATE)
+ public void testBuilderExpirationDateSetsCorrectly() {
+ ZonedDateTime endDate = ZonedDateTime.parse("2024-11-07T00:00:00.000Z");
+
+ SubscriptionPlan planNonRecurring = SubscriptionPlan.Builder
+ .createNonrecurring(ZONED_DATE_TIME_START, endDate)
+ .setTitle("unit test")
+ .build();
+ SubscriptionPlan planRecurring = SubscriptionPlan.Builder
+ .createRecurring(ZONED_DATE_TIME_START, Period.ofMonths(1))
+ .setTitle("unit test")
+ .build();
+
+ assertThat(planNonRecurring.getPlanEndDate()).isEqualTo(endDate);
+ assertNull(planRecurring.getPlanEndDate());
+ }
+
+ @Test
+ @RequiresFlagsEnabled(Flags.FLAG_SUBSCRIPTION_PLAN_ALLOW_STATUS_AND_END_DATE)
+ public void testBuilderValidSubscriptionStatusSetsCorrectly() {
+ @SubscriptionPlan.SubscriptionStatus int status = SUBSCRIPTION_STATUS_ACTIVE;
+
+ SubscriptionPlan plan = SubscriptionPlan.Builder
+ .createRecurring(ZONED_DATE_TIME_START, Period.ofMonths(1))
+ .setSubscriptionStatus(status)
+ .setTitle("unit test")
+ .build();
+
+ assertThat(plan.getSubscriptionStatus()).isEqualTo(status);
+ }
+
+ @Test
+ @RequiresFlagsEnabled(Flags.FLAG_SUBSCRIPTION_PLAN_ALLOW_STATUS_AND_END_DATE)
+ public void testBuilderInvalidSubscriptionStatusThrowsError() {
+ int minInvalid = -1;
+ int maxInvalid = 5;
+
+ assertThrows(IllegalArgumentException.class, () -> {
+ SubscriptionPlan.Builder
+ .createRecurring(ZONED_DATE_TIME_START, Period.ofMonths(1))
+ .setSubscriptionStatus(minInvalid)
+ .setTitle("unit test")
+ .build();
+ });
+
+ assertThrows(IllegalArgumentException.class, () -> {
+ SubscriptionPlan.Builder
+ .createRecurring(ZONED_DATE_TIME_START, Period.ofMonths(1))
+ .setSubscriptionStatus(maxInvalid)
+ .setTitle("unit test")
+ .build();
+ });
+ }
+}