Merge "Fix AM band range." into pi-dev
am: 9d86920cb4
Change-Id: I30a020f8c87d08bca06ec4b6bb0ff68377f3cd0b
This commit is contained in:
@@ -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.
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user