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
(cherry picked from commit 40cd94dde0)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user