Added builder for SubscriptionInfo

Added the builder for SubscriptionInfo, and make all members
final. This can prevent other clients accidentally modifying
the same copy of SubscriptionInfo.

Also moved getAllAccessRules into getAccessRules.

Bug: 239607619
Bug: 247140269
Test: Manual + atest SubscriptionInfoTest
Change-Id: If2973d78579cc0d0d3c6720d22a4b49a04a2b813
This commit is contained in:
Jack Yu
2022-09-14 00:40:57 -07:00
parent 5728b473d9
commit 272090948b
2 changed files with 953 additions and 316 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -3106,7 +3106,7 @@ public class SubscriptionManager {
@SystemApi
public boolean canManageSubscription(@NonNull SubscriptionInfo info,
@NonNull String packageName) {
if (info == null || info.getAllAccessRules() == null || packageName == null) {
if (info == null || info.getAccessRules() == null || packageName == null) {
return false;
}
PackageManager packageManager = mContext.getPackageManager();
@@ -3118,7 +3118,7 @@ public class SubscriptionManager {
logd("Unknown package: " + packageName);
return false;
}
for (UiccAccessRule rule : info.getAllAccessRules()) {
for (UiccAccessRule rule : info.getAccessRules()) {
if (rule.getCarrierPrivilegeStatus(packageInfo)
== TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
return true;