diff --git a/broadcastradio/aidl/Android.bp b/broadcastradio/aidl/Android.bp new file mode 100644 index 0000000000..41d637c8d7 --- /dev/null +++ b/broadcastradio/aidl/Android.bp @@ -0,0 +1,31 @@ +// +// Copyright (C) 2022 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +aidl_interface { + name: "android.hardware.broadcastradio", + vendor_available: true, + srcs: ["android/hardware/broadcastradio/*.aidl"], + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + min_sdk_version: "Tiramisu", + }, + }, +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmBandRange.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmBandRange.aidl new file mode 100644 index 0000000000..ca511aa13a --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmBandRange.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AmFmBandRange { + int lowerBound; + int upperBound; + int spacing; + int seekSpacing; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl new file mode 100644 index 0000000000..f3aecdfe75 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AmFmRegionConfig { + android.hardware.broadcastradio.AmFmBandRange[] ranges; + int fmDeemphasis; + int fmRds; + const int DEEMPHASIS_D50 = 1; + const int DEEMPHASIS_D75 = 2; + const int RDS = 1; + const int RBDS = 2; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Announcement.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Announcement.aidl new file mode 100644 index 0000000000..bbdd86f7dc --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Announcement.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable Announcement { + android.hardware.broadcastradio.ProgramSelector selector; + android.hardware.broadcastradio.AnnouncementType type = android.hardware.broadcastradio.AnnouncementType.INVALID; + android.hardware.broadcastradio.VendorKeyValue[] vendorInfo; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AnnouncementType.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AnnouncementType.aidl new file mode 100644 index 0000000000..237b86880c --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AnnouncementType.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@Backing(type="byte") @JavaDerive(equals=true, toString=true) @VintfStability +enum AnnouncementType { + INVALID = 0, + EMERGENCY = 1, + WARNING = 2, + TRAFFIC = 3, + WEATHER = 4, + NEWS = 5, + EVENT = 6, + SPORT = 7, + MISC = 8, +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl new file mode 100644 index 0000000000..6fb9a62213 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@Backing(type="int") @JavaDerive(equals=true, toString=true) @VintfStability +enum ConfigFlag { + FORCE_MONO = 1, + FORCE_ANALOG = 2, + FORCE_DIGITAL = 3, + RDS_AF = 4, + RDS_REG = 5, + DAB_DAB_LINKING = 6, + DAB_FM_LINKING = 7, + DAB_DAB_SOFT_LINKING = 8, + DAB_FM_SOFT_LINKING = 9, +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/DabTableEntry.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/DabTableEntry.aidl new file mode 100644 index 0000000000..162f4abd62 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/DabTableEntry.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable DabTableEntry { + String label; + int frequencyKhz; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IAnnouncementListener.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IAnnouncementListener.aidl new file mode 100644 index 0000000000..346af5807d --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IAnnouncementListener.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@VintfStability +interface IAnnouncementListener { + oneway void onListUpdated(in android.hardware.broadcastradio.Announcement[] announcements); +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IBroadcastRadio.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IBroadcastRadio.aidl new file mode 100644 index 0000000000..39eb04c105 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IBroadcastRadio.aidl @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@VintfStability +interface IBroadcastRadio { + android.hardware.broadcastradio.Properties getProperties(); + android.hardware.broadcastradio.AmFmRegionConfig getAmFmRegionConfig(in boolean full); + android.hardware.broadcastradio.DabTableEntry[] getDabRegionConfig(); + void setTunerCallback(in android.hardware.broadcastradio.ITunerCallback callback); + void unsetTunerCallback(); + void tune(in android.hardware.broadcastradio.ProgramSelector program); + void seek(in boolean directionUp, in boolean skipSubChannel); + void step(in boolean directionUp); + void cancel(); + void startProgramListUpdates(in android.hardware.broadcastradio.ProgramFilter filter); + void stopProgramListUpdates(); + boolean isConfigFlagSet(in android.hardware.broadcastradio.ConfigFlag flag); + void setConfigFlag(in android.hardware.broadcastradio.ConfigFlag flag, in boolean value); + android.hardware.broadcastradio.VendorKeyValue[] setParameters(in android.hardware.broadcastradio.VendorKeyValue[] parameters); + android.hardware.broadcastradio.VendorKeyValue[] getParameters(in String[] keys); + byte[] getImage(in int id); + android.hardware.broadcastradio.ICloseHandle registerAnnouncementListener(in android.hardware.broadcastradio.IAnnouncementListener listener, in android.hardware.broadcastradio.AnnouncementType[] enabled); + const int INVALID_IMAGE = 0; + const int ANTENNA_STATE_CHANGE_TIMEOUT_MS = 100; + const int LIST_COMPLETE_TIMEOUT_MS = 300000; + const int TUNER_TIMEOUT_MS = 30000; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ICloseHandle.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ICloseHandle.aidl new file mode 100644 index 0000000000..75e7f2a4c0 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ICloseHandle.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@VintfStability +interface ICloseHandle { + void close(); +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ITunerCallback.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ITunerCallback.aidl new file mode 100644 index 0000000000..f5badade46 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ITunerCallback.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@VintfStability +interface ITunerCallback { + oneway void onTuneFailed(in android.hardware.broadcastradio.Result result, in android.hardware.broadcastradio.ProgramSelector selector); + oneway void onCurrentProgramInfoChanged(in android.hardware.broadcastradio.ProgramInfo info); + oneway void onProgramListUpdated(in android.hardware.broadcastradio.ProgramListChunk chunk); + oneway void onAntennaStateChange(in boolean connected); + oneway void onConfigFlagUpdated(in android.hardware.broadcastradio.ConfigFlag flag, in boolean value); + oneway void onParametersUpdated(in android.hardware.broadcastradio.VendorKeyValue[] parameters); +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl new file mode 100644 index 0000000000..4e8296a88b --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@Backing(type="int") @JavaDerive(equals=true, toString=true) @VintfStability +enum IdentifierType { + VENDOR_START = 1000, + VENDOR_END = 1999, + INVALID = 0, + AMFM_FREQUENCY_KHZ = 1, + RDS_PI = 2, + HD_STATION_ID_EXT = 3, + HD_STATION_NAME = 4, + DAB_SID_EXT = 5, + DAB_ENSEMBLE = 6, + DAB_SCID = 7, + DAB_FREQUENCY_KHZ = 8, + DRMO_SERVICE_ID = 9, + DRMO_FREQUENCY_KHZ = 10, + SXM_SERVICE_ID = 12, + SXM_CHANNEL = 13, +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Metadata.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Metadata.aidl new file mode 100644 index 0000000000..e02b6b1bd0 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Metadata.aidl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +union Metadata { + String rdsPs; + int rdsPty; + int rbdsPty; + String rdsRt; + String songTitle; + String songArtist; + String songAlbum; + int stationIcon; + int albumArt; + String programName; + String dabEnsembleName; + String dabEnsembleNameShort; + String dabServiceName; + String dabServiceNameShort; + String dabComponentName; + String dabComponentNameShort; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramFilter.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramFilter.aidl new file mode 100644 index 0000000000..9edeb8d5c6 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramFilter.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ProgramFilter { + android.hardware.broadcastradio.IdentifierType[] identifierTypes; + android.hardware.broadcastradio.ProgramIdentifier[] identifiers; + boolean includeCategories; + boolean excludeModifications; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramIdentifier.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramIdentifier.aidl new file mode 100644 index 0000000000..66763508ad --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramIdentifier.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ProgramIdentifier { + android.hardware.broadcastradio.IdentifierType type = android.hardware.broadcastradio.IdentifierType.INVALID; + long value; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl new file mode 100644 index 0000000000..5e662d2450 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ProgramInfo { + android.hardware.broadcastradio.ProgramSelector selector; + android.hardware.broadcastradio.ProgramIdentifier logicallyTunedTo; + android.hardware.broadcastradio.ProgramIdentifier physicallyTunedTo; + @nullable android.hardware.broadcastradio.ProgramIdentifier[] relatedContent; + int infoFlags; + int signalQuality; + android.hardware.broadcastradio.Metadata[] metadata; + android.hardware.broadcastradio.VendorKeyValue[] vendorInfo; + const int FLAG_LIVE = 1; + const int FLAG_MUTED = 2; + const int FLAG_TRAFFIC_PROGRAM = 4; + const int FLAG_TRAFFIC_ANNOUNCEMENT = 8; + const int FLAG_TUNABLE = 16; + const int FLAG_STEREO = 32; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramListChunk.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramListChunk.aidl new file mode 100644 index 0000000000..5d53b99302 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramListChunk.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ProgramListChunk { + boolean purge; + boolean complete; + android.hardware.broadcastradio.ProgramInfo[] modified; + @nullable android.hardware.broadcastradio.ProgramIdentifier[] removed; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramSelector.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramSelector.aidl new file mode 100644 index 0000000000..9af1dc8880 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramSelector.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ProgramSelector { + android.hardware.broadcastradio.ProgramIdentifier primaryId; + android.hardware.broadcastradio.ProgramIdentifier[] secondaryIds; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Properties.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Properties.aidl new file mode 100644 index 0000000000..643b819d8a --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Properties.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable Properties { + String maker; + String product; + String version; + String serial; + android.hardware.broadcastradio.IdentifierType[] supportedIdentifierTypes; + android.hardware.broadcastradio.VendorKeyValue[] vendorInfo; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl new file mode 100644 index 0000000000..07edae80ae --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@Backing(type="int") @VintfStability +enum Result { + OK = 0, + INTERNAL_ERROR = 1, + INVALID_ARGUMENTS = 2, + INVALID_STATE = 3, + NOT_SUPPORTED = 4, + TIMEOUT = 5, + UNKNOWN_ERROR = 6, +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/VendorKeyValue.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/VendorKeyValue.aidl new file mode 100644 index 0000000000..3c6b19438f --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/VendorKeyValue.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VendorKeyValue { + String key; + String value; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/AmFmBandRange.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/AmFmBandRange.aidl new file mode 100644 index 0000000000..562631f0c7 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/AmFmBandRange.aidl @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +/** + * Defines the AM/FM band range for configuring different regions. + * + *

