Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2cb5ebf authored by Malcolm Chen's avatar Malcolm Chen
Browse files

Clean up shouldHideSubscription API

Combine shouldHideSubscription and isInvisibleSubscription
for better readability.

Bug: 126637721
Test: manual - use test app to call SubscriptionManager APIs to make
sure they return correct values.

Change-Id: If95f82dd23baff032996aac77f45aada7f5abc7d
parent 1ef7c273
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -2268,17 +2268,18 @@ public class SubscriptionController extends ISub.Stub {
        return allSubs;
    }

    private boolean isInvisibleSubscription(int subId) {
    private boolean isSubscriptionVisible(int subId) {
        for (SubscriptionInfo info : mCacheOpportunisticSubInfoList) {
            if (info.getSubscriptionId() == subId) {
                return SubscriptionManager.isInvisibleSubscription(info);
                // If group UUID is null, it's stand alone opportunistic profile. So it's visible.
                // otherwise, it's bundled opportunistic profile, and is not visible.
                return info.getGroupUuid() == null;
            }
        }

        return false;
        return true;
    }


    /**
     * @return the list of subId's that are active, is never null but the length maybe 0.
     */
@@ -2288,7 +2289,7 @@ public class SubscriptionController extends ISub.Stub {

        if (visibleOnly) {
            // Grouped opportunistic subscriptions should be hidden.
            allSubs = allSubs.stream().filter(subId -> !isInvisibleSubscription(subId))
            allSubs = allSubs.stream().filter(subId -> isSubscriptionVisible(subId))
                    .collect(Collectors.toList());
        }