Skip to content

Commit

Permalink
radio: config: 1.1-wrapper: Initial wrapper
Browse files Browse the repository at this point in the history
* This lets us have [email protected] interface while the device
  doesn't provide or isn't capable of it. Confirmed to be working
  fine on GSI.
* `lineage.hardware.radio.config` HIDL interface is a copy of
  `android.hardware.radio.config`, which is supposed to be
  registered by the real RIL service.
* For examples of how to use it, Please refer to
  `radio-config-1.0-wrapper_device` topic on LineageOS Gerrit.

Co-authored-by: Sebastiano Barezzi <[email protected]>
Change-Id: I346810d5532d6612f92ad541a9c472482233ac79
  • Loading branch information
me-cafebabe and SebaUbuntu committed Apr 25, 2024
1 parent 7f5f189 commit 978ca55
Show file tree
Hide file tree
Showing 29 changed files with 1,315 additions and 0 deletions.
4 changes: 4 additions & 0 deletions _backend/Android.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
hidl_package_root {
name: "lineage.hardware",
path: "hardware/lineage/interfaces/_backend",
}
13 changes: 13 additions & 0 deletions _backend/current.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
7a3d616493acedda3b64c7f81ee407265fcb36a508ea889733196dcd942e3c76 [email protected]::types
c204fd7819843ae0d73b34e4eaa1d63d1cc17e9b304fae5d3fccef35e38f6756 [email protected]::IRadioConfig
2bcb03a75a3b53ba57d27e6f989dadd07712c9d7739758af654f57a0173cb5ba [email protected]::IRadioConfigIndication
ad06069c78380c6355c347f1350b3c7562d91a042d1952b4fe8c85348902c6ef [email protected]::IRadioConfigResponse
bfef144715c87c96af3a1066ed3960b39462f8026caa97d1dbd8ce6ed43b7b37 [email protected]::types
7c1384035569deb5f611f8eaa7807e8dbb0d23aaf435e3adcb4bda45889d5512 [email protected]::IRadioConfig
88d4d671849ac3239fe32f0bf8c4e0d215fb393f8c2aee62c18049392accdbaa [email protected]::IRadioConfigIndication
f1b68013c6e07f9407e39cc6b627f32a4578873da944b272dc211d14a2c09b25 [email protected]::IRadioConfigResponse
b9ee1aeb20a9508835ea723a36791eb0995df71d311dd55d499288bfb7b66ced [email protected]::types
31c9fcce62abb962cc2b645bb5f3190d0dba58eba8d411756ac5bcbb292cbef0 [email protected]::IRadioConfigIndication
e59d2481473837d1f44108865f82907f4b41c72eb9583ce3c04b5f9dc4f4f592 [email protected]::IRadioConfigResponse
a7b15a84a84ef71ee41ef86a8a6cb7dd35ab38b849ed405cf1ac2cbe98772f43 [email protected]::IRadioConfig
562021f3834002cced2db496576eb8dadc819b9ffe8eaca2102b141a5d4cf0da [email protected]::IRadioConfigResponse
17 changes: 17 additions & 0 deletions _backend/radio/config/1.0/Android.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// This file is autogenerated by hidl-gen -Landroidbp.

hidl_interface {
name: "[email protected]",
root: "lineage.hardware",
srcs: [
"types.hal",
"IRadioConfig.hal",
"IRadioConfigIndication.hal",
"IRadioConfigResponse.hal",
],
interfaces: [
"[email protected]",
"[email protected]",
],
gen_java: true,
}
82 changes: 82 additions & 0 deletions _backend/radio/config/1.0/IRadioConfig.hal
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright (C) 2018 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 [email protected];

import IRadioConfigResponse;
import IRadioConfigIndication;

