diff options
Diffstat (limited to 'android/telephony/RadioAccessSpecifier.java')
-rw-r--r-- | android/telephony/RadioAccessSpecifier.java | 75 |
1 files changed, 53 insertions, 22 deletions
diff --git a/android/telephony/RadioAccessSpecifier.java b/android/telephony/RadioAccessSpecifier.java index 33ce8b42..5412c617 100644 --- a/android/telephony/RadioAccessSpecifier.java +++ b/android/telephony/RadioAccessSpecifier.java @@ -25,34 +25,40 @@ import java.util.Arrays; * Describes a particular radio access network to be scanned. * * The scan can be performed on either bands or channels for a specific radio access network type. - * @hide */ public final class RadioAccessSpecifier implements Parcelable { /** * The radio access network that needs to be scanned * + * This parameter must be provided or else the scan will be rejected. + * * See {@link RadioNetworkConstants.RadioAccessNetworks} for details. */ - public int radioAccessNetwork; + private int mRadioAccessNetwork; /** * The frequency bands that need to be scanned * - * bands must be used together with radioAccessNetwork + * When no specific bands are specified (empty array or null), all the frequency bands + * supported by the modem will be scanned. * * See {@link RadioNetworkConstants} for details. */ - public int[] bands; + private int[] mBands; /** * The frequency channels that need to be scanned * - * channels must be used together with radioAccessNetwork + * When any specific channels are provided for scan, the corresponding frequency bands that + * contains those channels must also be provided, or else the channels will be ignored. * - * See {@link RadioNetworkConstants.RadioAccessNetworks} for details. + * When no specific channels are specified (empty array or null), all the frequency channels + * supported by the modem will be scanned. + * + * See {@link RadioNetworkConstants} for details. */ - public int[] channels; + private int[] mChannels; /** * Creates a new RadioAccessSpecifier with radio network, bands and channels @@ -65,9 +71,34 @@ public final class RadioAccessSpecifier implements Parcelable { * @param channels the frequency bands to be scanned */ public RadioAccessSpecifier(int ran, int[] bands, int[] channels) { - this.radioAccessNetwork = ran; - this.bands = bands; - this.channels = channels; + this.mRadioAccessNetwork = ran; + this.mBands = bands.clone(); + this.mChannels = channels.clone(); + } + + /** + * Returns the radio access network that needs to be scanned. + * + * The returned value is define in {@link RadioNetworkConstants.RadioAccessNetworks}; + */ + public int getRadioAccessNetwork() { + return mRadioAccessNetwork; + } + + /** + * Returns the frequency bands that need to be scanned. + * + * The returned value is defined in either of {@link RadioNetworkConstants.GeranBands}, + * {@link RadioNetworkConstants.UtranBands} and {@link RadioNetworkConstants.EutranBands}, and + * it depends on the returned value of {@link #getRadioAccessNetwork()}. + */ + public int[] getBands() { + return mBands.clone(); + } + + /** Returns the frequency channels that need to be scanned. */ + public int[] getChannels() { + return mChannels.clone(); } public static final Parcelable.Creator<RadioAccessSpecifier> CREATOR = @@ -90,15 +121,15 @@ public final class RadioAccessSpecifier implements Parcelable { @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(radioAccessNetwork); - dest.writeIntArray(bands); - dest.writeIntArray(channels); + dest.writeInt(mRadioAccessNetwork); + dest.writeIntArray(mBands); + dest.writeIntArray(mChannels); } private RadioAccessSpecifier(Parcel in) { - radioAccessNetwork = in.readInt(); - bands = in.createIntArray(); - channels = in.createIntArray(); + mRadioAccessNetwork = in.readInt(); + mBands = in.createIntArray(); + mChannels = in.createIntArray(); } @Override @@ -115,15 +146,15 @@ public final class RadioAccessSpecifier implements Parcelable { return false; } - return (radioAccessNetwork == ras.radioAccessNetwork - && Arrays.equals(bands, ras.bands) - && Arrays.equals(channels, ras.channels)); + return (mRadioAccessNetwork == ras.mRadioAccessNetwork + && Arrays.equals(mBands, ras.mBands) + && Arrays.equals(mChannels, ras.mChannels)); } @Override public int hashCode () { - return ((radioAccessNetwork * 31) - + (Arrays.hashCode(bands) * 37) - + (Arrays.hashCode(channels)) * 39); + return ((mRadioAccessNetwork * 31) + + (Arrays.hashCode(mBands) * 37) + + (Arrays.hashCode(mChannels)) * 39); } } |