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

Commit 40cd94dd authored by Nathan Harold's avatar Nathan Harold
Browse files

Remove BarringInfo#isServiceBarred()

Address API Council comments:
-Remove convenience method isServiceBarred()
-Pre-construct default barring objects rather than
 construct new ones in case the struct is sparsely
 populated.

Bug: 148553656
Test: atest BarringInfoTest
Change-Id: Ib0cbdfb431e1fc57afe16595406e0a4d70af8945
parent c2411e97
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -46381,7 +46381,6 @@ package android.telephony {
  public final class BarringInfo implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public android.telephony.BarringInfo.BarringServiceInfo getBarringServiceInfo(int);
    method public boolean isServiceBarred(int);
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field public static final int BARRING_SERVICE_TYPE_CS_FALLBACK = 5; // 0x5
    field public static final int BARRING_SERVICE_TYPE_CS_SERVICE = 0; // 0x0
+8 −14
Original line number Diff line number Diff line
@@ -238,6 +238,12 @@ public final class BarringInfo implements Parcelable {
        }
    }

    private static final BarringServiceInfo BARRING_SERVICE_INFO_UNKNOWN =
            new BarringServiceInfo(BarringServiceInfo.BARRING_TYPE_UNKNOWN);

    private static final BarringServiceInfo BARRING_SERVICE_INFO_UNBARRED =
            new BarringServiceInfo(BarringServiceInfo.BARRING_TYPE_NONE);

    private CellIdentity mCellIdentity;

    // A SparseArray potentially mapping each BarringService type to a BarringServiceInfo config
@@ -297,17 +303,6 @@ public final class BarringInfo implements Parcelable {
        return new BarringInfo(ci, serviceInfos);
    }

    /**
     * Return whether a service is currently barred based on the BarringInfo
     *
     * @param service the service to be checked.
     * @return true if the service is currently being barred, otherwise false
     */
    public boolean isServiceBarred(@BarringServiceType int service) {
        BarringServiceInfo bsi = mBarringServiceInfos.get(service);
        return bsi != null && (bsi.isBarred());
    }

    /**
     * Get the BarringServiceInfo for a specified service.
     *
@@ -319,9 +314,8 @@ public final class BarringInfo implements Parcelable {
        // type as UNKNOWN; if the modem reports barring info but doesn't report for a particular
        // service then we can safely assume that the service isn't barred (for instance because
        // that particular service isn't applicable to the current RAN).
        return (bsi != null) ? bsi : new BarringServiceInfo(
                mBarringServiceInfos.size() > 0 ? BarringServiceInfo.BARRING_TYPE_NONE :
                        BarringServiceInfo.BARRING_TYPE_UNKNOWN);
        return (bsi != null) ? bsi : mBarringServiceInfos.size() > 0
                ? BARRING_SERVICE_INFO_UNBARRED : BARRING_SERVICE_INFO_UNKNOWN;
    }

    /** @hide */