/**
* This interface is used by telephony and telecom to talk to cellular radio for the purpose of
* radio configuration, and it is not associated with any specific modem or slot.
* All the functions have minimum one parameter:
* serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the
* duration of a method call. If clients provide colliding serials (including passing the same
* serial to different methods), multiple responses (one for each method call) must still be served.
*/
interface IRadioConfig {

/**
* Set response functions for radio config requests & radio config indications.
*
* @param radioConfigResponse Object containing radio config response functions
* @param radioConfigIndication Object containing radio config indications
*/
setResponseFunctions(IRadioConfigResponse radioConfigResponse,
IRadioConfigIndication radioConfigIndication);

/**
* Get SIM Slot status.
*
* Request provides the slot status of all active and inactive SIM slots and whether card is
* present in the slots or not.
*
* @param serial Serial number of request.
*
* Response callback is IRadioConfigResponse.getSimSlotsStatusResponse()
*/
oneway getSimSlotsStatus(int32_t serial);

/**
* Set SIM Slot mapping.

* Maps the logical slots to the physical slots. Logical slot is the slot that is seen by modem.
* Physical slot is the actual physical slot. Request maps the physical slot to logical slot.
* Logical slots that are already mapped to the requested physical slot are not impacted.
*
* Example no. of logical slots 1 and physical slots 2:
* The only logical slot (index 0) can be mapped to first physical slot (value 0) or second
* physical slot(value 1), while the other physical slot remains unmapped and inactive.
* slotMap[0] = 1 or slotMap[0] = 0
*
* Example no. of logical slots 2 and physical slots 2:
* First logical slot (index 0) can be mapped to physical slot 1 or 2 and other logical slot
* can be mapped to other physical slot. Each logical slot must be mapped to a physical slot.
* slotMap[0] = 0 and slotMap[1] = 1 or slotMap[0] = 1 and slotMap[1] = 0
*
* @param serial Serial number of request
* @param slotMap Logical to physical slot mapping, size == no. of radio instances. Index is
* mapping to logical slot and value to physical slot, need to provide all the slots
* mapping when sending request in case of multi slot device.
* EX: uint32_t slotMap[logical slot] = physical slot
* index 0 is the first logical_slot number of logical slots is equal to number of Radio
* instances and number of physical slots is equal to size of slotStatus in
* getSimSlotsStatusResponse
*
* Response callback is IRadioConfigResponse.setSimSlotsMappingResponse()
*/
oneway setSimSlotsMapping(int32_t serial, vec<uint32_t> slotMap);
};
38 changes: 38 additions & 0 deletions _backend/radio/config/1.0/IRadioConfigIndication.hal
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (C) 2018 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 [email protected];

import [email protected]::RadioIndicationType;

/**
* Interface declaring unsolicited radio config indications.
*/
interface IRadioConfigIndication {

/**
* Indicates SIM slot status change.

* This indication must be sent by the modem whenever there is any slot status change, even the
* slot is inactive. For example, this indication must be triggered if a SIM card is inserted
* into an inactive slot.
*
* @param type Type of radio indication
* @param slotStatus new slot status info with size equals to the number of physical slots on
* the device
*/
oneway simSlotsStatusChanged(RadioIndicationType type, vec<SimSlotStatus> slotStatus);
};
52 changes: 52 additions & 0 deletions _backend/radio/config/1.0/IRadioConfigResponse.hal
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (C) 2018 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 [email protected];

import [email protected]::RadioResponseInfo;

/**
* Interface declaring response functions to solicited radio config requests.
*/
interface IRadioConfigResponse {

/**
* @param info Response info struct containing response type, serial no. and error
* @param slotStatus Sim slot struct containing all the physical SIM slots info with size
* equals to the number of physical slots on the device
*
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:NO_MEMORY
* RadioError:INTERNAL_ERR
* RadioError:MODEM_ERR
*/
oneway getSimSlotsStatusResponse(RadioResponseInfo info, vec<SimSlotStatus> slotStatus);

/**
* @param info Response info struct containing response type, serial no. and error
*
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:NO_MEMORY
* RadioError:INTERNAL_ERR
* RadioError:MODEM_ERR
* RadioError:INVALID_ARGUMENTS
*/
oneway setSimSlotsMappingResponse(RadioResponseInfo info);
};
58 changes: 58 additions & 0 deletions _backend/radio/config/1.0/types.hal
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright (C) 2018 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 [email protected];

import [email protected]::CardState;

enum SlotState : int32_t {
/**
* Physical slot is inactive
*/
INACTIVE = 0x00,
/**
* Physical slot is active
*/
ACTIVE = 0x01,
};