Channel grid is defined as: each possible channel is set at + * lowerBound + channelNumber * spacing, up to upperBound. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable AmFmBandRange { + /** + * The frequency (in kHz) of the first channel within the range. + * + * Lower bound must be a tunable frequency. + */ + int lowerBound; + + /** + * The frequency (in kHz) of the last channel within the range. + */ + int upperBound; + + /** + * Channel grid resolution (in kHz), telling how far the channels are apart. + */ + int spacing; + + /** + * Channel spacing (in kHz) used to speed up seeking to the next station + * via the {@link IBroadcastRadio#seek} operation. + * + * It must be a multiple of channel grid resolution. + * + * Tuner may first quickly check every n-th channel and if it detects echo + * from a station, it fine-tunes to find the exact frequency. + * + * It's ignored for capabilities check (with full=true when calling + * getAmFmRegionConfig). + */ + int seekSpacing; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl new file mode 100644 index 0000000000..a3086c60cc --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.AmFmBandRange; + +/** + * Regional configuration for AM/FM. + * + *

For hardware capabilities check (with full=true when calling + * {@link IBroadcastRadio#getAmFmRegionConfig}), HAL implementation fills + * entire supported range of frequencies and features. + * + * When checking current configuration, at most one bit in each bitset + * can be set. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable AmFmRegionConfig { + /** + * Noth D50 and D75 are FM de-emphasis filter supported or configured. + * + * Both might be set for hardware capabilities check (with full={@code true} + * when calling getAmFmRegionConfig), but exactly one for specific region + * settings. + */ + const int DEEMPHASIS_D50 = 1 << 0; + + const int DEEMPHASIS_D75 = 1 << 1; + + /** + * Both RDS and RBDS are supported or configured RDS variants. + * + * Both might be set for hardware capabilities check (with full={@code true} + * when calling getAmFmRegionConfig), but only one (or none) for specific + * region settings. + * + * RDS is Standard variant, used everywhere except North America. + */ + const int RDS = 1 << 0; + + /** + * Variant used in North America (see RDS). + */ + const int RBDS = 1 << 1; + + /** + * All supported or configured AM/FM bands. + * + * AM/FM bands are identified by frequency value + * (see {@link IdentifierType#AMFM_FREQUENCY_KHZ}). + * + * With typical configuration, it's expected to have two frequency ranges + * for capabilities check (AM and FM) and four ranges for specific region + * configuration (AM LW, AM MW, AM SW, FM). + */ + AmFmBandRange[] ranges; + + /** + * De-emphasis filter supported/configured. + * + * It is a bitset of de-emphasis values (DEEMPHASIS_D50 and DEEMPHASIS_D75). + */ + int fmDeemphasis; + + /** + * RDS/RBDS variant supported/configured. + * + * It is a bitset of RDS values (RDS and RBDS). + */ + int fmRds; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Announcement.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Announcement.aidl new file mode 100644 index 0000000000..a972d4d49a --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/Announcement.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.AnnouncementType; +import android.hardware.broadcastradio.ProgramSelector; +import android.hardware.broadcastradio.VendorKeyValue; + +/** + * Station broadcasting active announcement. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable Announcement { + /** + * Program selector to tune to the announcement. + */ + ProgramSelector selector; + + /** + * Announcement type. + */ + AnnouncementType type = AnnouncementType.INVALID; + + /** + * Vendor-specific information. + * + * It may be used for extra features, not supported by the platform, + * for example: com.me.hdradio.urgency=100; com.me.hdradio.certainity=50. + */ + VendorKeyValue[] vendorInfo; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/AnnouncementType.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/AnnouncementType.aidl new file mode 100644 index 0000000000..8df80252e8 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/AnnouncementType.aidl @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +/** + * Type of an announcement. + * + *

It maps to different announcement types for each radio technology. + */ +@VintfStability +@Backing(type="byte") +@JavaDerive(equals=true, toString=true) +enum AnnouncementType { + /** + * Undefined announcement type + */ + INVALID = 0, + + /** + * DAB alarm, RDS emergency program type (PTY 31). + */ + EMERGENCY = 1, + + /** + * DAB warning. + */ + WARNING, + + /** + * DAB road traffic, RDS TA, HD Radio transportation. + */ + TRAFFIC, + + /** + * Weather. + */ + WEATHER, + + /** + * News. + */ + NEWS, + + /** + * DAB event, special event. + */ + EVENT, + + /** + * DAB sport report, RDS sports. + */ + SPORT, + + /** + * All others. + */ + MISC, +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ConfigFlag.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ConfigFlag.aidl new file mode 100644 index 0000000000..11da39c02b --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ConfigFlag.aidl @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +/** + * Configuration flags to be used with isConfigFlagSet and setConfigFlag methods + * of IBroadcastRadio. + */ +@VintfStability +@Backing(type="int") +@JavaDerive(equals=true, toString=true) +enum ConfigFlag { + /** + * Forces mono audio stream reception. + * + * Analog broadcasts can recover poor reception conditions by jointing + * stereo channels into one. Mainly for, but not limited to AM/FM. + */ + FORCE_MONO = 1, + + /** + * Forces the analog playback for the supporting radio technology. + * + * User may disable digital playback for FM HD Radio or hybrid FM/DAB with + * this option. This is purely user choice, ie. does not reflect digital- + * analog handover state managed from the HAL implementation side. + * + * Some radio technologies may not support this, ie. DAB. + */ + FORCE_ANALOG, + + /** + * Forces the digital playback for the supporting radio technology. + * + * User may disable digital-analog handover that happens with poor + * reception conditions. With digital forced, the radio will remain silent + * instead of switching to analog channel if it's available. This is purely + * user choice, it does not reflect the actual state of handover. + */ + FORCE_DIGITAL, + + /** + * RDS Alternative Frequencies. + * + * If set and the currently tuned RDS station broadcasts on multiple + * channels, radio tuner automatically switches to the best available + * alternative. + */ + RDS_AF, + + /** + * RDS region-specific program lock-down. + * + * Allows user to lock to the current region as they move into the + * other region. + */ + RDS_REG, + + /** + * Enables DAB-DAB hard- and implicit-linking (the same content). + */ + DAB_DAB_LINKING, + + /** + * Enables DAB-FM hard- and implicit-linking (the same content). + */ + DAB_FM_LINKING, + + /** + * Enables DAB-DAB soft-linking (related content). + */ + DAB_DAB_SOFT_LINKING, + + /** + * Enables DAB-FM soft-linking (related content). + */ + DAB_FM_SOFT_LINKING, +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/DabTableEntry.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/DabTableEntry.aidl new file mode 100644 index 0000000000..13c20b0619 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/DabTableEntry.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +/** + * An entry in regional configuration for DAB. + * + *

This defines a frequency table row for ensembles. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable DabTableEntry { + /** + * Channel name, i.e. 5A, 7B. + * + * It must match the following regular expression: + * /^[A-Z0-9][A-Z0-9 ]{0,5}[A-Z0-9]$/ (2-7 uppercase alphanumeric characters + * without spaces allowed at the beginning nor end). + */ + String label; + + /** + * Frequency, in kHz. + */ + int frequencyKhz; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/IAnnouncementListener.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/IAnnouncementListener.aidl new file mode 100644 index 0000000000..f6021c130c --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/IAnnouncementListener.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.Announcement; + +/** + * Callback interface for announcement listener. + * + * For typical configuration, the listener is a broadcast radio service. + */ +@VintfStability +interface IAnnouncementListener { + /** + * Called whenever announcement list has changed. + * + * @param announcements The complete list of currently active announcements. + */ + oneway void onListUpdated(in Announcement[] announcements); +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/IBroadcastRadio.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/IBroadcastRadio.aidl new file mode 100644 index 0000000000..0f88fc0dde --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/IBroadcastRadio.aidl @@ -0,0 +1,353 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.AmFmRegionConfig; +import android.hardware.broadcastradio.AnnouncementType; +import android.hardware.broadcastradio.ConfigFlag; +import android.hardware.broadcastradio.DabTableEntry; +import android.hardware.broadcastradio.IAnnouncementListener; +import android.hardware.broadcastradio.ICloseHandle; +import android.hardware.broadcastradio.ITunerCallback; +import android.hardware.broadcastradio.ProgramFilter; +import android.hardware.broadcastradio.ProgramSelector; +import android.hardware.broadcastradio.Properties; +import android.hardware.broadcastradio.VendorKeyValue; + +/** + * Represents a hardware broadcast radio module. A single module may contain + * multiple hardware tuners (i.e. with an additional background tuner), but the + * layers above the HAL see them as a single logical unit. + */ +@VintfStability +interface IBroadcastRadio { + /** + * Invalid identifier for {@link IBroadcastRadio#getImage}. + */ + const int INVALID_IMAGE = 0; + + /** + * If the antenna is disconnected from the beginning, the + * {@link ITunerCallback#onAntennaStateChange} callback must be + * called within this time. + */ + const int ANTENNA_STATE_CHANGE_TIMEOUT_MS = 100; + + /** + * All chunks of a signal program list update must be transmitted + * within this time. + */ + const int LIST_COMPLETE_TIMEOUT_MS = 300000; + + /** + * All tune, seek and step operations must be completed within + * this time. + */ + const int TUNER_TIMEOUT_MS = 30000; + + /** + * Returns module properties: a description of a module and its + * capabilities. This method must not fail. + * + * @return Module description. + */ + Properties getProperties(); + + /** + * Fetches current or possible AM/FM region configuration. + * + * If the tuner doesn't support AM/FM, a service-specific error + * {@link Result#NOT_SUPPORTED} will be returned. + * + * @param full If {@code true}, returns full hardware capabilities. + * If {@code false}, returns current regional configuration. + * @return config Hardware capabilities (full={@code true}) or current configuration + * (full={@code false}). + */ + AmFmRegionConfig getAmFmRegionConfig(in boolean full); + + /** + * Fetches current DAB region configuration. + * + * If tuner doesn't support DAB, a service-specific error + * {@link Result#NOT_SUPPORTED} wiil be returned. + * + * @return config Current configuration. + */ + DabTableEntry[] getDabRegionConfig(); + + /** + * Sets callback interface. + * + * It is expected that there will only ever be a single callback set. + * If called when a callback is already set, the existing one should be + * replaced with the new callback. + * + * If the callback to be set is null, a service-specific error + * {@link Result#INVALID_ARGUMENTS} will be returned; if the callback + * is not set successfully, a service-specific error + * {@link Result#NOT_SUPPORTED} should be returned. + * + * @param callback The callback interface used for BroadcastRadio HAL. + */ + void setTunerCallback(in ITunerCallback callback); + + /** + * Unsets callback interface. + * + * The existing callback is set to null. + */ + void unsetTunerCallback(); + + /** + * Tunes to a specified program. + * + * Automatically cancels pending tune(), seek() or step(). + * The method should first check whether tune can be processed by the status + * of tuner and inputs, schedule tune task, and then return status + * immediately. If a non-null callback is not set, a service-specific + * error {@link Result#INVALID_STATE} will be returned; if the program + * selector doesn't contain any supported identifier, a service-specific error + * {@link Result#NOT_SUPPORTED} will be returned; if the program selector + * contains identifiers in invalid format (i.e. out of range), a + * service-specific error {@link Result#INVALID_ARGUMENTS} will be returned; + * otherwise, OK will be returned as status. Tune task should be processed + * asynchronously after the method returns status. If the method returns OK, + * {@link ITunerCallback#tuneFailed} or + * {@link ITunerCallback#currentProgramInfoChanged} callback must be called + * after the tune task completes. + * + * @param program Program to tune to. + */ + void tune(in ProgramSelector program); + + /** + * Seeks the next valid program on the "air". + * + * Advance to the next detected program and stay there. + * + * Automatically cancels pending tune(), seek() or step(). + * The method should first check whether seek can be processed by the status + * of tuner and inputs, schedule seek task, and then return status + * immediately. If a non-null callback is not set, a service-specific + * error {@link Result#INVALID_STATE} will be returned; otherwise, OK will + * be returned as status. Seek task should be processed asynchronously + * after the method returns status. If the method returns OK, + * {@link ITunerCallback#tuneFailed} or + * {@link ITunerCallback#currentProgramInfoChanged} callback must be called + * after the seek task completes. + * + * The skipSubChannel parameter is used to skip digital radio subchannels: + * - HD Radio SPS; + * - DAB secondary service. + * + * As an implementation detail, the HAL has the option to perform an actual + * seek or select the next program from the list retrieved in the + * background. + * + * @param directionUp {@code true} to change towards higher numeric values + * (frequency, channel number), {@code false} towards + * lower. + * @param skipSubChannel Don't tune to subchannels. + */ + void seek(in boolean directionUp, in boolean skipSubChannel); + + /** + * Steps to the adjacent channel, which may not be occupied by any program. + * + * Automatically cancels pending tune(), seek() or step(). + * The method should first check whether step can be processed by the status + * of tuner and inputs, schedule step task, and then return status + * immediately. If a non-null callback is not set, service-specific + * error {@link Result#INVALID_STATE} will be returned; if tuning to an + * unoccupied channel is not supported (i.e. for satellite radio), a + * service-specific error {@link Result#NOT_SUPPORTED} will be returned; + * otherwise, OK should be returned as status. Step task should be + * processed asynchronously after the method returns status. If the + * method returns OK, {@link ITunerCallback#tuneFailed} or + * {@link currentProgramInfoChanged} callback must be called after the + * step task completes. + * + * @param directionUp {@code true} to change towards higher numeric values + * (frequency, channel number), {@code false} towards lower. + */ + void step(in boolean directionUp); + + /** + * Cancels pending tune(), seek() or step(). + * + * If there is no such operation running, the call can be ignored. + * If cancel is called after the HAL completes an operation (tune, seek, and step) + * and before the callback completions, the cancel can be ignored and the callback + * should complete. + */ + void cancel(); + + /** + * Applies a filter to the program list and starts sending program list + * update over {@link ITunerCallback#onProgramListUpdated} callback. + * + * There may be only one updates stream active at the moment. Calling this + * method again must result in cancelling the pending update request. + * + * This call clears the program list on the client side, the HAL must send + * the whole list again. + * + * If the program list scanning hardware (i.e. background tuner) is + * unavailable at the moment, the call must succeed and start updates + * when it becomes available. + * + * If the program list scanning is not supported by the hardware, a + * service-specific error {@link Result#NOT_SUPPORTED} will be returned. + * + * @param filter Filter to apply on the fetched program list. + */ + void startProgramListUpdates(in ProgramFilter filter); + + /** + * Stops sending program list updates. + * + * If stopProgramListUpdates is called after the HAL completes a program list update + * and before the onCurrentProgramInfoChanged callback completions, + * stopProgramListUpdates can be ignored and the callback should complete. + */ + void stopProgramListUpdates(); + + /** + * Fetches the current setting of a given config flag. + * + * The success/failure result must be consistent with setConfigFlag. + * + * If the flag is not applicable, a service-specific error + * {@link Result#INVALID_STATE} will be returned. If the flag is not + * supported at all, a service-specific error {@link Result#NOT_SUPPORTED} + * will be returned. + * + * @return the current value of the flag, if succeed. + */ + boolean isConfigFlagSet(in ConfigFlag flag); + + /** + * Sets the config flag. + * + * The success/failure result must be consistent with isConfigFlagSet. + * + * If the flag is not applicable, a service-specific error + * {@link Result#INVALID_STATE} will be returned. If the flag is not + * supported at all, a service-specific error {@link Result#NOT_SUPPORTED} + * will be returned. + * + * @param flag Flag to set. + * @param value The new value of a given flag. + */ + void setConfigFlag(in ConfigFlag flag, in boolean value); + + /** + * Generic method for setting vendor-specific parameter values. + * The framework does not interpret the parameters, they are passed + * in an opaque manner between a vendor application and HAL. + * + * Framework does not make any assumptions on the keys or values, other than + * ones stated in VendorKeyValue documentation (a requirement of key + * prefixes). + * + * For each pair in the result array, the key must be one of the keys + * contained in the input (possibly with wildcards expanded), and the value + * must be a vendor-specific result status (i.e. the string "OK" or an error + * code). The implementation may choose to return an empty array, or only + * return a status for a subset of the provided inputs, at its discretion. + * + * Application and HAL must not use keys with unknown prefix. In particular, + * it must not place a key-value pair in results array for unknown key from + * parameters array - instead, an unknown key should simply be ignored. + * In other words, results array may contain a subset of parameter keys + * (however, the framework doesn't enforce a strict subset - the only + * formal requirement is vendor domain prefix for keys). + * + * @param parameters Vendor-specific key-value pairs. + * @return Operation completion status for parameters being set. + */ + VendorKeyValue[] setParameters(in VendorKeyValue[] parameters); + + /** + * Generic method for retrieving vendor-specific parameter values. + * The framework does not interpret the parameters, they are passed + * in an opaque manner between a vendor application and HAL. + * + * Framework does not cache set/get requests, so it's allowed for + * getParameter to return a different value than previous setParameter call. + * + * The syntax and semantics of keys are up to the vendor (as long as prefix + * rules are obeyed). For instance, vendors may include some form of + * wildcard support. In such case, result array may be of different size + * than requested keys array. However, wildcards are not recognized by + * framework and they are passed as-is to the HAL implementation. + * + * Unknown keys must be ignored and not placed into results array. + * + * @param keys Parameter keys to fetch. + * @return Vendor-specific key-value pairs. + */ + VendorKeyValue[] getParameters(in String[] keys); + + /** + * Fetches image from radio module cache. + * + * This is out-of-band transport mechanism for images carried with metadata. + * The metadata array only passes the identifier, so the client may cache + * images or even not fetch them. + * + * The identifier may be any arbitrary number (i.e. sha256 prefix) selected + * by the vendor. It must be stable so the application may cache it. + * + * The data must be a valid PNG, JPEG, GIF or BMP file, and must be less + * than 1MB, due to hard limit on binder transaction buffer. + * + * Image data with an invalid format must be handled gracefully in the same + * way as a missing image. + * + * The image identifier may become invalid after some time from passing it + * with metadata struct (due to resource cleanup at the HAL implementation). + * However, it must remain valid for a currently tuned program at least + * until onCurrentProgramInfoChanged is called. + * + * @param id Identifier of an image (value of {@link IBroadcastRadio#INVALID_IMAGE} + * is reserved and must be treated as invalid image). + * @return A binary blob with image data + * or a zero-length array if identifier doesn't exist. + */ + byte[] getImage(in int id); + + /** + * Registers announcement listener. + * + * If there is at least one observer registered, HAL implementation must + * notify about announcements. + * + * If the observer dies, the HAL implementation must unregister observer + * automatically. + * + * If the tuner doesn't support announcements, a service-specific error + * {@link Result#NOT_SUPPORTED} will be returned. + * + * @param listener The listener interface. + * @param enabled The list of announcement types to watch for. + * @return a handle to unregister observer. + */ + ICloseHandle registerAnnouncementListener( + in IAnnouncementListener listener, in AnnouncementType[] enabled); +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ICloseHandle.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ICloseHandle.aidl new file mode 100644 index 0000000000..4a3240b9e2 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ICloseHandle.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +/** + * Represents a generic close handle to remove a callback that doesn't need + * active interface. + */ +@VintfStability +interface ICloseHandle { + /** + * Closes the handle. + * + * The call must not fail and must only be issued once. + * + * After the close call is executed, no other calls to this interface + * are allowed. If the call is issued second time, a service-specific + * error {@link Result#INVALID_STATE} will be returned. + */ + void close(); +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ITunerCallback.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ITunerCallback.aidl new file mode 100644 index 0000000000..1f0221cbf9 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ITunerCallback.aidl @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.ConfigFlag; +import android.hardware.broadcastradio.ProgramInfo; +import android.hardware.broadcastradio.ProgramListChunk; +import android.hardware.broadcastradio.ProgramSelector; +import android.hardware.broadcastradio.Result; +import android.hardware.broadcastradio.VendorKeyValue; + +@VintfStability +oneway interface ITunerCallback { + /** + * Method called by the HAL when a tuning operation fails asynchronously + * following {@link IBroadcastRadio#tune}, {@link IBroadcastRadio#seek} + * or {@link IBroadcastRadio#step}. + * + * This callback is only called when the tune(), seek() or step() command + * succeeds without returning any error at first. + * + * @param result {@link Result#TIMEOUT} in case that tune(), seek() or + * step() is not completed within + * @link IBroadcastRadio#TUNER_TIMEOUT_MS} + * @param selector A ProgramSelector structure passed from tune() call; + * empty for step() and seek(). + */ + void onTuneFailed(in Result result, in ProgramSelector selector); + + /** + * Method called by the HAL when current program information (including + * metadata) is updated. It must be called when {@link IBroadcastRadio#tune} + * {@link IBroadcastRadio#seek} or {@link IBroadcastRadio#step} command + * succeeds. + * + * This is also called when the radio tuned to the static (not a valid + * station), see {@link ProgramInfo#FLAG_TUNABLE} flag. + * + * @param info Current program information. + */ + void onCurrentProgramInfoChanged(in ProgramInfo info); + + /** + * A delta update of the program list, called whenever there's a change in + * the list. + * + * If there are frequent changes, HAL implementation must throttle the rate + * of the updates. + * + * There is a hard limit on binder transaction buffer, and the list must + * not exceed it. For large lists, HAL implementation must split them to + * multiple chunks, no larger than 500kiB each, and call this program list + * update callback method separately. + * + * @param chunk A chunk of the program list update. + */ + void onProgramListUpdated(in ProgramListChunk chunk); + + /** + * Method called by the HAL when the antenna gets connected or disconnected. + * + * For broadcast radio service, client must assume the antenna is connected. + * If it's not, then antennaStateChange must be called within + * {@link IBroadcastRadio#ANTENNA_STATE_CHANGE_TIMEOUT_MS} to indicate that. + * + * @param connected {@code true} if the antenna is now connected, {@code false} + * otherwise. + */ + void onAntennaStateChange(in boolean connected); + + /** + * Generic callback for passing updates to config flags. + * + * It's up to the HAL implementation if and how to implement this callback, + * as long as it obeys the prefix rule. However, setConfigFlag must not + * trigger this callback, while an internal event can change config flag + * asynchronously at the HAL layer. + * + * @param flag Flag that has changed. + * @param value The new value of the given flag. + */ + void onConfigFlagUpdated(in ConfigFlag flag, in boolean value); + + /** + * Generic callback for passing updates to vendor-specific parameter values. + * The framework does not interpret the parameters, they are passed + * in an opaque manner between a vendor application and HAL. + * + * It's up to the HAL implementation if and how to implement this callback, + * as long as it obeys the prefix rule. In particular, only selected keys + * may be notified this way. However, setParameters must not trigger + * this callback, while an internal event can change parameters + * asynchronously at the HAL layer. + * + * @param parameters Vendor-specific key-value pairs, + * opaque to Android framework. + */ + void onParametersUpdated(in VendorKeyValue[] parameters); +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl new file mode 100644 index 0000000000..0484d02a9e --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl @@ -0,0 +1,163 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +/** + * Type of program identifier component. + * + * Each identifier type corresponds to exactly one radio technology, + * i.e. DAB_ENSEMBLE is specifically for DAB. + * + * VENDOR identifier types must be opaque to the framework. + * + * The value format for each (but VENDOR_*) identifier is strictly defined + * to maintain interoperability between devices made by different vendors. + * + * All other values are reserved for future use. + * Values not matching any enumerated constant must be ignored. + */ +@VintfStability +@Backing(type="int") +@JavaDerive(equals=true, toString=true) +enum IdentifierType { + /** + * Primary/secondary identifier for vendor-specific radio technology. + * The value format is determined by a vendor. + * + * The vendor identifiers have limited serialization capabilities - see + * ProgramSelector description. + */ + VENDOR_START = 1000, + + /** + * See VENDOR_START + */ + VENDOR_END = 1999, + + /** + * Undefined identifier type. + */ + INVALID = 0, + + /** + * Primary identifier for analogue (without RDS) AM/FM stations: + * frequency in kHz. + * + * This identifier also contains band information: + * - <500kHz: AM LW; + * - 500kHz - 1705kHz: AM MW; + * - 1.71MHz - 30MHz: AM SW; + * - >60MHz: FM. + */ + AMFM_FREQUENCY_KHZ, + + /** + * 16bit primary identifier for FM RDS station. + */ + RDS_PI, + + /** + * 64bit compound primary identifier for HD Radio. + * + * Consists of (from the LSB): + * - 32bit: Station ID number; + * - 4bit: HD Radio subchannel; + * - 18bit: AMFM_FREQUENCY_KHZ. + * + * While station ID number should be unique globally, it sometimes get + * abused by broadcasters (i.e. not being set at all). To ensure local + * uniqueness, AMFM_FREQUENCY_KHZ was added here. Global uniqueness is + * a best-effort - see HD_STATION_NAME. + * + * HD Radio subchannel is a value in range 0-7. + * This index is 0-based (where 0 is MPS and 1..7 are SPS), + * as opposed to HD Radio standard (where it's 1-based). + * + * The remaining bits should be set to zeros when writing on the chip side + * and ignored when read. + */ + + HD_STATION_ID_EXT, + + /** + * 64bit additional identifier for HD Radio. + * + * Due to Station ID abuse, some HD_STATION_ID_EXT identifiers may be not + * globally unique. To provide a best-effort solution, a short version of + * station name may be carried as additional identifier and may be used + * by the tuner hardware to double-check tuning. + * + * The name is limited to the first 8 A-Z0-9 characters (lowercase letters + * must be converted to uppercase). Encoded in little-endian ASCII: + * the first character of the name is the LSB. + * + * For example: "Abc" is encoded as 0x434241. + */ + HD_STATION_NAME, + + /** + * 28bit compound primary identifier for Digital Audio Broadcasting. + * + * Consists of (from the LSB): + * - 16bit: SId; + * - 8bit: ECC code; + * - 4bit: SCIdS. + * + * SCIdS (Service Component Identifier within the Service) value + * of 0 represents the main service, while 1 and above represents + * secondary services. + * + * The remaining bits should be set to zeros when writing on the chip side + * and ignored when read. + */ + DAB_SID_EXT, + + /** + * 16bit + */ + DAB_ENSEMBLE, + + /** + * 12bit + */ + DAB_SCID, + + /** + * kHz (see AMFM_FREQUENCY_KHZ) + */ + DAB_FREQUENCY_KHZ, + + /** + * 24bit primary identifier for Digital Radio Mondiale. + */ + DRMO_SERVICE_ID, + + /** + * kHz (see AMFM_FREQUENCY_KHZ) + */ + DRMO_FREQUENCY_KHZ, + + /** + * 32bit primary identifier for SiriusXM Satellite Radio. + */ + SXM_SERVICE_ID = DRMO_FREQUENCY_KHZ + 2, + + /** + * 0-999 range + */ + SXM_CHANNEL, +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Metadata.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Metadata.aidl new file mode 100644 index 0000000000..3298cac969 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/Metadata.aidl @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +/** + * An element of metadata array. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +union Metadata { + /** + * RDS PS (string) + */ + String rdsPs; + + /** + * RDS PTY (uint8_t) + */ + int rdsPty; + + /** + * RBDS PTY (uint8_t) + */ + int rbdsPty; + + /** + * RDS RT (string) + */ + String rdsRt; + + /** + * Song title (string) + */ + String songTitle; + + /** + * Artist name (string) + */ + String songArtist; + + /** + * Album name (string) + */ + String songAlbum; + + /** + * Station icon (uint32_t, see {@link IBroadcastRadio#getImage}) + */ + int stationIcon; + + /** + * Album art (uint32_t, see {@link IBroadcastRadio#getImage}) + */ + int albumArt; + + /** + * Station name. + * + * This is a generic field to cover any radio technology. + * + * If the PROGRAM_NAME has the same content as DAB_*_NAME or RDS_PS, + * it may not be present, to preserve space - framework must repopulate + * it on the client side. + */ + String programName; + + /** + * DAB ensemble name (string) + */ + String dabEnsembleName; + + /** + * DAB ensemble name abbreviated (string). + * + * The string must be up to 8 characters long. + * + * If the short variant is present, the long (DAB_ENSEMBLE_NAME) one must be + * present as well. + */ + String dabEnsembleNameShort; + + /** + * DAB service name (string) + */ + String dabServiceName; + + /** + * DAB service name abbreviated (see DAB_ENSEMBLE_NAME_SHORT) (string) + */ + String dabServiceNameShort; + + /** + * DAB component name (string) + */ + String dabComponentName; + + /** + * DAB component name abbreviated (see DAB_ENSEMBLE_NAME_SHORT) (string) + */ + String dabComponentNameShort; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramFilter.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramFilter.aidl new file mode 100644 index 0000000000..3dd10eb81d --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramFilter.aidl @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.IdentifierType; +import android.hardware.broadcastradio.ProgramIdentifier; + +/** + * Large-grain filter to the program list. + * + * This is meant to reduce binder transaction bandwidth, not for fine-grained + * filtering user might expect. + * + * The filter is designed as conjunctive normal form: the entry that passes the + * filter must satisfy all the clauses (members of this struct). Vector clauses + * are disjunctions of literals. In other words, there is AND between each + * high-level group and OR inside it. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable ProgramFilter { + /** + * List of identifier types that are filtered by the filter. + * + * If the program list entry contains at least one identifier of the type + * listed, it satisfies this condition. + * + * Empty list means no filtering on identifier type. + */ + IdentifierType[] identifierTypes; + + /** + * List of identifiers that are filtered by the filter. + * + * If the program list entry contains at least one listed identifier, + * it satisfies this condition. + * + * Empty list means no filtering on identifier. + */ + ProgramIdentifier[] identifiers; + + /** + * Includes non-tunable entries that define tree structure on the + * program list (i.e. DAB ensembles). + */ + boolean includeCategories; + + /** + * Disables updates on entry modifications. + * + * If {@code true}, 'modified' vector of {@link ProgramListChunk} must contain + * list additions only. Once the program is added to the list, it's not + * updated anymore. + */ + boolean excludeModifications; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramIdentifier.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramIdentifier.aidl new file mode 100644 index 0000000000..2057d97eb0 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramIdentifier.aidl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.IdentifierType; + +/** + * A single program identifier component, i.e. frequency or channel ID. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable ProgramIdentifier { + /** + * Maps to IdentifierType enum. + */ + IdentifierType type = IdentifierType.INVALID; + + /** + * The uint64_t value field holds the value in format described in comments + * for IdentifierType enum. + */ + long value; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl new file mode 100644 index 0000000000..3e2c9cca7d --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.Metadata; +import android.hardware.broadcastradio.ProgramIdentifier; +import android.hardware.broadcastradio.ProgramSelector; +import android.hardware.broadcastradio.VendorKeyValue; + +/** + * Program (channel, station) information. + * + * Carries both user-visible information (like station name) and technical + * details (tuning selector). + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable ProgramInfo { + /** + * Set when the program is currently playing live stream. + * This may result in a slightly altered reception parameters, + * usually targeted at reduced latency. + */ + const int FLAG_LIVE = 1 << 0; + + /** + * Radio stream is not playing, ie. due to bad reception conditions or + * buffering. In this state volume knob MAY be disabled to prevent user + * increasing volume too much. + */ + const int FLAG_MUTED = 1 << 1; + + /** + * Station broadcasts traffic information regularly, + * but not necessarily right now. + */ + const int FLAG_TRAFFIC_PROGRAM = 1 << 2; + + /** + * Station is broadcasting traffic information at the very moment. + */ + const int FLAG_TRAFFIC_ANNOUNCEMENT = 1 << 3; + + /** + * Station can be tuned to (not playing static). + * + * It's the same condition that would stop a seek operation + * (i.e. {@link IBroadcastRadio#seek}). + * + * By definition, this flag must be set for all items on the program list. + */ + const int FLAG_TUNABLE = 1 << 4; + + /** + * Audio stream is MONO if this bit is not set. + */ + const int FLAG_STEREO = 1 << 5; + + /** + * An identifier used to point at the program (primarily to tune to it). + * + * This field is required - its type field must not be set to + * {@link IdentifierType#INVALID}. + */ + ProgramSelector selector; + + /** + * Identifier currently used for program selection. + * + * It allows to determine which technology is currently used for reception. + * + * Some program selectors contain tuning information for different radio + * technologies (i.e. FM RDS and DAB). For example, user may tune using + * a ProgramSelector with RDS_PI primary identifier, but the tuner hardware + * may choose to use DAB technology to make actual tuning. This identifier + * must reflect that. + * + * This field is required for currently tuned program only. + * For all other items on the program list, its type field must be + * initialized to {@link IdentifierType#INVALID}. + * + * Only primary identifiers for a given radio technology are valid: + * - AMFM_FREQUENCY_KHZ for analog AM/FM; + * - RDS_PI for FM RDS; + * - HD_STATION_ID_EXT; + * - DAB_SID_EXT; + * - DRMO_SERVICE_ID; + * - SXM_SERVICE_ID; + * - VENDOR_*; + * - more might come in next minor versions of this HAL. + */ + ProgramIdentifier logicallyTunedTo; + + /** + * Identifier currently used by hardware to physically tune to a channel. + * + * Some radio technologies broadcast the same program on multiple channels, + * i.e. with RDS AF the same program may be broadcasted on multiple + * alternative frequencies; the same DAB program may be broadcast on + * multiple ensembles. This identifier points to the channel to which the + * radio hardware is physically tuned to. + * + * This field is required for currently tuned program only. + * For all other items on the program list, its type field must be + * initialized to {@link IdentifierType#INVALID}. + * + * Only physical identifiers are valid: + * - AMFM_FREQUENCY_KHZ; + * - DAB_ENSEMBLE; + * - DRMO_FREQUENCY_KHZ; + * - SXM_CHANNEL; + * - VENDOR_*; + * - more might come in next minor versions of this HAL. + */ + ProgramIdentifier physicallyTunedTo; + + /** + * Primary identifiers of related contents. + * + * Some radio technologies provide pointers to other programs that carry + * related content (i.e. DAB soft-links). This field is a list of pointers + * to other programs on the program list. + * + * This is not a list of programs that carry the same content (i.e. + * DAB hard-links, RDS AF). Switching to programs from this list usually + * require user action. + * + * Please note, that these identifiers do not have to exist on the program + * list - i.e. DAB tuner may provide information on FM RDS alternatives + * despite not supporting FM RDS. If the system has multiple tuners, another + * one may have it on its list. + * + * This field is optional. + */ + @nullable ProgramIdentifier[] relatedContent; + + /** + * Program flags. + */ + int infoFlags; + + /** + * Signal quality measured in 0% to 100% range to be shown in the UI. + */ + int signalQuality; + + /** + * Program metadata (station name, PTY, song title). + */ + Metadata[] metadata; + + /** + * Vendor-specific information. + * + * It may be used for extra features, not supported by the platform, + * for example: paid-service=true; bitrate=320kbps. + */ + VendorKeyValue[] vendorInfo; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramListChunk.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramListChunk.aidl new file mode 100644 index 0000000000..a62d461475 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramListChunk.aidl @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.ProgramIdentifier; +import android.hardware.broadcastradio.ProgramInfo; + +/** + * An update packet of the program list. + * + * The order of entries in the arrays is unspecified. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable ProgramListChunk { + /** + * Treats all previously added entries as removed. + * + * This is meant to save binder transaction bandwidth on 'removed' array + * and provide a clear empty state. + * + * If set, 'removed' array must be null. + * + * The client may wait with taking action on this until it received the + * chunk with complete flag set (to avoid part of stations temporarily + * disappearing from the list). + */ + boolean purge; + + /** + * If false, it means there are still programs not transmitted, + * due for transmission in following updates. + * + * Used by UIs that wait for complete list instead of displaying + * programs while scanning. + * + * After the whole channel range was scanned and all discovered programs + * were transmitted, the last chunk must have set this flag to {@code true}. + * This must happen within {@link IBroadcastRadio#LIST_COMPLETE_TIMEOUT_MS} + * from the startProgramListUpdates call. If it doesn't, client may assume + * the tuner came into a bad state and display error message. + */ + boolean complete; + + /** + * Added or modified program list entries. + * + * Two entries with the same primaryId (ProgramSelector member) + * are considered the same. + */ + ProgramInfo[] modified; + + /** + * Removed program list entries. + * + * Contains primaryId (ProgramSelector member) of a program to remove. + */ + @nullable ProgramIdentifier[] removed; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl new file mode 100644 index 0000000000..8bd3fd41e4 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.ProgramIdentifier; + +/** + * A set of identifiers necessary to tune to a given station. + * + * This can hold a combination of various identifiers, like: + * - AM/FM frequency, + * - HD Radio subchannel, + * - DAB service ID. + * + * The type of radio technology is determined by the primary identifier - if the + * primary identifier is for DAB, the program is DAB. However, a program of a + * specific radio technology may have additional secondary identifiers for other + * technologies, i.e. a satellite program may have FM fallback frequency, + * if a station broadcasts both via satellite and FM. + * + * The identifiers from VENDOR_START..VENDOR_END range have limited + * serialization capabilities: they are serialized locally, but ignored by the + * cloud services. If a program has primary id from vendor range, it's not + * synchronized with other devices at all. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable ProgramSelector { + /** + * Primary program identifier. + * + * This identifier uniquely identifies a station and can be used for + * equality check. + * + * It can hold only a subset of identifier types, one per each + * radio technology: + * - analogue AM/FM: AMFM_FREQUENCY_KHZ; + * - FM RDS: RDS_PI; + * - HD Radio: HD_STATION_ID_EXT; + * - DAB: DAB_SID_EXT; + * - Digital Radio Mondiale: DRMO_SERVICE_ID; + * - SiriusXM: SXM_SERVICE_ID; + * - vendor-specific: VENDOR_START..VENDOR_END. + */ + ProgramIdentifier primaryId; + + /** + * Secondary program identifiers. + * + * These identifiers are supplementary and can speed up tuning process, + * but the primary ID must be sufficient (i.e. RDS PI is enough to select + * a station from the list after a full band scan). + * + * Two selectors with different secondary IDs, but the same primary ID are + * considered equal. In particular, secondary IDs array may get updated for + * an entry on the program list (ie. when a better frequency for a given + * station is found). + */ + ProgramIdentifier[] secondaryIds; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Properties.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Properties.aidl new file mode 100644 index 0000000000..36cbaffafb --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/Properties.aidl @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.IdentifierType; +import android.hardware.broadcastradio.VendorKeyValue; + +/** + * Properties of a given broadcast radio module. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable Properties { + /** + * A company name who made the radio module. Must be a valid, registered + * name of the company itself. + * + * It must be opaque to the Android framework. + */ + String maker; + + /** + * A product name. Must be unique within the company. + * + * It must be opaque to the Android framework. + */ + String product; + + /** + * Version of the hardware module. + * + * It must be opaque to the Android framework. + */ + String version; + + /** + * Hardware serial number (for subscription services). + * + * It must be opaque to the Android framework. + */ + String serial; + + /** + * A list of supported {@link IdentifierType} values. + * + * If an identifier is supported by radio module, it means it can use it for + * tuning to ProgramSelector with either primary or secondary Identifier of + * a given type. + * + * Support for VENDOR identifier type does not guarantee compatibility, as + * other module properties (implementor, product, version) must be checked. + */ + IdentifierType[] supportedIdentifierTypes; + + /** + * Vendor-specific information. + * + * It may be used for extra features, not supported by the platform, + * for example: com.me.preset-slots=6; com.me.ultra-hd-capable={@code false}. + */ + VendorKeyValue[] vendorInfo; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl new file mode 100644 index 0000000000..9985ccbfd7 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +/** + * Result for methods of BroadcastRadio AIDL HAL interfaces. + */ +@VintfStability +@Backing(type="int") +enum Result { + /** + * Methods run without error. + */ + OK, + + /** + * Internal error in HAL. + */ + INTERNAL_ERROR, + + /** + * Error used when the input argument for the method is invalid. + */ + INVALID_ARGUMENTS, + + /** + * Error used when the service is of invalid state (i.e. callback + * is not registered for IBroadcastRadio). + */ + INVALID_STATE, + + /** + * Error used when an operation is not supported. + */ + NOT_SUPPORTED, + + /** + * Error used when a tune, seek, step or operation is not completed + * within {@link IBroadcastRadio#LIST_COMPLETE_TIMEOUT_MS}. + */ + TIMEOUT, + + /** + * Error that does not follow into the error categories above. + */ + UNKNOWN_ERROR, +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/VendorKeyValue.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/VendorKeyValue.aidl new file mode 100644 index 0000000000..c923e926f8 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/VendorKeyValue.aidl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.broadcastradio; + +/** + * A key-value pair for vendor-specific information to be passed as-is through + * Android framework to the front-end application. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable VendorKeyValue { + /** + * Key must start with unique vendor Java-style namespace, + * eg. 'com.somecompany.parameter1'. + */ + String key; + + /** + * Value must be passed through the framework without any changes. + * Format of this string can vary across vendors. + */ + String value; +} diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 4b4589d24f..9a939d1eeb 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -152,17 +152,8 @@ default - + android.hardware.broadcastradio - 1.0-1 - - IBroadcastRadioFactory - default - - - - android.hardware.broadcastradio - 2.0 IBroadcastRadio .*