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
Merged-In: If2973d78579cc0d0d3c6720d22a4b49a04a2b813
Change-Id: If2973d78579cc0d0d3c6720d22a4b49a04a2b813
This commit is contained in:
Jack Yu
2022-09-14 00:40:57 -07:00
parent 36f55c44f1
commit 6a0a3326fa
2 changed files with 953 additions and 316 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -3083,7 +3083,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();
@@ -3095,7 +3095,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;