struct SimSlotStatus {
/**
* Card state in the physical slot
*/
CardState cardState;
/**
* Slot state Active/Inactive
*/
SlotState slotState;
/**
* An Answer To Reset (ATR) is a message output by a Smart Card conforming to ISO/IEC 7816
* standards, following electrical reset of the card's chip. The ATR conveys information about
* the communication parameters proposed by the card, and the card's nature and state.
*
* This data is applicable only when cardState is CardState:PRESENT.
*/
string atr;
uint32_t logicalSlotId;
/**
* Integrated Circuit Card IDentifier (ICCID) is Unique Identifier of the SIM CARD. File is
* located in the SIM card at EFiccid (0x2FE2) as per ETSI 102.221. The ICCID is defined by
* the ITU-T recommendation E.118 ISO/IEC 7816.
*
* This data is applicable only when cardState is CardState:PRESENT.
*/
string iccid;
};
Empty file.
19 changes: 19 additions & 0 deletions _backend/radio/config/1.1/Android.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// This file is autogenerated by hidl-gen -Landroidbp.

hidl_interface {
name: "[email protected]",
root: "lineage.hardware",
srcs: [
"types.hal",
"IRadioConfig.hal",
"IRadioConfigIndication.hal",
"IRadioConfigResponse.hal",
],
interfaces: [
"[email protected]",
"[email protected]",
"[email protected]",
],
gen_java: true,
system_ext_specific: true,
}
92 changes: 92 additions & 0 deletions _backend/radio/config/1.1/IRadioConfig.hal
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Copyright (C) 2018 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 [email protected];

import @1.0::IRadioConfig;
import @1.1::IRadioConfigResponse;
import @1.1::PhoneCapability;
import @1.1::ModemsConfig;

/**
* Note: IRadioConfig 1.1 is an intermediate layer between Android P and Android Q.
* It's specifically designed for CBRS related interfaces. All other interfaces
* for Q are added in IRadioConfig 1.2.
*
* This interface is used by telephony and telecom to talk to cellular radio for the purpose of
* radio configuration, and it is not associated with any specific modem or slot.
* All the functions have minimum one parameter:
* serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the
* duration of a method call. If clients provide colliding serials (including passing the same
* serial to different methods), multiple responses (one for each method call) must still be served.
*/
interface IRadioConfig extends @1.0::IRadioConfig {
/**
* Request current phone capability.
*
* @param serial Serial number of request.
*
* Response callback is IRadioResponse.getPhoneCapabilityResponse() which
* will return <@1.1::PhoneCapability>.
*/
oneway getPhoneCapability(int32_t serial);

/**
* Set preferred data modem Id.
* In a multi-SIM device, notify modem layer which logical modem will be used primarily
* for data. It helps modem with resource optimization and decisions of what data connections
* should be satisfied.
*
* @param serial Serial number of request.
* @param modem Id the logical modem ID, which should match one of modem IDs returned
* from getPhoneCapability().
*
* Response callback is IRadioConfigResponse.setPreferredDataModemResponse()
*/
oneway setPreferredDataModem(int32_t serial, uint8_t modemId);

/**
* Set modems configurations by specifying the number of live modems (i.e modems that are
* enabled and actively working as part of a working telephony stack).
*
* Example: this interface can be used to switch to single/multi sim mode by specifying
* the number of live modems as 1, 2, etc
*
* Note: by setting the number of live modems in this API, that number of modems will
* subsequently get enabled/disabled
*
* @param serial serial number of request.
* @param modemsConfig ModemsConfig object including the number of live modems
*
* Response callback is IRadioResponse.setModemsConfigResponse()
*/
oneway setModemsConfig(int32_t serial, ModemsConfig modemsConfig);

/**
* Get modems configurations. This interface is used to get modem configurations
* which includes the number of live modems (i.e modems that are
* enabled and actively working as part of a working telephony stack)
*
* Note: in order to get the overall number of modems available on the phone,
* refer to getPhoneCapability API
*
* @param serial Serial number of request.
*
* Response callback is IRadioResponse.getModemsConfigResponse() which
* will return <@1.1::ModemsConfig>.
*/
oneway getModemsConfig(int32_t serial);
};
Loading

0 comments on commit 978ca55

Please sign in to comment.