Loading core/java/android/hardware/radio/ProgramSelector.java +5 −3 Original line number Diff line number Diff line Loading @@ -411,7 +411,8 @@ public final class ProgramSelector implements Parcelable { /** * Checks, if a given AM/FM frequency is roughly valid and in correct unit. * * It does not check the range precisely. In particular, it may be way off for certain regions. * It does not check the range precisely: it may provide false positives, but not false * negatives. In particular, it may be way off for certain regions. * The main purpose is to avoid passing inproper units, ie. MHz instead of kHz. * * @param isAm true, if AM, false if FM. Loading @@ -420,7 +421,7 @@ public final class ProgramSelector implements Parcelable { */ private static boolean isValidAmFmFrequency(boolean isAm, int frequencyKhz) { if (isAm) { return frequencyKhz > 150 && frequencyKhz < 30000; return frequencyKhz > 150 && frequencyKhz <= 30000; } else { return frequencyKhz > 60000 && frequencyKhz < 110000; } Loading Loading @@ -462,7 +463,8 @@ public final class ProgramSelector implements Parcelable { throw new IllegalArgumentException("Subchannels are not supported for non-HD radio"); } if (!isValidAmFmFrequency(isAm, frequencyKhz)) { throw new IllegalArgumentException("Provided value is not a valid AM/FM frequency"); throw new IllegalArgumentException("Provided value is not a valid AM/FM frequency: " + frequencyKhz); } // We can't use AM_HD or FM_HD, because we don't know HD station ID. Loading Loading
core/java/android/hardware/radio/ProgramSelector.java +5 −3 Original line number Diff line number Diff line Loading @@ -411,7 +411,8 @@ public final class ProgramSelector implements Parcelable { /** * Checks, if a given AM/FM frequency is roughly valid and in correct unit. * * It does not check the range precisely. In particular, it may be way off for certain regions. * It does not check the range precisely: it may provide false positives, but not false * negatives. In particular, it may be way off for certain regions. * The main purpose is to avoid passing inproper units, ie. MHz instead of kHz. * * @param isAm true, if AM, false if FM. Loading @@ -420,7 +421,7 @@ public final class ProgramSelector implements Parcelable { */ private static boolean isValidAmFmFrequency(boolean isAm, int frequencyKhz) { if (isAm) { return frequencyKhz > 150 && frequencyKhz < 30000; return frequencyKhz > 150 && frequencyKhz <= 30000; } else { return frequencyKhz > 60000 && frequencyKhz < 110000; } Loading Loading @@ -462,7 +463,8 @@ public final class ProgramSelector implements Parcelable { throw new IllegalArgumentException("Subchannels are not supported for non-HD radio"); } if (!isValidAmFmFrequency(isAm, frequencyKhz)) { throw new IllegalArgumentException("Provided value is not a valid AM/FM frequency"); throw new IllegalArgumentException("Provided value is not a valid AM/FM frequency: " + frequencyKhz); } // We can't use AM_HD or FM_HD, because we don't know HD station ID. Loading