diff --git a/api/current.txt b/api/current.txt index 2d7cde73ed3d4..f3204caef817f 100644 --- a/api/current.txt +++ b/api/current.txt @@ -44683,7 +44683,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 diff --git a/telephony/java/android/telephony/BarringInfo.java b/telephony/java/android/telephony/BarringInfo.java index e4a14a34eb27f..db3da17b6c050 100644 --- a/telephony/java/android/telephony/BarringInfo.java +++ b/telephony/java/android/telephony/BarringInfo.java @@ -239,6 +239,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 @@ -300,17 +306,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. * @@ -322,9 +317,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 */