Merge changes from topic "sensors-hal-aidl"
* changes:
Adds sensors aidl default (cuttlefish) implementation
Adds sensors HAL AIDL interface
diff --git a/audio/policy/1.0/xml/api/current.txt b/audio/policy/1.0/xml/api/current.txt
index 29a9cd4..1478381 100644
--- a/audio/policy/1.0/xml/api/current.txt
+++ b/audio/policy/1.0/xml/api/current.txt
@@ -232,8 +232,10 @@
public class ValueType {
ctor public ValueType();
+ method public int getAndroid_type();
method public String getLiteral();
method public int getNumerical();
+ method public void setAndroid_type(int);
method public void setLiteral(String);
method public void setNumerical(int);
}
diff --git a/audio/policy/1.0/xml/audio_policy_engine_configuration.xsd b/audio/policy/1.0/xml/audio_policy_engine_configuration.xsd
index 842e724..852ea77 100644
--- a/audio/policy/1.0/xml/audio_policy_engine_configuration.xsd
+++ b/audio/policy/1.0/xml/audio_policy_engine_configuration.xsd
@@ -190,6 +190,7 @@
<xs:complexType name="valueType">
<xs:attribute name="literal" type="xs:string" use="required"/>
<xs:attribute name="numerical" type="xs:int" use="required"/>
+ <xs:attribute name="android_type" type="xs:int" use="optional"/>
</xs:complexType>
<xs:complexType name="attributesRefType">
diff --git a/bluetooth/audio/2.1/default/BluetoothAudioProvidersFactory.cpp b/bluetooth/audio/2.1/default/BluetoothAudioProvidersFactory.cpp
index d7d5476..6e8c1d7 100644
--- a/bluetooth/audio/2.1/default/BluetoothAudioProvidersFactory.cpp
+++ b/bluetooth/audio/2.1/default/BluetoothAudioProvidersFactory.cpp
@@ -41,12 +41,8 @@
BluetoothAudioProvidersFactory::hearing_aid_provider_instance_;
LeAudioOutputAudioProvider
BluetoothAudioProvidersFactory::leaudio_output_provider_instance_;
-LeAudioOffloadOutputAudioProvider
- BluetoothAudioProvidersFactory::leaudio_offload_output_provider_instance_;
LeAudioInputAudioProvider
BluetoothAudioProvidersFactory::leaudio_input_provider_instance_;
-LeAudioOffloadInputAudioProvider
- BluetoothAudioProvidersFactory::leaudio_offload_input_provider_instance_;
Return<void> BluetoothAudioProvidersFactory::openProvider(
const V2_0::SessionType sessionType, openProvider_cb _hidl_cb) {
@@ -94,15 +90,9 @@
case SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH:
provider = &leaudio_output_provider_instance_;
break;
- case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
- provider = &leaudio_offload_output_provider_instance_;
- break;
case SessionType::LE_AUDIO_SOFTWARE_DECODED_DATAPATH:
provider = &leaudio_input_provider_instance_;
break;
- case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
- provider = &leaudio_offload_input_provider_instance_;
- break;
default:
status = BluetoothAudioStatus::FAILURE;
}
diff --git a/bluetooth/audio/2.1/default/BluetoothAudioProvidersFactory.h b/bluetooth/audio/2.1/default/BluetoothAudioProvidersFactory.h
index f8f557e..714d738 100644
--- a/bluetooth/audio/2.1/default/BluetoothAudioProvidersFactory.h
+++ b/bluetooth/audio/2.1/default/BluetoothAudioProvidersFactory.h
@@ -56,8 +56,6 @@
static HearingAidAudioProvider hearing_aid_provider_instance_;
static LeAudioOutputAudioProvider leaudio_output_provider_instance_;
static LeAudioInputAudioProvider leaudio_input_provider_instance_;
- static LeAudioOffloadOutputAudioProvider leaudio_offload_output_provider_instance_;
- static LeAudioOffloadInputAudioProvider leaudio_offload_input_provider_instance_;
};
extern "C" IBluetoothAudioProvidersFactory*
diff --git a/bluetooth/audio/2.2/IBluetoothAudioProvider.hal b/bluetooth/audio/2.2/IBluetoothAudioProvider.hal
index bc16b01..f577537 100644
--- a/bluetooth/audio/2.2/IBluetoothAudioProvider.hal
+++ b/bluetooth/audio/2.2/IBluetoothAudioProvider.hal
@@ -59,4 +59,14 @@
*/
startSession_2_2(IBluetoothAudioPort hostIf, AudioConfiguration audioConfig)
generates (Status status, fmq_sync<uint8_t> dataMQ);
+
+ /**
+ * Called when the audio configuration of the stream has been changed.
+ *
+ * @param audioConfig The audio configuration negotiated with the remote
+ * device. The PCM parameters are set if software based encoding,
+ * otherwise the correct codec configuration is used for hardware
+ * encoding.
+ */
+ updateAudioConfiguration(AudioConfiguration audioConfig);
};
diff --git a/bluetooth/audio/2.2/IBluetoothAudioProvidersFactory.hal b/bluetooth/audio/2.2/IBluetoothAudioProvidersFactory.hal
index 7fb5b6c..ae9c598 100644
--- a/bluetooth/audio/2.2/IBluetoothAudioProvidersFactory.hal
+++ b/bluetooth/audio/2.2/IBluetoothAudioProvidersFactory.hal
@@ -48,4 +48,26 @@
*/
openProvider_2_2(SessionType sessionType)
generates (Status status, IBluetoothAudioProvider provider);
+
+ /**
+ * Gets a list of audio capabilities for a session type.
+ *
+ * For software encoding, the PCM capabilities are returned.
+ * For hardware encoding, the supported codecs and their capabilities are
+ * returned.
+ *
+ * @param sessionType The session type (e.g.
+ * A2DP_SOFTWARE_ENCODING_DATAPATH).
+ * @return audioCapabilities A list containing all the capabilities
+ * supported by the sesson type. The capabilities is a list of
+ * available options when configuring the codec for the session.
+ * For software encoding it is the PCM data rate.
+ * For hardware encoding it is the list of supported codecs and their
+ * capabilities.
+ * If a provider isn't supported, an empty list should be returned.
+ * Note: Only one entry should exist per codec when using hardware
+ * encoding.
+ */
+ getProviderCapabilities_2_2(SessionType sessionType)
+ generates (vec<AudioCapabilities> audioCapabilities);
};
diff --git a/bluetooth/audio/2.2/default/BluetoothAudioProvider.cpp b/bluetooth/audio/2.2/default/BluetoothAudioProvider.cpp
index 18ac292..202cfb9 100644
--- a/bluetooth/audio/2.2/default/BluetoothAudioProvider.cpp
+++ b/bluetooth/audio/2.2/default/BluetoothAudioProvider.cpp
@@ -186,6 +186,29 @@
return Void();
}
+Return<void> BluetoothAudioProvider::updateAudioConfiguration(
+ const AudioConfiguration& audioConfig) {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_);
+
+ if (stack_iface_ == nullptr) {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
+ << " has NO session";
+ return Void();
+ }
+
+ if (audioConfig.getDiscriminator() != audio_config_.getDiscriminator()) {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
+ << " audio config type is not match";
+ return Void();
+ }
+
+ audio_config_ = audioConfig;
+ BluetoothAudioSessionReport_2_2::ReportAudioConfigChanged(session_type_,
+ audio_config_);
+
+ return Void();
+}
+
} // namespace implementation
} // namespace V2_2
} // namespace audio
diff --git a/bluetooth/audio/2.2/default/BluetoothAudioProvider.h b/bluetooth/audio/2.2/default/BluetoothAudioProvider.h
index 0f1f3c6..425ea3b 100644
--- a/bluetooth/audio/2.2/default/BluetoothAudioProvider.h
+++ b/bluetooth/audio/2.2/default/BluetoothAudioProvider.h
@@ -53,6 +53,8 @@
Return<void> streamStarted(BluetoothAudioStatus status) override;
Return<void> streamSuspended(BluetoothAudioStatus status) override;
Return<void> endSession() override;
+ Return<void> updateAudioConfiguration(
+ const AudioConfiguration& audioConfig) override;
protected:
sp<BluetoothAudioDeathRecipient> death_recipient_;
diff --git a/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.cpp b/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.cpp
index 51ee422..9435311 100644
--- a/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.cpp
+++ b/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.cpp
@@ -98,15 +98,9 @@
case V2_1::SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH:
provider = &leaudio_output_provider_instance_;
break;
- case V2_1::SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
- provider = &leaudio_offload_output_provider_instance_;
- break;
case V2_1::SessionType::LE_AUDIO_SOFTWARE_DECODED_DATAPATH:
provider = &leaudio_input_provider_instance_;
break;
- case V2_1::SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
- provider = &leaudio_offload_input_provider_instance_;
- break;
default:
status = BluetoothAudioStatus::FAILURE;
}
@@ -221,6 +215,47 @@
return Void();
}
+Return<void> BluetoothAudioProvidersFactory::getProviderCapabilities_2_2(
+ const V2_1::SessionType sessionType,
+ getProviderCapabilities_2_2_cb _hidl_cb) {
+ hidl_vec<V2_2::AudioCapabilities> audio_capabilities =
+ hidl_vec<V2_2::AudioCapabilities>(0);
+ if (sessionType == V2_1::SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH) {
+ std::vector<CodecCapabilities> db_codec_capabilities =
+ android::bluetooth::audio::GetOffloadCodecCapabilities(sessionType);
+ if (db_codec_capabilities.size()) {
+ audio_capabilities.resize(db_codec_capabilities.size());
+ for (int i = 0; i < db_codec_capabilities.size(); ++i) {
+ audio_capabilities[i].codecCapabilities(db_codec_capabilities[i]);
+ }
+ }
+ } else if (sessionType == V2_1::SessionType::
+ LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
+ sessionType == V2_1::SessionType::
+ LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
+ std::vector<LeAudioCodecCapabilitiesPair> db_codec_capabilities =
+ android::bluetooth::audio::GetLeAudioOffloadCodecCapabilities(
+ sessionType);
+ if (db_codec_capabilities.size()) {
+ audio_capabilities.resize(db_codec_capabilities.size());
+ for (int i = 0; i < db_codec_capabilities.size(); ++i) {
+ audio_capabilities[i].leAudioCapabilities(db_codec_capabilities[i]);
+ }
+ }
+ } else if (sessionType != V2_1::SessionType::UNKNOWN) {
+ std::vector<V2_1::PcmParameters> db_pcm_capabilities =
+ android::bluetooth::audio::GetSoftwarePcmCapabilities_2_1();
+ if (db_pcm_capabilities.size() == 1) {
+ audio_capabilities.resize(1);
+ audio_capabilities[0].pcmCapabilities(db_pcm_capabilities[0]);
+ }
+ }
+ LOG(INFO) << __func__ << " - SessionType=" << toString(sessionType)
+ << " supports " << audio_capabilities.size() << " codecs";
+ _hidl_cb(audio_capabilities);
+ return Void();
+}
+
IBluetoothAudioProvidersFactory* HIDL_FETCH_IBluetoothAudioProvidersFactory(
const char* /* name */) {
return new BluetoothAudioProvidersFactory();
diff --git a/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.h b/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.h
index 658249b..4f549d9 100644
--- a/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.h
+++ b/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.h
@@ -53,6 +53,10 @@
const V2_1::SessionType sessionType,
getProviderCapabilities_2_1_cb _hidl_cb) override;
+ Return<void> getProviderCapabilities_2_2(
+ const V2_1::SessionType sessionType,
+ getProviderCapabilities_2_2_cb _hidl_cb) override;
+
private:
static A2dpSoftwareAudioProvider a2dp_software_provider_instance_;
static A2dpOffloadAudioProvider a2dp_offload_provider_instance_;
diff --git a/bluetooth/audio/2.2/types.hal b/bluetooth/audio/2.2/types.hal
index d5f8a3f..8ec3660 100644
--- a/bluetooth/audio/2.2/types.hal
+++ b/bluetooth/audio/2.2/types.hal
@@ -19,6 +19,8 @@
import @2.1::Lc3Parameters;
import @2.1::PcmParameters;
import @2.0::CodecConfiguration;
+import @2.0::CodecCapabilities;
+import @2.1::CodecType;
enum LeAudioMode : uint8_t {
UNKNOWN = 0x00,
@@ -26,6 +28,12 @@
BROADCAST = 0x02,
};
+enum AudioLocation : uint8_t {
+ UNKNOWN = 0,
+ FRONT_LEFT = 1,
+ FRONT_RIGHT = 2,
+};
+
struct UnicastStreamMap {
/* The connection handle used for a unicast or a broadcast group. */
uint16_t streamHandle;
@@ -70,3 +78,37 @@
CodecConfiguration codecConfig;
LeAudioConfiguration leAudioConfig;
};
+
+/** Used to specify the capabilities of the different session types */
+safe_union AudioCapabilities {
+ PcmParameters pcmCapabilities;
+ CodecCapabilities codecCapabilities;
+ LeAudioCodecCapabilitiesPair leAudioCapabilities;
+};
+
+/**
+ * Used to specify th le audio capabilities pair of the Hardware offload encode and decode.
+ */
+struct LeAudioCodecCapabilitiesPair{
+ LeAudioMode mode;
+ LeAudioCodecCapability encodeCapability;
+ LeAudioCodecCapability decodeCapability;
+};
+
+/**
+ * Used to specify the le audio capabilities of the codecs supported by Hardware offload
+ * for encode or decode.
+ */
+struct LeAudioCodecCapability {
+ CodecType codecType;
+ AudioLocation supportedChannel;
+
+ // The number of connected device
+ uint8_t deviceCount;
+
+ // Supported channel count for each device
+ uint8_t channelCountPerDevice;
+
+ // Should use safe union when there is more than one codec
+ Lc3Parameters capabilities;
+};
diff --git a/bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_2.h b/bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_2.h
index 71ab464..368939e 100644
--- a/bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_2.h
+++ b/bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_2.h
@@ -48,20 +48,38 @@
std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
if (session_ptr != nullptr) {
- return session_ptr->GetAudioSession()->RegisterStatusCback(cbacks);
+ PortStatusCallbacks_2_2 cb = {
+ .control_result_cb_ = cbacks.control_result_cb_,
+ .session_changed_cb_ = cbacks.session_changed_cb_,
+ .audio_configuration_changed_cb_ = nullptr};
+ return session_ptr->RegisterStatusCback(cb);
+ }
+ return kObserversCookieUndefined;
+ }
+
+ // The control API helps the bluetooth_audio module to register
+ // PortStatusCallbacks_2_2
+ // @return: cookie - the assigned number to this bluetooth_audio output
+ static uint16_t RegisterControlResultCback(
+ const SessionType_2_1& session_type,
+ const PortStatusCallbacks_2_2& cbacks) {
+ std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
+ BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->RegisterStatusCback(cbacks);
}
return kObserversCookieUndefined;
}
// The control API helps the bluetooth_audio module to unregister
- // PortStatusCallbacks
+ // PortStatusCallbacks and PortStatusCallbacks_2_2
// @param: cookie - indicates which bluetooth_audio output is
static void UnregisterControlResultCback(const SessionType_2_1& session_type,
uint16_t cookie) {
std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
if (session_ptr != nullptr) {
- session_ptr->GetAudioSession()->UnregisterStatusCback(cookie);
+ session_ptr->UnregisterStatusCback(cookie);
}
}
diff --git a/bluetooth/audio/utils/session/BluetoothAudioSessionReport_2_2.h b/bluetooth/audio/utils/session/BluetoothAudioSessionReport_2_2.h
index 79121cc..17e140e 100644
--- a/bluetooth/audio/utils/session/BluetoothAudioSessionReport_2_2.h
+++ b/bluetooth/audio/utils/session/BluetoothAudioSessionReport_2_2.h
@@ -60,7 +60,20 @@
std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
if (session_ptr != nullptr) {
- session_ptr->GetAudioSession()->ReportControlStatus(start_resp, status);
+ session_ptr->ReportControlStatus(start_resp, status);
+ }
+ }
+ // The API reports the Bluetooth stack has replied the changed of the audio
+ // configuration, and will inform registered bluetooth_audio outputs
+ static void ReportAudioConfigChanged(
+ const ::android::hardware::bluetooth::audio::V2_1::SessionType&
+ session_type,
+ const ::android::hardware::bluetooth::audio::V2_2::AudioConfiguration&
+ audio_config) {
+ std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
+ BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ session_ptr->ReportAudioConfigChanged(audio_config);
}
}
};
diff --git a/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.cpp b/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.cpp
index db1619b..60ac4ec 100644
--- a/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.cpp
+++ b/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.cpp
@@ -359,7 +359,7 @@
audio_session->stack_iface_ = stack_iface;
LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_2_1_)
<< ", AudioConfiguration=" << toString(audio_config);
- audio_session->ReportSessionStatus();
+ ReportSessionStatus();
};
}
}
@@ -386,7 +386,150 @@
audio_session->stack_iface_ = nullptr;
audio_session->UpdateDataPath(nullptr);
if (toggled) {
+ ReportSessionStatus();
+ }
+}
+
+// The control function helps the bluetooth_audio module to register
+// PortStatusCallbacks_2_2
+// @return: cookie - the assigned number to this bluetooth_audio output
+uint16_t BluetoothAudioSession_2_2::RegisterStatusCback(
+ const PortStatusCallbacks_2_2& cbacks) {
+ if (session_type_2_1_ !=
+ SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH &&
+ session_type_2_1_ !=
+ SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
+ PortStatusCallbacks cb = {
+ .control_result_cb_ = cbacks.control_result_cb_,
+ .session_changed_cb_ = cbacks.session_changed_cb_};
+ return audio_session->RegisterStatusCback(cb);
+ }
+
+ std::lock_guard<std::recursive_mutex> guard(audio_session->mutex_);
+ uint16_t cookie = ObserversCookieGetInitValue(session_type_2_1_);
+ uint16_t cookie_upper_bound = ObserversCookieGetUpperBound(session_type_2_1_);
+
+ while (cookie < cookie_upper_bound) {
+ if (observers_.find(cookie) == observers_.end()) {
+ break;
+ }
+ ++cookie;
+ }
+ if (cookie >= cookie_upper_bound) {
+ LOG(ERROR) << __func__ << " - SessionType=" << toString(session_type_2_1_)
+ << " has " << observers_.size()
+ << " observers already (No Resource)";
+ return kObserversCookieUndefined;
+ }
+ std::shared_ptr<struct PortStatusCallbacks_2_2> cb =
+ std::make_shared<struct PortStatusCallbacks_2_2>();
+ *cb = cbacks;
+ observers_[cookie] = cb;
+ return cookie;
+}
+
+// The control function helps the bluetooth_audio module to unregister
+// PortStatusCallbacks_2_2
+// @param: cookie - indicates which bluetooth_audio output is
+void BluetoothAudioSession_2_2::UnregisterStatusCback(uint16_t cookie) {
+ std::lock_guard<std::recursive_mutex> guard(audio_session->mutex_);
+ if (session_type_2_1_ !=
+ SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH &&
+ session_type_2_1_ !=
+ SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
+ audio_session->UnregisterStatusCback(cookie);
+ return;
+ }
+ if (observers_.erase(cookie) != 1) {
+ LOG(WARNING) << __func__ << " - SessionType=" << toString(session_type_2_1_)
+ << " no such provider=0x"
+ << android::base::StringPrintf("%04x", cookie);
+ }
+}
+
+// invoking the registered session_changed_cb_
+void BluetoothAudioSession_2_2::ReportSessionStatus() {
+ // This is locked already by OnSessionStarted / OnSessionEnded
+ if (session_type_2_1_ !=
+ SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH &&
+ session_type_2_1_ !=
+ SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
audio_session->ReportSessionStatus();
+ return;
+ }
+ if (observers_.empty()) {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_2_1_)
+ << " has NO port state observer";
+ return;
+ }
+ for (auto& observer : observers_) {
+ uint16_t cookie = observer.first;
+ std::shared_ptr<struct PortStatusCallbacks_2_2> cb = observer.second;
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_2_1_)
+ << " notify to bluetooth_audio=0x"
+ << android::base::StringPrintf("%04x", cookie);
+ cb->session_changed_cb_(cookie);
+ }
+}
+
+// The report function is used to report that the Bluetooth stack has notified
+// the result of startStream or suspendStream, and will invoke
+// control_result_cb_ to notify registered bluetooth_audio outputs
+void BluetoothAudioSession_2_2::ReportControlStatus(
+ bool start_resp, const BluetoothAudioStatus& status) {
+ if (session_type_2_1_ !=
+ SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH &&
+ session_type_2_1_ !=
+ SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
+ audio_session->ReportControlStatus(start_resp, status);
+ return;
+ }
+ std::lock_guard<std::recursive_mutex> guard(audio_session->mutex_);
+ if (observers_.empty()) {
+ LOG(WARNING) << __func__ << " - SessionType=" << toString(session_type_2_1_)
+ << " has NO port state observer";
+ return;
+ }
+ for (auto& observer : observers_) {
+ uint16_t cookie = observer.first;
+ std::shared_ptr<struct PortStatusCallbacks_2_2> cb = observer.second;
+ LOG(INFO) << __func__ << " - status=" << toString(status)
+ << " for SessionType=" << toString(session_type_2_1_)
+ << ", bluetooth_audio=0x"
+ << android::base::StringPrintf("%04x", cookie)
+ << (start_resp ? " started" : " suspended");
+ cb->control_result_cb_(cookie, start_resp, status);
+ }
+}
+
+// The report function is used to report that the Bluetooth stack has notified
+// the result of startStream or suspendStream, and will invoke
+// control_result_cb_ to notify registered bluetooth_audio outputs
+void BluetoothAudioSession_2_2::ReportAudioConfigChanged(
+ const ::android::hardware::bluetooth::audio::V2_2::AudioConfiguration&
+ audio_config) {
+ if (session_type_2_1_ !=
+ SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH &&
+ session_type_2_1_ !=
+ SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
+ return;
+ }
+ std::lock_guard<std::recursive_mutex> guard(audio_session->mutex_);
+ audio_config_2_2_ = audio_config;
+ if (observers_.empty()) {
+ LOG(WARNING) << __func__ << " - SessionType=" << toString(session_type_2_1_)
+ << " has NO port state observer";
+ return;
+ }
+ for (auto& observer : observers_) {
+ uint16_t cookie = observer.first;
+ std::shared_ptr<struct PortStatusCallbacks_2_2> cb = observer.second;
+ LOG(INFO) << __func__ << " for SessionType=" << toString(session_type_2_1_)
+ << ", bluetooth_audio=0x"
+ << android::base::StringPrintf("%04x", cookie);
+ if (cb->audio_configuration_changed_cb_ != nullptr) {
+ cb->audio_configuration_changed_cb_(cookie);
+ }
}
}
diff --git a/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.h b/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.h
index 6ac0188..3673fd8 100644
--- a/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.h
+++ b/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.h
@@ -28,6 +28,40 @@
namespace bluetooth {
namespace audio {
+inline uint16_t ObserversCookieGetInitValue(
+ const ::android::hardware::bluetooth::audio::V2_1::SessionType&
+ session_type) {
+ return (static_cast<uint16_t>(session_type) << 8 & 0xff00);
+}
+inline uint16_t ObserversCookieGetUpperBound(
+ const ::android::hardware::bluetooth::audio::V2_1::SessionType&
+ session_type) {
+ return (static_cast<uint16_t>(session_type) << 8 & 0xff00) +
+ kObserversCookieSize;
+}
+
+struct PortStatusCallbacks_2_2 {
+ // control_result_cb_ - when the Bluetooth stack reports results of
+ // streamStarted or streamSuspended, the BluetoothAudioProvider will invoke
+ // this callback to report to the bluetooth_audio module.
+ // @param: cookie - indicates which bluetooth_audio output should handle
+ // @param: start_resp - this report is for startStream or not
+ // @param: status - the result of startStream
+ std::function<void(uint16_t cookie, bool start_resp,
+ const BluetoothAudioStatus& status)>
+ control_result_cb_;
+ // session_changed_cb_ - when the Bluetooth stack start / end session, the
+ // BluetoothAudioProvider will invoke this callback to notify to the
+ // bluetooth_audio module.
+ // @param: cookie - indicates which bluetooth_audio output should handle
+ std::function<void(uint16_t cookie)> session_changed_cb_;
+ // audio_configuration_changed_cb_ - when the Bluetooth stack change the audio
+ // configuration, the BluetoothAudioProvider will invoke this callback to
+ // notify to the bluetooth_audio module.
+ // @param: cookie - indicates which bluetooth_audio output should handle
+ std::function<void(uint16_t cookie)> audio_configuration_changed_cb_;
+};
+
class BluetoothAudioSession_2_2 {
private:
std::shared_ptr<BluetoothAudioSession> audio_session;
@@ -50,6 +84,13 @@
static ::android::hardware::bluetooth::audio::V2_2::AudioConfiguration
invalidLeOffloadAudioConfiguration;
+ // saving those registered bluetooth_audio's callbacks
+ std::unordered_map<uint16_t, std::shared_ptr<struct PortStatusCallbacks_2_2>>
+ observers_;
+
+ // invoking the registered session_changed_cb_
+ void ReportSessionStatus();
+
public:
BluetoothAudioSession_2_2(
const ::android::hardware::bluetooth::audio::V2_1::SessionType&
@@ -82,6 +123,29 @@
bool SuspendStream();
void StopStream();
+ // The control function helps the bluetooth_audio module to register
+ // PortStatusCallbacks_2_2
+ // @return: cookie - the assigned number to this bluetooth_audio output
+ uint16_t RegisterStatusCback(const PortStatusCallbacks_2_2& cbacks);
+
+ // The control function helps the bluetooth_audio module to unregister
+ // PortStatusCallbacks_2_2
+ // @param: cookie - indicates which bluetooth_audio output is
+ void UnregisterStatusCback(uint16_t cookie);
+
+ // The report function is used to report that the Bluetooth stack has notified
+ // the result of startStream or suspendStream, and will invoke
+ // control_result_cb_ to notify registered bluetooth_audio outputs
+ void ReportControlStatus(bool start_resp, const BluetoothAudioStatus& status);
+
+ // The report function is used to report that the Bluetooth stack has notified
+ // the audio configuration changed, and will invoke
+ // audio_configuration_changed_cb_ to notify registered bluetooth_audio
+ // outputs
+ void ReportAudioConfigChanged(
+ const ::android::hardware::bluetooth::audio::V2_2::AudioConfiguration&
+ audio_config);
+
// The control function is for the bluetooth_audio module to get the current
// AudioConfiguration
const ::android::hardware::bluetooth::audio::V2_2::AudioConfiguration
diff --git a/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.cpp b/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.cpp
index 5becdaa..34cfd7e 100644
--- a/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.cpp
+++ b/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.cpp
@@ -24,9 +24,59 @@
namespace bluetooth {
namespace audio {
+using ::android::hardware::bluetooth::audio::V2_0::BitsPerSample;
+using ::android::hardware::bluetooth::audio::V2_1::CodecType;
+using ::android::hardware::bluetooth::audio::V2_1::Lc3FrameDuration;
+using ::android::hardware::bluetooth::audio::V2_1::Lc3Parameters;
+using ::android::hardware::bluetooth::audio::V2_1::SampleRate;
+using ::android::hardware::bluetooth::audio::V2_2::AudioLocation;
+using ::android::hardware::bluetooth::audio::V2_2::LeAudioCodecCapabilitiesPair;
+using ::android::hardware::bluetooth::audio::V2_2::LeAudioCodecCapability;
+using ::android::hardware::bluetooth::audio::V2_2::LeAudioMode;
using SessionType_2_1 =
::android::hardware::bluetooth::audio::V2_1::SessionType;
+// Stores the list of offload supported capability
+std::vector<LeAudioCodecCapabilitiesPair> kDefaultOffloadLeAudioCapabilities;
+
+static const LeAudioCodecCapability kInvalidLc3Capability = {
+ .codecType = CodecType::UNKNOWN};
+
+// Default Supported Codecs
+// LC3 16_1: sample rate: 16 kHz, frame duration: 7.5 ms, octets per frame: 30
+static const Lc3Parameters kLc3Capability_16_1 = {
+ .samplingFrequency = SampleRate::RATE_16000,
+ .frameDuration = Lc3FrameDuration::DURATION_7500US,
+ .octetsPerFrame = 30};
+
+// Default Supported Codecs
+// LC3 16_2: sample rate: 16 kHz, frame duration: 10 ms, octets per frame: 40
+static const Lc3Parameters kLc3Capability_16_2 = {
+ .samplingFrequency = SampleRate::RATE_16000,
+ .frameDuration = Lc3FrameDuration::DURATION_10000US,
+ .octetsPerFrame = 40};
+
+// Default Supported Codecs
+// LC3 48_4: sample rate: 48 kHz, frame duration: 10 ms, octets per frame: 120
+static const Lc3Parameters kLc3Capability_48_4 = {
+ .samplingFrequency = SampleRate::RATE_48000,
+ .frameDuration = Lc3FrameDuration::DURATION_10000US,
+ .octetsPerFrame = 120};
+
+static const std::vector<Lc3Parameters> supportedLc3CapabilityList = {
+ kLc3Capability_48_4, kLc3Capability_16_2, kLc3Capability_16_1};
+
+static AudioLocation stereoAudio = static_cast<AudioLocation>(
+ AudioLocation::FRONT_LEFT | AudioLocation::FRONT_RIGHT);
+static AudioLocation monoAudio = AudioLocation::UNKNOWN;
+
+// Stores the supported setting of audio location, connected device, and the
+// channel count for each device
+std::vector<std::tuple<AudioLocation, uint8_t, uint8_t>>
+ supportedDeviceSetting = {std::make_tuple(stereoAudio, 2, 1),
+ std::make_tuple(monoAudio, 1, 2),
+ std::make_tuple(monoAudio, 1, 1)};
+
bool IsOffloadLeAudioConfigurationValid(
const ::android::hardware::bluetooth::audio::V2_1::SessionType&
session_type,
@@ -44,6 +94,60 @@
return true;
}
+LeAudioCodecCapability composeLc3Capability(AudioLocation audioLocation,
+ uint8_t deviceCnt,
+ uint8_t channelCount,
+ Lc3Parameters capability) {
+ return LeAudioCodecCapability{.codecType = CodecType::LC3,
+ .supportedChannel = audioLocation,
+ .deviceCount = deviceCnt,
+ .channelCountPerDevice = channelCount,
+ .capabilities = capability};
+}
+
+std::vector<LeAudioCodecCapabilitiesPair> GetLeAudioOffloadCodecCapabilities(
+ const SessionType_2_1& session_type) {
+ if (session_type !=
+ SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH &&
+ session_type !=
+ SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
+ return std::vector<LeAudioCodecCapabilitiesPair>(0);
+ }
+
+ if (kDefaultOffloadLeAudioCapabilities.empty()) {
+ for (auto [audioLocation, deviceCnt, channelCount] :
+ supportedDeviceSetting) {
+ for (auto capability : supportedLc3CapabilityList) {
+ LeAudioCodecCapability lc3Capability = composeLc3Capability(
+ audioLocation, deviceCnt, channelCount, capability);
+ LeAudioCodecCapability lc3MonoCapability =
+ composeLc3Capability(monoAudio, 1, 1, capability);
+
+ // Adds the capability for encode only
+ kDefaultOffloadLeAudioCapabilities.push_back(
+ {.mode = LeAudioMode::UNICAST,
+ .encodeCapability = lc3Capability,
+ .decodeCapability = kInvalidLc3Capability});
+
+ // Adds the capability for decode only
+ kDefaultOffloadLeAudioCapabilities.push_back(
+ {.mode = LeAudioMode::UNICAST,
+ .encodeCapability = kInvalidLc3Capability,
+ .decodeCapability = lc3Capability});
+
+ // Adds the capability for the case that encode and decode exist at the
+ // same time
+ kDefaultOffloadLeAudioCapabilities.push_back(
+ {.mode = LeAudioMode::UNICAST,
+ .encodeCapability = lc3Capability,
+ .decodeCapability = lc3MonoCapability});
+ }
+ }
+ }
+
+ return kDefaultOffloadLeAudioCapabilities;
+}
+
} // namespace audio
} // namespace bluetooth
} // namespace android
diff --git a/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.h b/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.h
index 8321616..89da6a3 100644
--- a/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.h
+++ b/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.h
@@ -30,6 +30,11 @@
session_type,
const ::android::hardware::bluetooth::audio::V2_2::LeAudioConfiguration&
le_audio_codec_config);
+
+std::vector<hardware::bluetooth::audio::V2_2::LeAudioCodecCapabilitiesPair>
+GetLeAudioOffloadCodecCapabilities(
+ const ::android::hardware::bluetooth::audio::V2_1::SessionType&
+ session_type);
} // namespace audio
} // namespace bluetooth
} // namespace android
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 01ec9cb..d39850d 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -667,7 +667,7 @@
void waitForBuffersReturned();
- private:
+ private:
bool processCaptureResultLocked(const CaptureResult& results,
hidl_vec<PhysicalCameraMetadata> physicalCameraMetadata);
Return<void> notifyHelper(const hidl_vec<NotifyMsg>& msgs,
@@ -907,7 +907,7 @@
static Status getMandatoryConcurrentStreams(const camera_metadata_t* staticMeta,
std::vector<AvailableStream>* outputStreams);
-
+ static bool supportsPreviewStabilization(const std::string& name, sp<ICameraProvider> provider);
static Status getJpegBufferSize(camera_metadata_t *staticMeta,
uint32_t* outBufSize);
static Status isConstrainedModeAvailable(camera_metadata_t *staticMeta);
@@ -955,6 +955,9 @@
void processCaptureRequestInternal(uint64_t bufferusage, RequestTemplate reqTemplate,
bool useSecureOnlyCameras);
+ void processPreviewStabilizationCaptureRequestInternal(
+ bool previewStabilizationOn,
+ /*inout*/ std::unordered_map<std::string, nsecs_t>& cameraDeviceToTimeLag);
// Used by switchToOffline where a new result queue is created for offline reqs
void updateInflightResultQueue(std::shared_ptr<ResultMetadataQueue> resultQueue);
@@ -1008,7 +1011,11 @@
// Buffers are added by process_capture_result when output buffers
// return from HAL but framework.
- ::android::Vector<StreamBuffer> resultOutputBuffers;
+ struct StreamBufferAndTimestamp {
+ StreamBuffer buffer;
+ nsecs_t timeStamp;
+ };
+ ::android::Vector<StreamBufferAndTimestamp> resultOutputBuffers;
std::unordered_set<std::string> expectedPhysicalResults;
@@ -1423,8 +1430,25 @@
return notify;
}
- request->resultOutputBuffers.appendArray(results.outputBuffers.data(),
- results.outputBuffers.size());
+ for (const auto& buffer : results.outputBuffers) {
+ // wait for the fence timestamp and store it along with the buffer
+ // TODO: Check if we really need the dup here
+ sp<android::Fence> releaseFence = nullptr;
+ if (buffer.releaseFence && (buffer.releaseFence->numFds == 1) &&
+ buffer.releaseFence->data[0] >= 0) {
+ releaseFence = new android::Fence(dup(buffer.releaseFence->data[0]));
+ }
+ InFlightRequest::StreamBufferAndTimestamp streamBufferAndTimestamp;
+ streamBufferAndTimestamp.buffer = buffer;
+ streamBufferAndTimestamp.timeStamp = systemTime();
+ if (releaseFence && releaseFence->isValid()) {
+ releaseFence->wait(/*ms*/ 300);
+ nsecs_t releaseTime = releaseFence->getSignalTime();
+ if (streamBufferAndTimestamp.timeStamp < releaseTime)
+ streamBufferAndTimestamp.timeStamp = releaseTime;
+ }
+ request->resultOutputBuffers.push_back(streamBufferAndTimestamp);
+ }
// If shutter event is received notify the pending threads.
if (request->shutterTimestamp != 0) {
notify = true;
@@ -4926,7 +4950,7 @@
ASSERT_FALSE(inflightReq.errorCodeValid);
ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
- ASSERT_EQ(testStream.id, inflightReq.resultOutputBuffers[0].streamId);
+ ASSERT_EQ(testStream.id, inflightReq.resultOutputBuffers[0].buffer.streamId);
// For camera device 3.8 or newer, shutterReadoutTimestamp must be
// available, and it must be >= shutterTimestamp + exposureTime, and
@@ -4986,7 +5010,197 @@
ASSERT_FALSE(inflightReq.errorCodeValid);
ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
- ASSERT_EQ(testStream.id, inflightReq.resultOutputBuffers[0].streamId);
+ ASSERT_EQ(testStream.id, inflightReq.resultOutputBuffers[0].buffer.streamId);
+ }
+
+ if (useHalBufManager) {
+ verifyBuffersReturned(session, deviceVersion, testStream.id, cb);
+ }
+
+ ret = session->close();
+ ASSERT_TRUE(ret.isOk());
+ }
+}
+
+TEST_P(CameraHidlTest, processCaptureRequestPreviewStabilization) {
+ std::unordered_map<std::string, nsecs_t> cameraDeviceToTimeLag;
+ processPreviewStabilizationCaptureRequestInternal(/*previewStabilizationOn*/ false,
+ cameraDeviceToTimeLag);
+ processPreviewStabilizationCaptureRequestInternal(/*previewStabilizationOn*/ true,
+ cameraDeviceToTimeLag);
+}
+
+void CameraHidlTest::processPreviewStabilizationCaptureRequestInternal(
+ bool previewStabilizationOn,
+ // Used as output when preview stabilization is off, as output when its
+ // on.
+ std::unordered_map<std::string, nsecs_t>& cameraDeviceToTimeLag) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+ AvailableStream streamThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+ static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
+ uint64_t bufferId = 1;
+ uint32_t frameNumber = 1;
+ ::android::hardware::hidl_vec<uint8_t> settings;
+
+ for (const auto& name : cameraDeviceNames) {
+ int deviceVersion = getCameraDeviceVersion(name, mProviderType);
+ if (deviceVersion == CAMERA_DEVICE_API_VERSION_1_0) {
+ continue;
+ } else if (deviceVersion <= 0) {
+ ALOGE("%s: Unsupported device version %d", __func__, deviceVersion);
+ ADD_FAILURE();
+ return;
+ }
+
+ if (!supportsPreviewStabilization(name, mProvider)) {
+ ALOGI(" %s Camera device %s doesn't support preview stabilization, skipping", __func__,
+ name.c_str());
+ continue;
+ }
+
+ if (deviceVersion < CAMERA_DEVICE_API_VERSION_3_8) {
+ ALOGE("%s: device version < 3.8 must not advertise preview stabilization,"
+ " camera metadata validation will fail",
+ __func__);
+ ADD_FAILURE();
+ }
+
+ V3_2::Stream testStream;
+ HalStreamConfiguration halStreamConfig;
+ sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
+ bool supportsPartialResults = false;
+ bool useHalBufManager = false;
+ uint32_t partialResultCount = 0;
+ configureSingleStream(name, deviceVersion, mProvider, &streamThreshold,
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, RequestTemplate::PREVIEW,
+ &session /*out*/, &testStream /*out*/, &halStreamConfig /*out*/,
+ &supportsPartialResults /*out*/, &partialResultCount /*out*/,
+ &useHalBufManager /*out*/, &cb /*out*/);
+
+ std::shared_ptr<ResultMetadataQueue> resultQueue;
+ auto resultQueueRet =
+ session->getCaptureResultMetadataQueue([&resultQueue](const auto& descriptor) {
+ resultQueue = std::make_shared<ResultMetadataQueue>(descriptor);
+ if (!resultQueue->isValid() || resultQueue->availableToWrite() <= 0) {
+ ALOGE("%s: HAL returns empty result metadata fmq,"
+ " not use it",
+ __func__);
+ resultQueue = nullptr;
+ // Don't use the queue onwards.
+ }
+ });
+ ASSERT_TRUE(resultQueueRet.isOk());
+
+ InFlightRequest inflightReq = {1, false, supportsPartialResults, partialResultCount,
+ resultQueue};
+
+ Return<void> ret;
+ android::hardware::camera::common::V1_0::helper::CameraMetadata defaultSettings;
+ ret = session->constructDefaultRequestSettings(
+ RequestTemplate::PREVIEW, [&](auto status, const auto& req) {
+ ASSERT_EQ(Status::OK, status);
+ const camera_metadata_t* metadata =
+ reinterpret_cast<const camera_metadata_t*>(req.data());
+ defaultSettings = metadata;
+ settings = req;
+ });
+ ASSERT_TRUE(ret.isOk());
+ android::status_t metadataRet = ::android::OK;
+ uint8_t videoStabilizationMode = ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF;
+ if (previewStabilizationOn) {
+ videoStabilizationMode = ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION;
+ metadataRet = defaultSettings.update(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE,
+ &videoStabilizationMode, 1);
+ } else {
+ metadataRet = defaultSettings.update(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE,
+ &videoStabilizationMode, 1);
+ }
+ ASSERT_EQ(metadataRet, ::android::OK);
+ hidl_handle buffer_handle;
+ StreamBuffer outputBuffer;
+ if (useHalBufManager) {
+ outputBuffer = {halStreamConfig.streams[0].id,
+ /*bufferId*/ 0,
+ buffer_handle,
+ BufferStatus::OK,
+ nullptr,
+ nullptr};
+ } else {
+ allocateGraphicBuffer(
+ testStream.width, testStream.height,
+ /* We don't look at halStreamConfig.streams[0].consumerUsage
+ * since that is 0 for output streams
+ */
+ android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER),
+ halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+ outputBuffer = {halStreamConfig.streams[0].id,
+ bufferId,
+ buffer_handle,
+ BufferStatus::OK,
+ nullptr,
+ nullptr};
+ }
+ ::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {outputBuffer};
+ StreamBuffer emptyInputBuffer = {-1, 0, nullptr, BufferStatus::ERROR, nullptr, nullptr};
+ CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */, settings, emptyInputBuffer,
+ outputBuffers};
+
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ mInflightMap.clear();
+ mInflightMap.add(frameNumber, &inflightReq);
+ }
+
+ Status status = Status::INTERNAL_ERROR;
+ uint32_t numRequestProcessed = 0;
+ hidl_vec<BufferCache> cachesToRemove;
+ Return<void> returnStatus = session->processCaptureRequest(
+ {request}, cachesToRemove, [&status, &numRequestProcessed](auto s, uint32_t n) {
+ status = s;
+ numRequestProcessed = n;
+ });
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_EQ(numRequestProcessed, 1u);
+
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ while (!inflightReq.errorCodeValid &&
+ ((0 < inflightReq.numBuffersLeft) || (!inflightReq.haveResultMetadata))) {
+ auto timeout = std::chrono::system_clock::now() +
+ std::chrono::seconds(kStreamBufferTimeoutSec);
+ ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout));
+ }
+
+ ASSERT_FALSE(inflightReq.errorCodeValid);
+ ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
+ ASSERT_EQ(testStream.id, inflightReq.resultOutputBuffers[0].buffer.streamId);
+ ASSERT_TRUE(inflightReq.shutterReadoutTimestampValid);
+ nsecs_t readoutTimestamp = inflightReq.shutterReadoutTimestamp;
+
+ if (previewStabilizationOn) {
+ // Here we collect the time difference between the buffer ready
+ // timestamp - notify readout timestamp.
+ // timeLag = buffer ready timestamp - notify readout timestamp.
+ // timeLag(previewStabilization) must be <=
+ // timeLag(stabilization off) + 1 frame duration.
+ auto it = cameraDeviceToTimeLag.find(name.c_str());
+ camera_metadata_entry e;
+ e = inflightReq.collectedResult.find(ANDROID_SENSOR_FRAME_DURATION);
+ ASSERT_TRUE(e.count > 0);
+ nsecs_t frameDuration = e.data.i64[0];
+ ASSERT_TRUE(it != cameraDeviceToTimeLag.end());
+
+ nsecs_t previewStabOnLagTime =
+ inflightReq.resultOutputBuffers[0].timeStamp - readoutTimestamp;
+ ASSERT_TRUE(previewStabOnLagTime <= (it->second + frameDuration));
+ } else {
+ // Fill in the buffer ready timestamp - notify timestamp;
+ cameraDeviceToTimeLag[std::string(name.c_str())] =
+ inflightReq.resultOutputBuffers[0].timeStamp - readoutTimestamp;
+ }
}
if (useHalBufManager) {
@@ -5567,7 +5781,7 @@
ASSERT_FALSE(inflightReqs[i].errorCodeValid);
ASSERT_NE(inflightReqs[i].resultOutputBuffers.size(), 0u);
- ASSERT_EQ(previewStream.id, inflightReqs[i].resultOutputBuffers[0].streamId);
+ ASSERT_EQ(previewStream.id, inflightReqs[i].resultOutputBuffers[0].buffer.streamId);
ASSERT_FALSE(inflightReqs[i].collectedResult.isEmpty());
ASSERT_TRUE(inflightReqs[i].collectedResult.exists(ANDROID_SENSOR_SENSITIVITY));
camera_metadata_entry_t isoResult = inflightReqs[i].collectedResult.find(
@@ -5851,7 +6065,7 @@
ASSERT_FALSE(inflightReqs[i].errorCodeValid);
ASSERT_NE(inflightReqs[i].resultOutputBuffers.size(), 0u);
- ASSERT_EQ(stream.id, inflightReqs[i].resultOutputBuffers[0].streamId);
+ ASSERT_EQ(stream.id, inflightReqs[i].resultOutputBuffers[0].buffer.streamId);
ASSERT_FALSE(inflightReqs[i].collectedResult.isEmpty());
}
@@ -6047,7 +6261,7 @@
if (!inflightReq.errorCodeValid) {
ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
- ASSERT_EQ(previewStream.id, inflightReq.resultOutputBuffers[0].streamId);
+ ASSERT_EQ(previewStream.id, inflightReq.resultOutputBuffers[0].buffer.streamId);
} else {
switch (inflightReq.errorCode) {
case ErrorCode::ERROR_REQUEST:
@@ -7685,6 +7899,47 @@
previewStream, halStreamConfig, supportsPartialResults,
partialResultCount, useHalBufManager, outCb, streamConfigCounter);
}
+
+bool CameraHidlTest::supportsPreviewStabilization(const std::string& name,
+ sp<ICameraProvider> provider) {
+ Return<void> ret;
+ sp<ICameraDevice> device3_x = nullptr;
+ ret = provider->getCameraDeviceInterface_V3_x(name, [&](auto status, const auto& device) {
+ ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(device, nullptr);
+ device3_x = device;
+ });
+ if (!(ret.isOk())) {
+ ADD_FAILURE() << "Failed to get camera device interface for " << name;
+ }
+
+ camera_metadata_t* staticMeta = nullptr;
+ ret = device3_x->getCameraCharacteristics([&](Status s, CameraMetadata metadata) {
+ ASSERT_EQ(Status::OK, s);
+ staticMeta =
+ clone_camera_metadata(reinterpret_cast<const camera_metadata_t*>(metadata.data()));
+ });
+ if (!(ret.isOk())) {
+ ADD_FAILURE() << "Failed to get camera characteristics for " << name;
+ }
+ // Go through the characteristics and see if video stabilization modes have
+ // preview stabilization
+ camera_metadata_ro_entry entry;
+
+ int retcode = find_camera_metadata_ro_entry(
+ staticMeta, ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES, &entry);
+ if ((0 == retcode) && (entry.count > 0)) {
+ for (auto i = 0; i < entry.count; i++) {
+ if (entry.data.u8[i] ==
+ ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
// Open a device session and configure a preview stream.
void CameraHidlTest::configureSingleStream(
const std::string& name, int32_t deviceVersion, sp<ICameraProvider> provider,
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 2f3e523..c847ea3 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -252,6 +252,14 @@
<instance>default</instance>
</interface>
</hal>
+ <hal format="aidl" optional="true">
+ <name>android.hardware.gnss.visibility_control</name>
+ <version>1</version>
+ <interface>
+ <name>IGnssVisibilityControl</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
<hal format="hidl" optional="false">
<name>android.hardware.graphics.allocator</name>
<!-- New, non-Go devices should use 4.0, tested in vts_treble_vintf_vendor_test -->
diff --git a/dumpstate/aidl/Android.bp b/dumpstate/aidl/Android.bp
index e18eade..22d836b 100644
--- a/dumpstate/aidl/Android.bp
+++ b/dumpstate/aidl/Android.bp
@@ -34,7 +34,6 @@
enabled: false,
},
ndk: {
- separate_platform_variant: false,
vndk: {
enabled: true,
},
diff --git a/gnss/aidl/Android.bp b/gnss/aidl/Android.bp
index b197eae..12dd0ac 100644
--- a/gnss/aidl/Android.bp
+++ b/gnss/aidl/Android.bp
@@ -24,9 +24,27 @@
}
aidl_interface {
+ name: "android.hardware.gnss.visibility_control",
+ vendor_available: true,
+ srcs: ["android/hardware/gnss/visibility_control/*.aidl"],
+ stability: "vintf",
+ backend: {
+ java: {
+ platform_apis: true,
+ },
+ ndk: {
+ vndk: {
+ enabled: true,
+ },
+ },
+ },
+}
+
+aidl_interface {
name: "android.hardware.gnss",
vendor_available: true,
srcs: ["android/hardware/gnss/*.aidl"],
+ imports: ["android.hardware.gnss.visibility_control"],
stability: "vintf",
backend: {
java: {
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/HandleIndex.aidl b/gnss/aidl/aidl_api/android.hardware.gnss.visibility_control/current/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl
similarity index 80%
rename from graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/HandleIndex.aidl
rename to gnss/aidl/aidl_api/android.hardware.gnss.visibility_control/current/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl
index b87870d..7ef08d2 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/HandleIndex.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss.visibility_control/current/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl
@@ -1,11 +1,11 @@
-/**
- * Copyright (c) 2021, The Android Open Source Project
+/*
+ * Copyright (C) 2021 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
+ * 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,
@@ -31,9 +31,9 @@
// 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.graphics.composer3;
-@Backing(type="int") @VintfStability
-enum HandleIndex {
- EMPTY = -1,
- CACHED = -2,
+package android.hardware.gnss.visibility_control;
+@VintfStability
+interface IGnssVisibilityControl {
+ void enableNfwLocationAccess(in String[] proxyApps);
+ void setCallback(in android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback callback);
}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss.visibility_control/current/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss.visibility_control/current/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl
new file mode 100644
index 0000000..37e1886
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss.visibility_control/current/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2021 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 <name>-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.gnss.visibility_control;
+@VintfStability
+interface IGnssVisibilityControlCallback {
+ void nfwNotifyCb(in android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwNotification notification);
+ boolean isInEmergencySession();
+ @Backing(type="int") @VintfStability
+ enum NfwProtocolStack {
+ CTRL_PLANE = 0,
+ SUPL = 1,
+ IMS = 10,
+ SIM = 11,
+ OTHER_PROTOCOL_STACK = 100,
+ }
+ @Backing(type="int") @VintfStability
+ enum NfwRequestor {
+ CARRIER = 0,
+ OEM = 10,
+ MODEM_CHIPSET_VENDOR = 11,
+ GNSS_CHIPSET_VENDOR = 12,
+ OTHER_CHIPSET_VENDOR = 13,
+ AUTOMOBILE_CLIENT = 20,
+ OTHER_REQUESTOR = 100,
+ }
+ @Backing(type="int") @VintfStability
+ enum NfwResponseType {
+ REJECTED = 0,
+ ACCEPTED_NO_LOCATION_PROVIDED = 1,
+ ACCEPTED_LOCATION_PROVIDED = 2,
+ }
+ @VintfStability
+ parcelable NfwNotification {
+ String proxyAppPackageName;
+ android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwProtocolStack protocolStack;
+ String otherProtocolStackName;
+ android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwRequestor requestor;
+ String requestorId;
+ android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwResponseType responseType;
+ boolean inEmergencyMode;
+ boolean isCachedLocation;
+ }
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl
index 9df7fe5..3477380 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl
@@ -45,6 +45,7 @@
@nullable android.hardware.gnss.IGnssNavigationMessageInterface getExtensionGnssNavigationMessage();
android.hardware.gnss.IAGnss getExtensionAGnss();
android.hardware.gnss.IGnssDebug getExtensionGnssDebug();
+ android.hardware.gnss.visibility_control.IGnssVisibilityControl getExtensionGnssVisibilityControl();
const int ERROR_INVALID_ARGUMENT = 1;
const int ERROR_ALREADY_INIT = 2;
const int ERROR_GENERIC = 3;
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementInterface.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementInterface.aidl
index 24d6f9c..9c4a54b 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementInterface.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementInterface.aidl
@@ -36,4 +36,11 @@
interface IGnssMeasurementInterface {
void setCallback(in android.hardware.gnss.IGnssMeasurementCallback callback, in boolean enableFullTracking, in boolean enableCorrVecOutputs);
void close();
+ void setCallbackWithOptions(in android.hardware.gnss.IGnssMeasurementCallback callback, in android.hardware.gnss.IGnssMeasurementInterface.Options options);
+ @VintfStability
+ parcelable Options {
+ boolean enableFullTracking;
+ boolean enableCorrVecOutputs;
+ int intervalMs;
+ }
}
diff --git a/gnss/aidl/android/hardware/gnss/IGnss.aidl b/gnss/aidl/android/hardware/gnss/IGnss.aidl
index 2751521..1351f59 100644
--- a/gnss/aidl/android/hardware/gnss/IGnss.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnss.aidl
@@ -26,6 +26,7 @@
import android.hardware.gnss.IGnssNavigationMessageInterface;
import android.hardware.gnss.IGnssPowerIndication;
import android.hardware.gnss.IGnssPsds;
+import android.hardware.gnss.visibility_control.IGnssVisibilityControl;
/**
* Represents the standard GNSS (Global Navigation Satellite System) interface.
@@ -144,4 +145,11 @@
* @return Handle to the IGnssDebug interface.
*/
IGnssDebug getExtensionGnssDebug();
+
+ /**
+ * This method returns the IGnssVisibilityControl.
+ *
+ * @return Handle to the IGnssVisibilityControl.
+ */
+ IGnssVisibilityControl getExtensionGnssVisibilityControl();
}
diff --git a/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl b/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl
index 08c83a4..102cdcd 100644
--- a/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl
@@ -24,6 +24,48 @@
@VintfStability
interface IGnssMeasurementInterface {
/**
+ * Options specifying the GnssMeasurement request.
+ */
+ @VintfStability
+ parcelable Options {
+ /**
+ * Enable full tracking mode.
+ *
+ * If true, GNSS chipset must switch off duty cycling. In such mode no clock discontinuities
+ * are expected and, when supported, carrier phase should be continuous in good signal
+ * conditions. All non-blocklisted, healthy constellations, satellites and frequency bands
+ * that the chipset supports must be reported in this mode. The GNSS chipset is allowed to
+ * consume more power in this mode. If false, API must optimize power via duty cycling,
+ * constellations and frequency limits, etc.
+ */
+ boolean enableFullTracking;
+
+ /**
+ * Enable Correlation Vector outputs.
+ *
+ * If true, enable correlation vectors as part of the raw GNSS measurements outputs. If
+ * false, disable correlation vectors.
+ */
+ boolean enableCorrVecOutputs;
+
+ /**
+ * Time interval between the reported measurements in milliseconds.
+ *
+ * The GNSS chipset must not report measurements with a rate slower than requested. All the
+ * available measurements must be reported to the framework.
+ *
+ * For cases where concurrently serving the location and the measurement requests would not
+ * consume more power than only the measurement request, the faster rate of the 2 requests
+ * must be chosen. Otherwise, it is recommended that the GNSS chipset minimizes the power
+ * consumption with appropriate location and measurement intervals to satisfy both requests.
+ * For example, for 2-sec measurement interval request and 7-sec location interval request,
+ * the GNSS chipset is recommended to run the measurement engine with 2-sec interval and the
+ * location engine with 6-sec interval.
+ */
+ int intervalMs;
+ }
+
+ /**
* Initializes the interface and registers the callback routines with the HAL. After a
* successful call to 'setCallback' the HAL must begin to provide updates at an average
* output rate of 1Hz (occasional intra-measurement time offsets in the range from 0-2000msec
@@ -39,13 +81,9 @@
*
* @param enableCorrVecOutputs If true, enable correlation vectors as part of the raw GNSS
* measurements outputs. If false, disable correlation vectors.
- *
- * Returns ok() if successful. Returns ERROR_ALREADY_INIT if a callback has already been
- * registered without a corresponding call to 'close'. Returns ERROR_GENERIC for any other
- * error. The HAL must not generate any other updates upon returning this error code.
*/
void setCallback(in IGnssMeasurementCallback callback, in boolean enableFullTracking,
- in boolean enableCorrVecOutputs);
+ in boolean enableCorrVecOutputs);
/**
* Stops updates from the HAL, and unregisters the callback routines. After a call to close(),
@@ -55,4 +93,11 @@
* no work.
*/
void close();
-}
\ No newline at end of file
+
+ /**
+ * Initializes the interface and registers the callback routines with the HAL.
+ *
+ * @param options See Options definition.
+ */
+ void setCallbackWithOptions(in IGnssMeasurementCallback callback, in Options options);
+}
diff --git a/gnss/aidl/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl b/gnss/aidl/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl
new file mode 100644
index 0000000..93c3f2c
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2021 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.gnss.visibility_control;
+
+import android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback;
+
+/**
+ * Represents the GNSS location reporting permissions and notification interface.
+ *
+ * This interface is used to tell the GNSS HAL implementation whether the framework user has
+ * granted permission to the GNSS HAL implementation to provide GNSS location information for
+ * non-framework (NFW), non-user initiated emergency use cases, and to notify the framework user
+ * of these GNSS location information deliveries.
+ *
+ * For user initiated emergency cases (and for the configured extended emergency session duration),
+ * the GNSS HAL implementation must serve the emergency location supporting network initiated
+ * location requests immediately irrespective of this permission settings.
+ *
+ * There is no separate need for the GNSS HAL implementation to monitor the global device location
+ * on/off setting. Permission to use GNSS for non-framework use cases is expressly controlled
+ * by the method enableNfwLocationAccess(). The framework monitors the location permission settings
+ * of the configured proxy applications(s), and device location settings, and calls the method
+ * enableNfwLocationAccess() whenever the user control proxy applications have, or do not have,
+ * location permission. The proxy applications are used to provide user visibility and control of
+ * location access by the non-framework on/off device entities they are representing.
+ *
+ * For device user visibility, the GNSS HAL implementation must call the method
+ * IGnssVisibilityControlCallback.nfwNotifyCb() whenever location request is rejected or
+ * location information is provided to non-framework entities (on or off device). This includes
+ * the network initiated location requests for user-initiated emergency use cases as well.
+ *
+ * The HAL implementations that support this interface must not report GNSS location, measurement,
+ * status, or other information that can be used to derive user location to any entity when not
+ * expressly authorized by this HAL. This includes all endpoints for location information
+ * off the device, including carriers, vendors, OEM and others directly or indirectly.
+ */
+@VintfStability
+interface IGnssVisibilityControl {
+ /**
+ * Enables/disables non-framework entity location access permission in the GNSS HAL.
+ *
+ * The framework will call this method to update GNSS HAL implementation every time the
+ * framework user, through the given proxy application(s) and/or device location settings,
+ * explicitly grants/revokes the location access permission for non-framework, non-user
+ * initiated emergency use cases.
+ *
+ * Whenever the user location information is delivered to non-framework entities, the HAL
+ * implementation must call the method IGnssVisibilityControlCallback.nfwNotifyCb() to notify
+ * the framework for user visibility.
+ *
+ * @param proxyApps Full list of package names of proxy Android applications representing
+ * the non-framework location access entities (on/off the device) for which the framework
+ * user has granted non-framework location access permission. The GNSS HAL implementation
+ * must provide location information only to non-framework entities represented by these
+ * proxy applications.
+ *
+ * The package name of the proxy Android application follows the standard Java language
+ * package naming format. For example, com.example.myapp.
+ */
+ void enableNfwLocationAccess(in String[] proxyApps);
+
+ /**
+ * Registers the callback for HAL implementation to use.
+ *
+ * @param callback Handle to IGnssVisibilityControlCallback interface.
+ */
+ void setCallback(in IGnssVisibilityControlCallback callback);
+}
diff --git a/gnss/aidl/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl b/gnss/aidl/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl
new file mode 100644
index 0000000..051fbe6
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2021 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.gnss.visibility_control;
+
+/**
+ * GNSS location reporting permissions and notification callback interface.
+ */
+@VintfStability
+interface IGnssVisibilityControlCallback {
+ /**
+ * Protocol stack that is requesting the non-framework location information.
+ */
+ @VintfStability
+ @Backing(type="int")
+ enum NfwProtocolStack {
+ /** Cellular control plane requests */
+ CTRL_PLANE = 0,
+
+ /** All types of SUPL requests */
+ SUPL = 1,
+
+ /** All types of requests from IMS */
+ IMS = 10,
+
+ /** All types of requests from SIM */
+ SIM = 11,
+
+ /** Requests from other protocol stacks */
+ OTHER_PROTOCOL_STACK = 100
+ }
+
+ /**
+ * Entity that is requesting/receiving the location information.
+ */
+ @VintfStability
+ @Backing(type="int")
+ enum NfwRequestor {
+ /** Wireless service provider */
+ CARRIER = 0,
+
+ /** Device manufacturer */
+ OEM = 10,
+
+ /** Modem chipset vendor */
+ MODEM_CHIPSET_VENDOR = 11,
+
+ /** GNSS chipset vendor */
+ GNSS_CHIPSET_VENDOR = 12,
+
+ /** Other chipset vendor */
+ OTHER_CHIPSET_VENDOR = 13,
+
+ /** Automobile client */
+ AUTOMOBILE_CLIENT = 20,
+
+ /** Other sources */
+ OTHER_REQUESTOR = 100
+ }
+
+ /**
+ * GNSS response type for non-framework location requests.
+ */
+ @VintfStability
+ @Backing(type="int")
+ enum NfwResponseType {
+ /** Request rejected because framework has not given permission for this use case */
+ REJECTED = 0,
+
+ /** Request accepted but could not provide location because of a failure */
+ ACCEPTED_NO_LOCATION_PROVIDED = 1,
+
+ /** Request accepted and location provided */
+ ACCEPTED_LOCATION_PROVIDED = 2,
+ }
+
+ /**
+ * Represents a non-framework location information request/response notification.
+ */
+ @VintfStability
+ parcelable NfwNotification {
+ /**
+ * Package name of the Android proxy application representing the non-framework
+ * entity that requested location. Set to empty string if unknown.
+ *
+ * For user-initiated emergency use cases, this field must be set to empty string
+ * and the inEmergencyMode field must be set to true.
+ */
+ String proxyAppPackageName;
+
+ /** Protocol stack that initiated the non-framework location request. */
+ NfwProtocolStack protocolStack;
+
+ /**
+ * Name of the protocol stack if protocolStack field is set to OTHER_PROTOCOL_STACK.
+ * Otherwise, set to empty string.
+ *
+ * This field is opaque to the framework and used for logging purposes.
+ */
+ String otherProtocolStackName;
+
+ /** Source initiating/receiving the location information. */
+ NfwRequestor requestor;
+
+ /**
+ * Identity of the endpoint receiving the location information. For example, carrier
+ * name, OEM name, SUPL SLP/E-SLP FQDN, chipset vendor name, etc.
+ *
+ * This field is opaque to the framework and used for logging purposes.
+ */
+ String requestorId;
+
+ /** Indicates whether location information was provided for this request. */
+ NfwResponseType responseType;
+
+ /** Is the device in user initiated emergency session. */
+ boolean inEmergencyMode;
+
+ /** Is cached location provided */
+ boolean isCachedLocation;
+ }
+
+ /**
+ * Callback to report a non-framework delivered location.
+ *
+ * The GNSS HAL implementation must call this method to notify the framework whenever
+ * a non-framework location request is made to the GNSS HAL.
+ *
+ * Non-framework entities like low power sensor hubs that request location from GNSS and
+ * only pass location information through Android framework controls are exempt from this
+ * power-spending reporting. However, low power sensor hubs or other chipsets which may send
+ * the location information to anywhere other than Android framework (which provides user
+ * visibility and control), must report location information use through this API whenever
+ * location information (or events driven by that location such as "home" location detection)
+ * leaves the domain of that low power chipset.
+ *
+ * To avoid overly spamming the framework, high speed location reporting of the exact same
+ * type may be throttled to report location at a lower rate than the actual report rate, as
+ * long as the location is reported with a latency of no more than the larger of 5 seconds,
+ * or the next the Android processor awake time. For example, if an Automotive client is
+ * getting location information from the GNSS location system at 20Hz, this method may be
+ * called at 1Hz. As another example, if a low power processor is getting location from the
+ * GNSS chipset, and the Android processor is asleep, the notification to the Android HAL may
+ * be delayed until the next wake of the Android processor.
+ *
+ * @param notification Non-framework delivered location request/response description.
+ */
+ void nfwNotifyCb(in NfwNotification notification);
+
+ /**
+ * Tells if the device is currently in an emergency session.
+ *
+ * Emergency session is defined as the device being actively in a user initiated emergency
+ * call or in post emergency call extension time period.
+ *
+ * If the GNSS HAL implementation cannot determine if the device is in emergency session
+ * mode, it must call this method to confirm that the device is in emergency session before
+ * serving network initiated emergency SUPL and Control Plane location requests.
+ *
+ * @return success True if the framework determines that the device is in emergency session.
+ */
+ boolean isInEmergencySession();
+}
diff --git a/gnss/aidl/default/Android.bp b/gnss/aidl/default/Android.bp
index 24569ae..29c26d1 100644
--- a/gnss/aidl/default/Android.bp
+++ b/gnss/aidl/default/Android.bp
@@ -52,6 +52,7 @@
"android.hardware.gnss.measurement_corrections@1.1",
"android.hardware.gnss.measurement_corrections@1.0",
"android.hardware.gnss.visibility_control@1.0",
+ "android.hardware.gnss.visibility_control-V1-ndk",
"android.hardware.gnss-V2-ndk",
],
srcs: [
@@ -66,6 +67,7 @@
"GnssPsds.cpp",
"GnssConfiguration.cpp",
"GnssMeasurementInterface.cpp",
+ "GnssVisibilityControl.cpp",
"service.cpp",
],
static_libs: [
diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp
index 45d6b1d..afb7b95 100644
--- a/gnss/aidl/default/Gnss.cpp
+++ b/gnss/aidl/default/Gnss.cpp
@@ -26,6 +26,7 @@
#include "GnssMeasurementInterface.h"
#include "GnssNavigationMessageInterface.h"
#include "GnssPsds.h"
+#include "GnssVisibilityControl.h"
namespace aidl::android::hardware::gnss {
@@ -128,4 +129,12 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus Gnss::getExtensionGnssVisibilityControl(
+ std::shared_ptr<visibility_control::IGnssVisibilityControl>* iGnssVisibilityControl) {
+ ALOGD("Gnss::getExtensionGnssVisibilityControl");
+
+ *iGnssVisibilityControl = SharedRefBase::make<visibility_control::GnssVisibilityControl>();
+ return ndk::ScopedAStatus::ok();
+}
+
} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/Gnss.h b/gnss/aidl/default/Gnss.h
index f59607f..67fef94 100644
--- a/gnss/aidl/default/Gnss.h
+++ b/gnss/aidl/default/Gnss.h
@@ -24,6 +24,7 @@
#include <aidl/android/hardware/gnss/BnGnssMeasurementInterface.h>
#include <aidl/android/hardware/gnss/BnGnssPowerIndication.h>
#include <aidl/android/hardware/gnss/BnGnssPsds.h>
+#include <aidl/android/hardware/gnss/visibility_control/BnGnssVisibilityControl.h>
#include "GnssConfiguration.h"
#include "GnssPowerIndication.h"
@@ -48,6 +49,9 @@
std::shared_ptr<IGnssNavigationMessageInterface>* iGnssNavigationMessage) override;
ndk::ScopedAStatus getExtensionAGnss(std::shared_ptr<IAGnss>* iAGnss) override;
ndk::ScopedAStatus getExtensionGnssDebug(std::shared_ptr<IGnssDebug>* iGnssDebug) override;
+ ndk::ScopedAStatus getExtensionGnssVisibilityControl(
+ std::shared_ptr<android::hardware::gnss::visibility_control::IGnssVisibilityControl>*
+ iGnssVisibilityControl) override;
std::shared_ptr<GnssConfiguration> mGnssConfiguration;
std::shared_ptr<GnssPowerIndication> mGnssPowerIndication;
diff --git a/gnss/aidl/default/GnssMeasurementInterface.cpp b/gnss/aidl/default/GnssMeasurementInterface.cpp
index 9e4f7c7..2c7241b 100644
--- a/gnss/aidl/default/GnssMeasurementInterface.cpp
+++ b/gnss/aidl/default/GnssMeasurementInterface.cpp
@@ -56,11 +56,29 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus GnssMeasurementInterface::setCallbackWithOptions(
+ const std::shared_ptr<IGnssMeasurementCallback>& callback, const Options& options) {
+ ALOGD("setCallbackWithOptions: fullTracking:%d, corrVec:%d, intervalMs:%d",
+ (int)options.enableFullTracking, (int)options.enableCorrVecOutputs, options.intervalMs);
+ std::unique_lock<std::mutex> lock(mMutex);
+ sCallback = callback;
+
+ if (mIsActive) {
+ ALOGW("GnssMeasurement callback already set. Resetting the callback...");
+ stop();
+ }
+ mMinIntervalMillis = options.intervalMs;
+ start(options.enableCorrVecOutputs);
+
+ return ndk::ScopedAStatus::ok();
+}
+
ndk::ScopedAStatus GnssMeasurementInterface::close() {
ALOGD("close");
stop();
std::unique_lock<std::mutex> lock(mMutex);
sCallback = nullptr;
+ mMinIntervalMillis = 1000;
return ndk::ScopedAStatus::ok();
}
diff --git a/gnss/aidl/default/GnssMeasurementInterface.h b/gnss/aidl/default/GnssMeasurementInterface.h
index db63515..bf77806 100644
--- a/gnss/aidl/default/GnssMeasurementInterface.h
+++ b/gnss/aidl/default/GnssMeasurementInterface.h
@@ -32,6 +32,9 @@
const bool enableFullTracking,
const bool enableCorrVecOutputs) override;
ndk::ScopedAStatus close() override;
+ ndk::ScopedAStatus setCallbackWithOptions(
+ const std::shared_ptr<IGnssMeasurementCallback>& callback,
+ const Options& options) override;
private:
void start(const bool enableCorrVecOutputs);
diff --git a/gnss/aidl/default/GnssVisibilityControl.cpp b/gnss/aidl/default/GnssVisibilityControl.cpp
new file mode 100644
index 0000000..208d73c
--- /dev/null
+++ b/gnss/aidl/default/GnssVisibilityControl.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#define LOG_TAG "GnssVisibilityControl"
+
+#include "GnssVisibilityControl.h"
+#include <log/log.h>
+
+namespace aidl::android::hardware::gnss::visibility_control {
+
+std::shared_ptr<IGnssVisibilityControlCallback> GnssVisibilityControl::sCallback = nullptr;
+
+ndk::ScopedAStatus GnssVisibilityControl::enableNfwLocationAccess(
+ const std::vector<std::string>& proxyApps) {
+ std::string os;
+ bool first = true;
+ for (const auto& proxyApp : proxyApps) {
+ if (first) {
+ first = false;
+ } else {
+ os += " ";
+ }
+ os += proxyApp;
+ }
+
+ ALOGD("GnssVisibilityControl::enableNfwLocationAccess proxyApps: %s", os.c_str());
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus GnssVisibilityControl::setCallback(
+ const std::shared_ptr<IGnssVisibilityControlCallback>& callback) {
+ ALOGD("GnssVisibilityControl::setCallback");
+ std::unique_lock<std::mutex> lock(mMutex);
+ sCallback = callback;
+ return ndk::ScopedAStatus::ok();
+}
+
+} // namespace aidl::android::hardware::gnss::visibility_control
diff --git a/gnss/aidl/default/GnssVisibilityControl.h b/gnss/aidl/default/GnssVisibilityControl.h
new file mode 100644
index 0000000..5b36442
--- /dev/null
+++ b/gnss/aidl/default/GnssVisibilityControl.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/gnss/visibility_control/BnGnssVisibilityControl.h>
+
+namespace aidl::android::hardware::gnss::visibility_control {
+
+struct GnssVisibilityControl : public BnGnssVisibilityControl {
+ public:
+ ndk::ScopedAStatus enableNfwLocationAccess(const std::vector<std::string>& hostname) override;
+ ndk::ScopedAStatus setCallback(
+ const std::shared_ptr<IGnssVisibilityControlCallback>& callback) override;
+
+ private:
+ // Synchronization lock for sCallback
+ mutable std::mutex mMutex;
+ // Guarded by mMutex
+ static std::shared_ptr<IGnssVisibilityControlCallback> sCallback;
+};
+
+} // namespace aidl::android::hardware::gnss::visibility_control
diff --git a/gnss/aidl/vts/Android.bp b/gnss/aidl/vts/Android.bp
index 041d579..d532fad 100644
--- a/gnss/aidl/vts/Android.bp
+++ b/gnss/aidl/vts/Android.bp
@@ -37,6 +37,7 @@
"GnssMeasurementCallbackAidl.cpp",
"GnssNavigationMessageCallback.cpp",
"GnssPowerIndicationCallback.cpp",
+ "GnssVisibilityControlCallback.cpp",
"VtsHalGnssTargetTest.cpp",
],
shared_libs: [
@@ -49,6 +50,7 @@
static_libs: [
"android.hardware.gnss-V2-cpp",
"android.hardware.gnss@common-vts-lib",
+ "android.hardware.gnss.visibility_control-V1-cpp",
],
test_suites: [
"general-tests",
diff --git a/gnss/aidl/vts/GnssVisibilityControlCallback.cpp b/gnss/aidl/vts/GnssVisibilityControlCallback.cpp
new file mode 100644
index 0000000..aa27af1
--- /dev/null
+++ b/gnss/aidl/vts/GnssVisibilityControlCallback.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#include "GnssVisibilityControlCallback.h"
+#include <log/log.h>
+
+android::binder::Status GnssVisibilityControlCallback::nfwNotifyCb(const NfwNotification&) {
+ // To implement
+ return android::binder::Status::ok();
+}
+
+android::binder::Status GnssVisibilityControlCallback::isInEmergencySession(bool*) {
+ // To implement
+ return android::binder::Status::ok();
+}
diff --git a/gnss/aidl/vts/GnssVisibilityControlCallback.h b/gnss/aidl/vts/GnssVisibilityControlCallback.h
new file mode 100644
index 0000000..fbacde7
--- /dev/null
+++ b/gnss/aidl/vts/GnssVisibilityControlCallback.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#pragma once
+
+#include <android/hardware/gnss/visibility_control/BnGnssVisibilityControlCallback.h>
+
+class GnssVisibilityControlCallback
+ : public android::hardware::gnss::visibility_control::BnGnssVisibilityControlCallback {
+ public:
+ GnssVisibilityControlCallback(){};
+ ~GnssVisibilityControlCallback(){};
+ android::binder::Status nfwNotifyCb(
+ const android::hardware::gnss::visibility_control::IGnssVisibilityControlCallback::
+ NfwNotification& notification) override;
+ android::binder::Status isInEmergencySession(bool* _aidl_return) override;
+};
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 36be631..d3cb0a0 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -24,6 +24,7 @@
#include <android/hardware/gnss/IGnssMeasurementInterface.h>
#include <android/hardware/gnss/IGnssPowerIndication.h>
#include <android/hardware/gnss/IGnssPsds.h>
+#include <android/hardware/gnss/visibility_control/IGnssVisibilityControl.h>
#include <cutils/properties.h>
#include "AGnssCallbackAidl.h"
#include "GnssBatchingCallback.h"
@@ -31,6 +32,7 @@
#include "GnssMeasurementCallbackAidl.h"
#include "GnssNavigationMessageCallback.h"
#include "GnssPowerIndicationCallback.h"
+#include "GnssVisibilityControlCallback.h"
#include "gnss_hal_test.h"
using android::sp;
@@ -55,6 +57,7 @@
using android::hardware::gnss::IGnssPsds;
using android::hardware::gnss::PsdsType;
using android::hardware::gnss::SatellitePvt;
+using android::hardware::gnss::visibility_control::IGnssVisibilityControl;
using GnssConstellationTypeAidl = android::hardware::gnss::GnssConstellationType;
@@ -876,3 +879,66 @@
data.time.frequencyUncertaintyNsPerSec <= 2.0e5); // 200 ppm
}
}
+
+/*
+ * TestAGnssExtension:
+ * TestGnssVisibilityControlExtension:
+ * 1. Gets the IGnssVisibilityControl extension.
+ * 2. Sets GnssVisibilityControlCallback
+ * 3. Sets proxy apps
+ */
+TEST_P(GnssHalTest, TestGnssVisibilityControlExtension) {
+ if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ return;
+ }
+ sp<IGnssVisibilityControl> iGnssVisibilityControl;
+ auto status = aidl_gnss_hal_->getExtensionGnssVisibilityControl(&iGnssVisibilityControl);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_TRUE(iGnssVisibilityControl != nullptr);
+ auto gnssVisibilityControlCallback = sp<GnssVisibilityControlCallback>::make();
+ status = iGnssVisibilityControl->setCallback(gnssVisibilityControlCallback);
+ ASSERT_TRUE(status.isOk());
+
+ std::vector<String16> proxyApps{String16("com.example.ims"), String16("com.example.mdt")};
+ status = iGnssVisibilityControl->enableNfwLocationAccess(proxyApps);
+ ASSERT_TRUE(status.isOk());
+}
+
+/*
+ * TestGnssMeasurementSetCallbackWithOptions:
+ * 1. Gets the GnssMeasurementExtension and verifies that it returns a non-null extension.
+ * 2. Sets a GnssMeasurementCallback with intervalMillis option, waits for measurements reported,
+ * and verifies mandatory fields are valid.
+ */
+TEST_P(GnssHalTest, TestGnssMeasurementSetCallbackWithOptions) {
+ if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ return;
+ }
+ const int kFirstGnssMeasurementTimeoutSeconds = 10;
+ const int kNumMeasurementEvents = 5;
+
+ sp<IGnssMeasurementInterface> iGnssMeasurement;
+ auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_TRUE(iGnssMeasurement != nullptr);
+
+ auto callback = sp<GnssMeasurementCallbackAidl>::make();
+ IGnssMeasurementInterface::Options options;
+ options.intervalMs = 2000;
+ status = iGnssMeasurement->setCallbackWithOptions(callback, options);
+ ASSERT_TRUE(status.isOk());
+
+ for (int i = 0; i < kNumMeasurementEvents; i++) {
+ GnssData lastMeasurement;
+ ASSERT_TRUE(callback->gnss_data_cbq_.retrieve(lastMeasurement,
+ kFirstGnssMeasurementTimeoutSeconds));
+ EXPECT_EQ(callback->gnss_data_cbq_.calledCount(), i + 1);
+ ASSERT_TRUE(lastMeasurement.measurements.size() > 0);
+
+ // Validity check GnssData fields
+ CheckGnssMeasurementClockFields(lastMeasurement);
+ }
+
+ status = iGnssMeasurement->close();
+ ASSERT_TRUE(status.isOk());
+}
diff --git a/graphics/composer/aidl/Android.bp b/graphics/composer/aidl/Android.bp
index 5f5b54e..2532a7a 100644
--- a/graphics/composer/aidl/Android.bp
+++ b/graphics/composer/aidl/Android.bp
@@ -55,20 +55,6 @@
},
}
-cc_library {
- name: "android.hardware.graphics.composer3-translate-ndk",
- vendor_available: true,
- srcs: ["android/hardware/graphics/composer3/translate-ndk.cpp"],
- shared_libs: [
- "libbinder_ndk",
- "libhidlbase",
- "android.hardware.graphics.composer3-V1-ndk",
- "android.hardware.graphics.composer@2.1",
- "android.hardware.graphics.composer@2.4",
- ],
- export_include_dirs: ["include"],
-}
-
cc_library_headers {
name: "android.hardware.graphics.composer3-command-buffer",
vendor_available: true,
@@ -88,3 +74,16 @@
],
export_include_dirs: ["include"],
}
+
+cc_test {
+ name: "android.hardware.graphics.composer3-hidl2aidl-asserts",
+ vendor_available: true,
+ srcs: ["android/hardware/graphics/composer3/Hidl2AidlAsserts.cpp"],
+ shared_libs: [
+ "libbinder_ndk",
+ "libhidlbase",
+ "android.hardware.graphics.composer3-V1-ndk",
+ "android.hardware.graphics.composer@2.1",
+ "android.hardware.graphics.composer@2.4",
+ ],
+}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl
index 856ec64..480a85c 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl
@@ -34,5 +34,5 @@
package android.hardware.graphics.composer3;
@VintfStability
parcelable ClockMonotonicTimestamp {
- long timestamp;
+ long timestampNanos;
}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PresentOrValidate.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PresentOrValidate.aidl
index 3514e53..e6ddeba 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PresentOrValidate.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PresentOrValidate.aidl
@@ -38,7 +38,7 @@
android.hardware.graphics.composer3.PresentOrValidate.Result result;
@VintfStability
enum Result {
- Presented = 0,
- Validated = 1,
+ Validated = 0,
+ Presented = 1,
}
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl
index f385038..0cfd1c4 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl
@@ -21,5 +21,5 @@
*/
@VintfStability
parcelable ClockMonotonicTimestamp {
- long timestamp;
+ long timestampNanos;
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl
index 49cdffc..803de06 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl
@@ -79,13 +79,10 @@
* bottom of a display.
*
* Pixels in the buffer with an alpha of 0 (transparent) will show the
- * content underneath, and pixels with an alpha of 255 will be rendered in
+ * content underneath, and pixels with a max alpha value will be rendered in
* black. An alpha in between will show the underlying content blended with
* black.
*
- * Some devices may support this flag with a buffer containing an 8 bit
- * alpha mask.
- *
* Upon validateDisplay, the device may request a change from this type
* to either DEVICE or CLIENT.
*/
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/HandleIndex.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/HandleIndex.aidl
deleted file mode 100644
index 0a93c9e..0000000
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/HandleIndex.aidl
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Copyright (c) 2021, 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.graphics.composer3;
-
-/**
- * Special index values (always negative) for command queue commands.
- */
-@VintfStability
-@Backing(type="int")
-enum HandleIndex {
- /**
- * No handle
- */
- EMPTY = -1,
- /**
- * Use cached handle
- */
- CACHED = -2,
-}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/translate-ndk.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/Hidl2AidlAsserts.cpp
similarity index 79%
rename from graphics/composer/aidl/android/hardware/graphics/composer3/translate-ndk.cpp
rename to graphics/composer/aidl/android/hardware/graphics/composer3/Hidl2AidlAsserts.cpp
index 8a789e3..d34b405 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/translate-ndk.cpp
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Hidl2AidlAsserts.cpp
@@ -14,7 +14,33 @@
* limitations under the License.
*/
-#include "android/hardware/graphics/composer3/translate-ndk.h"
+#include "aidl/android/hardware/graphics/common/BlendMode.h"
+#include "aidl/android/hardware/graphics/common/FRect.h"
+#include "aidl/android/hardware/graphics/common/Rect.h"
+#include "aidl/android/hardware/graphics/composer3/Capability.h"
+#include "aidl/android/hardware/graphics/composer3/ClientTargetProperty.h"
+#include "aidl/android/hardware/graphics/composer3/Color.h"
+#include "aidl/android/hardware/graphics/composer3/Composition.h"
+#include "aidl/android/hardware/graphics/composer3/ContentType.h"
+#include "aidl/android/hardware/graphics/composer3/DisplayAttribute.h"
+#include "aidl/android/hardware/graphics/composer3/DisplayCapability.h"
+#include "aidl/android/hardware/graphics/composer3/DisplayConnectionType.h"
+#include "aidl/android/hardware/graphics/composer3/FloatColor.h"
+#include "aidl/android/hardware/graphics/composer3/FormatColorComponent.h"
+#include "aidl/android/hardware/graphics/composer3/IComposer.h"
+#include "aidl/android/hardware/graphics/composer3/PerFrameMetadata.h"
+#include "aidl/android/hardware/graphics/composer3/PerFrameMetadataBlob.h"
+#include "aidl/android/hardware/graphics/composer3/PerFrameMetadataKey.h"
+#include "aidl/android/hardware/graphics/composer3/PowerMode.h"
+#include "aidl/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.h"
+#include "aidl/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.h"
+#include "android/hardware/graphics/composer/2.1/IComposer.h"
+#include "android/hardware/graphics/composer/2.1/IComposerCallback.h"
+#include "android/hardware/graphics/composer/2.1/IComposerClient.h"
+#include "android/hardware/graphics/composer/2.2/IComposerClient.h"
+#include "android/hardware/graphics/composer/2.3/IComposerClient.h"
+#include "android/hardware/graphics/composer/2.4/IComposerClient.h"
+#include "android/hardware/graphics/composer/2.4/types.h"
namespace android::h2a {
@@ -129,15 +155,6 @@
static_cast<int>(::android::hardware::graphics::composer::V2_1::IComposerClient::
DisplayRequest::WRITE_CLIENT_TARGET_TO_OUTPUT));
-static_assert(aidl::android::hardware::graphics::composer3::HandleIndex::EMPTY ==
- static_cast<aidl::android::hardware::graphics::composer3::HandleIndex>(
- ::android::hardware::graphics::composer::V2_1::IComposerClient::HandleIndex::
- EMPTY));
-static_assert(aidl::android::hardware::graphics::composer3::HandleIndex::CACHED ==
- static_cast<aidl::android::hardware::graphics::composer3::HandleIndex>(
- ::android::hardware::graphics::composer::V2_1::IComposerClient::HandleIndex::
- CACHED));
-
static_assert(
aidl::android::hardware::graphics::composer3::PowerMode::OFF ==
static_cast<aidl::android::hardware::graphics::composer3::PowerMode>(
@@ -327,122 +344,11 @@
static_cast<aidl::android::hardware::graphics::composer3::ContentType>(
::android::hardware::graphics::composer::V2_4::IComposerClient::ContentType::GAME));
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_4::VsyncPeriodChangeTimeline& in,
- aidl::android::hardware::graphics::composer3::VsyncPeriodChangeTimeline* out) {
- out->newVsyncAppliedTimeNanos = static_cast<int64_t>(in.newVsyncAppliedTimeNanos);
- out->refreshRequired = static_cast<bool>(in.refreshRequired);
- out->refreshTimeNanos = static_cast<int64_t>(in.refreshTimeNanos);
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_1::IComposerClient::Rect& in,
- aidl::android::hardware::graphics::common::Rect* out) {
- out->left = static_cast<int32_t>(in.left);
- out->top = static_cast<int32_t>(in.top);
- out->right = static_cast<int32_t>(in.right);
- out->bottom = static_cast<int32_t>(in.bottom);
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_1::IComposerClient::FRect& in,
- aidl::android::hardware::graphics::common::FRect* out) {
- out->left = static_cast<float>(in.left);
- out->top = static_cast<float>(in.top);
- out->right = static_cast<float>(in.right);
- out->bottom = static_cast<float>(in.bottom);
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_1::IComposerClient::Color& in,
- aidl::android::hardware::graphics::composer3::Color* out) {
- // FIXME This requires conversion between signed and unsigned. Change this if it doesn't suit
- // your needs.
- if (in.r > std::numeric_limits<int8_t>::max() || in.r < 0) {
- return false;
- }
- out->r = static_cast<int8_t>(in.r);
- // FIXME This requires conversion between signed and unsigned. Change this if it doesn't suit
- // your needs.
- if (in.g > std::numeric_limits<int8_t>::max() || in.g < 0) {
- return false;
- }
- out->g = static_cast<int8_t>(in.g);
- // FIXME This requires conversion between signed and unsigned. Change this if it doesn't suit
- // your needs.
- if (in.b > std::numeric_limits<int8_t>::max() || in.b < 0) {
- return false;
- }
- out->b = static_cast<int8_t>(in.b);
- // FIXME This requires conversion between signed and unsigned. Change this if it doesn't suit
- // your needs.
- if (in.a > std::numeric_limits<int8_t>::max() || in.a < 0) {
- return false;
- }
- out->a = static_cast<int8_t>(in.a);
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_3::IComposerClient::PerFrameMetadata& in,
- aidl::android::hardware::graphics::composer3::PerFrameMetadata* out) {
- out->key =
- static_cast<aidl::android::hardware::graphics::composer3::PerFrameMetadataKey>(in.key);
- out->value = static_cast<float>(in.value);
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_2::IComposerClient::FloatColor& in,
- aidl::android::hardware::graphics::composer3::FloatColor* out) {
- out->r = static_cast<float>(in.r);
- out->g = static_cast<float>(in.g);
- out->b = static_cast<float>(in.b);
- out->a = static_cast<float>(in.a);
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_3::IComposerClient::PerFrameMetadataBlob&
- in,
- aidl::android::hardware::graphics::composer3::PerFrameMetadataBlob* out) {
- out->key =
- static_cast<aidl::android::hardware::graphics::composer3::PerFrameMetadataKey>(in.key);
- {
- size_t size = in.blob.size();
- for (size_t i = 0; i < size; i++) {
- // FIXME This requires conversion between signed and unsigned. Change this if it doesn't
- // suit your needs.
- if (in.blob[i] > std::numeric_limits<int8_t>::max() || in.blob[i] < 0) {
- return false;
- }
- out->blob.push_back(static_cast<int8_t>(in.blob[i]));
- }
- }
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_4::IComposerClient::
- VsyncPeriodChangeConstraints& in,
- aidl::android::hardware::graphics::composer3::VsyncPeriodChangeConstraints* out) {
- out->desiredTimeNanos = static_cast<int64_t>(in.desiredTimeNanos);
- out->seamlessRequired = static_cast<bool>(in.seamlessRequired);
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_4::IComposerClient::ClientTargetProperty&
- in,
- aidl::android::hardware::graphics::composer3::ClientTargetProperty* out) {
- out->pixelFormat =
- static_cast<aidl::android::hardware::graphics::common::PixelFormat>(in.pixelFormat);
- out->dataspace =
- static_cast<aidl::android::hardware::graphics::common::Dataspace>(in.dataspace);
- return true;
-}
+static_assert(
+ aidl::android::hardware::graphics::composer3::PresentOrValidate::Result::Presented ==
+ static_cast<aidl::android::hardware::graphics::composer3::PresentOrValidate::Result>(1));
+static_assert(
+ aidl::android::hardware::graphics::composer3::PresentOrValidate::Result::Validated ==
+ static_cast<aidl::android::hardware::graphics::composer3::PresentOrValidate::Result>(0));
} // namespace android::h2a
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/PresentOrValidate.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/PresentOrValidate.aidl
index f3153bd..5ae8940 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/PresentOrValidate.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/PresentOrValidate.aidl
@@ -27,6 +27,6 @@
/**
* Whether PresentOrValidate presented or validated the display.
*/
- @VintfStability enum Result { Presented, Validated }
+ @VintfStability enum Result { Validated, Presented }
Result result;
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp
index eddc2d3..0ece1d5 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp
@@ -19,6 +19,7 @@
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
#include <aidl/android/hardware/graphics/common/BufferUsage.h>
+#include <aidl/android/hardware/graphics/composer3/IComposer.h>
#include <android/binder_manager.h>
#include <composer-vts/include/ReadbackVts.h>
#include <composer-vts/include/RenderEngineVts.h>
@@ -103,13 +104,8 @@
ASSERT_NO_FATAL_FAILURE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::OFF));
const auto errors = mReader.takeErrors();
ASSERT_TRUE(mReader.takeErrors().empty());
+ ASSERT_TRUE(mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty());
- std::vector<int64_t> layers;
- std::vector<Composition> types;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &layers, &types);
-
- ASSERT_TRUE(layers.empty());
- ASSERT_TRUE(types.empty());
if (mComposerCallback != nullptr) {
EXPECT_EQ(0, mComposerCallback->getInvalidHotplugCount());
EXPECT_EQ(0, mComposerCallback->getInvalidRefreshCount());
@@ -118,12 +114,14 @@
}
::android::sp<::android::GraphicBuffer> allocate() {
+ const auto width = static_cast<uint32_t>(mDisplayWidth);
+ const auto height = static_cast<uint32_t>(mDisplayHeight);
+ const auto usage = static_cast<uint32_t>(common::BufferUsage::CPU_WRITE_OFTEN) |
+ static_cast<uint32_t>(common::BufferUsage::CPU_READ_OFTEN);
+
return ::android::sp<::android::GraphicBuffer>::make(
- mDisplayWidth, mDisplayHeight, ::android::PIXEL_FORMAT_RGBA_8888,
- /*layerCount*/ 1,
- static_cast<uint64_t>(static_cast<int>(common::BufferUsage::CPU_WRITE_OFTEN) |
- static_cast<int>(common::BufferUsage::CPU_READ_OFTEN)),
- "VtsHalGraphicsComposer3_ReadbackTest");
+ width, height, ::android::PIXEL_FORMAT_RGBA_8888,
+ /*layerCount*/ 1u, usage, "VtsHalGraphicsComposer3_ReadbackTest");
}
void writeLayers(const std::vector<std::shared_ptr<TestLayer>>& layers) {
@@ -141,10 +139,10 @@
}
std::vector<CommandResultPayload> results;
- const auto status = mComposerClient->executeCommands(commands, &results);
+ auto status = mComposerClient->executeCommands(commands, &results);
ASSERT_TRUE(status.isOk()) << "executeCommands failed " << status.getDescription();
- mReader.parse(results);
+ mReader.parse(std::move(results));
mWriter.reset();
}
@@ -262,11 +260,7 @@
execute();
// if hwc cannot handle and asks for composition change,
// just succeed the test
- std::vector<int64_t> changedCompositionLayers;
- std::vector<Composition> changedCompositionTypes;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- if (!changedCompositionLayers.empty()) {
+ if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
GTEST_SUCCEED();
return;
}
@@ -320,11 +314,7 @@
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> changedCompositionLayers;
- std::vector<Composition> changedCompositionTypes;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- if (!changedCompositionLayers.empty()) {
+ if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
GTEST_SUCCEED();
return;
}
@@ -380,11 +370,7 @@
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> changedCompositionLayers;
- std::vector<Composition> changedCompositionTypes;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- if (!changedCompositionLayers.empty()) {
+ if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
GTEST_SUCCEED();
return;
}
@@ -433,7 +419,8 @@
return;
}
- aidl::android::hardware::common::NativeHandle bufferHandle = ::android::dupToAidl(nullptr);
+ aidl::android::hardware::common::NativeHandle bufferHandle =
+ ::android::dupToAidl(mGraphicBuffer->handle);
ndk::ScopedFileDescriptor releaseFence = ndk::ScopedFileDescriptor(-1);
const auto error =
mComposerClient->setReadbackBuffer(mPrimaryDisplay, bufferHandle, releaseFence);
@@ -495,14 +482,10 @@
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> changedCompositionLayers;
- std::vector<Composition> changedCompositionTypes;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- if (!changedCompositionLayers.empty()) {
- ASSERT_EQ(1, changedCompositionLayers.size());
+ auto changedCompositionTypes = mReader.takeChangedCompositionTypes(mPrimaryDisplay);
+ if (!changedCompositionTypes.empty()) {
ASSERT_EQ(1, changedCompositionTypes.size());
- ASSERT_EQ(Composition::CLIENT, changedCompositionTypes[0]);
+ ASSERT_EQ(Composition::CLIENT, changedCompositionTypes[0].composition);
PixelFormat clientFormat = PixelFormat::RGBA_8888;
auto clientUsage = static_cast<uint32_t>(
@@ -537,9 +520,8 @@
mWriter.setClientTarget(mPrimaryDisplay, 0, mGraphicBuffer->handle, fenceHandle.get(),
clientDataspace, std::vector<common::Rect>(1, damage));
execute();
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- ASSERT_TRUE(changedCompositionLayers.empty());
+ changedCompositionTypes = mReader.takeChangedCompositionTypes(mPrimaryDisplay);
+ ASSERT_TRUE(changedCompositionTypes.empty());
}
ASSERT_TRUE(mReader.takeErrors().empty());
@@ -609,15 +591,12 @@
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> changedCompositionLayers;
- std::vector<Composition> changedCompositionTypes;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
+ auto changedCompositionTypes = mReader.takeChangedCompositionTypes(mPrimaryDisplay);
if (changedCompositionTypes.size() != 1) {
continue;
}
// create client target buffer
- ASSERT_EQ(Composition::CLIENT, changedCompositionTypes[0]);
+ ASSERT_EQ(Composition::CLIENT, changedCompositionTypes[0].composition);
mGraphicBuffer->reallocate(static_cast<uint32_t>(mDisplayWidth),
static_cast<uint32_t>(mDisplayHeight),
static_cast<int32_t>(common::PixelFormat::RGBA_8888),
@@ -642,9 +621,8 @@
mWriter.setClientTarget(mPrimaryDisplay, 0, mGraphicBuffer->handle, fenceHandle.get(),
clientDataspace, std::vector<common::Rect>(1, clientFrame));
execute();
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- ASSERT_EQ(0, changedCompositionLayers.size());
+ changedCompositionTypes = mReader.takeChangedCompositionTypes(mPrimaryDisplay);
+ ASSERT_TRUE(changedCompositionTypes.empty());
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.presentDisplay(mPrimaryDisplay);
@@ -687,11 +665,7 @@
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> changedCompositionLayers;
- std::vector<Composition> changedCompositionTypes;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- if (!changedCompositionLayers.empty()) {
+ if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
GTEST_SUCCEED();
return;
}
@@ -718,10 +692,7 @@
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- ASSERT_TRUE(changedCompositionLayers.empty());
- ASSERT_TRUE(changedCompositionTypes.empty());
+ ASSERT_TRUE(mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty());
mWriter.presentDisplay(mPrimaryDisplay);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
@@ -758,11 +729,7 @@
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> changedCompositionLayers;
- std::vector<Composition> changedCompositionTypes;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- if (!changedCompositionLayers.empty()) {
+ if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
GTEST_SUCCEED();
return;
}
@@ -821,11 +788,7 @@
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> changedCompositionLayers;
- std::vector<Composition> changedCompositionTypes;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- if (!changedCompositionLayers.empty()) {
+ if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
GTEST_SUCCEED();
return;
}
@@ -879,11 +842,7 @@
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> changedCompositionLayers;
- std::vector<Composition> changedCompositionTypes;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- if (!changedCompositionLayers.empty()) {
+ if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
GTEST_SUCCEED();
return;
}
@@ -904,10 +863,7 @@
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- ASSERT_TRUE(changedCompositionLayers.empty());
- ASSERT_TRUE(changedCompositionTypes.empty());
+ ASSERT_TRUE(mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty());
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.presentDisplay(mPrimaryDisplay);
execute();
@@ -1029,11 +985,7 @@
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> changedCompositionLayers;
- std::vector<Composition> changedCompositionTypes;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- if (!changedCompositionLayers.empty()) {
+ if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
GTEST_SUCCEED();
return;
}
@@ -1074,11 +1026,7 @@
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> changedCompositionLayers;
- std::vector<Composition> changedCompositionTypes;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- if (!changedCompositionLayers.empty()) {
+ if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
GTEST_SUCCEED();
return;
}
@@ -1114,11 +1062,7 @@
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> changedCompositionLayers;
- std::vector<Composition> changedCompositionTypes;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- if (!changedCompositionLayers.empty()) {
+ if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
GTEST_SUCCEED();
return;
}
@@ -1197,11 +1141,7 @@
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> changedCompositionLayers;
- std::vector<Composition> changedCompositionTypes;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- if (!changedCompositionLayers.empty()) {
+ if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
GTEST_SUCCEED();
return;
}
@@ -1243,11 +1183,7 @@
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> changedCompositionLayers;
- std::vector<Composition> changedCompositionTypes;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
- &changedCompositionTypes);
- if (!changedCompositionLayers.empty()) {
+ if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
GTEST_SUCCEED();
return;
}
@@ -1289,10 +1225,7 @@
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> layers;
- std::vector<Composition> types;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &layers, &types);
- if (!layers.empty()) {
+ if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
GTEST_SUCCEED();
return;
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp
index 6638744..4dbe191 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -1142,13 +1142,7 @@
void TearDown() override {
const auto errors = mReader.takeErrors();
ASSERT_TRUE(mReader.takeErrors().empty());
-
- std::vector<int64_t> layers;
- std::vector<Composition> types;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &layers, &types);
-
- ASSERT_TRUE(layers.empty());
- ASSERT_TRUE(types.empty());
+ ASSERT_TRUE(mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty());
ASSERT_NO_FATAL_FAILURE(GraphicsComposerAidlTest::TearDown());
}
@@ -1164,7 +1158,7 @@
const auto status = mComposerClient->executeCommands(commands, &results);
ASSERT_TRUE(status.isOk()) << "executeCommands failed " << status.getDescription();
- mReader.parse(results);
+ mReader.parse(std::move(results));
mWriter.reset();
}
@@ -1299,10 +1293,12 @@
execute();
EXPECT_TRUE(mReader.takeErrors().empty());
- int presentFence;
- mReader.takePresentFence(mPrimaryDisplay, &presentFence);
- EXPECT_NE(-1, presentFence);
- return sp<::android::Fence>::make(presentFence);
+ auto presentFence = mReader.takePresentFence(mPrimaryDisplay);
+ // take ownership
+ const int fenceOwner = presentFence.get();
+ *presentFence.getR() = -1;
+ EXPECT_NE(-1, fenceOwner);
+ return sp<::android::Fence>::make(fenceOwner);
}
int32_t getVsyncPeriod() {
@@ -1592,10 +1588,7 @@
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> layers;
- std::vector<Composition> types;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &layers, &types);
- if (!layers.empty()) {
+ if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
GTEST_SUCCEED() << "Composition change requested, skipping test";
return;
}
@@ -1640,10 +1633,8 @@
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
- std::vector<int64_t> layers;
- std::vector<Composition> types;
- mReader.takeChangedCompositionTypes(mPrimaryDisplay, &layers, &types);
- if (!layers.empty()) {
+
+ if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
GTEST_SUCCEED() << "Composition change requested, skipping test";
return;
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/ReadbackVts.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/ReadbackVts.cpp
index 4de2d71..5eb912b 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/ReadbackVts.cpp
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/ReadbackVts.cpp
@@ -242,13 +242,13 @@
int outBytesPerPixel;
int outBytesPerStride;
- auto status = mGraphicBuffer->lockAsync(mUsage, mAccessRegion, nullptr, fenceHandle.get(),
+ void* bufData = nullptr;
+ auto status = mGraphicBuffer->lockAsync(mUsage, mAccessRegion, &bufData, fenceHandle.get(),
&outBytesPerPixel, &outBytesPerStride);
EXPECT_EQ(::android::OK, status);
ASSERT_TRUE(mPixelFormat == PixelFormat::RGB_888 || mPixelFormat == PixelFormat::RGBA_8888);
- ReadbackHelper::compareColorBuffers(expectedColors, mGraphicBuffer.get(),
- static_cast<int32_t>(mStride), mWidth, mHeight,
- mPixelFormat);
+ ReadbackHelper::compareColorBuffers(expectedColors, bufData, static_cast<int32_t>(mStride),
+ mWidth, mHeight, mPixelFormat);
status = mGraphicBuffer->unlock();
EXPECT_EQ(::android::OK, status);
}
diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h
index 1dc9145..f9e35e9 100644
--- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h
+++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h
@@ -26,40 +26,16 @@
#include <inttypes.h>
#include <string.h>
-#include <aidl/android/hardware/graphics/common/BlendMode.h>
#include <aidl/android/hardware/graphics/composer3/ClientTargetProperty.h>
-#include <aidl/android/hardware/graphics/composer3/Color.h>
#include <aidl/android/hardware/graphics/composer3/Composition.h>
-#include <aidl/android/hardware/graphics/composer3/FloatColor.h>
-#include <aidl/android/hardware/graphics/composer3/HandleIndex.h>
-#include <aidl/android/hardware/graphics/composer3/IComposer.h>
-#include <aidl/android/hardware/graphics/composer3/IComposerClient.h>
-#include <aidl/android/hardware/graphics/composer3/PerFrameMetadata.h>
-#include <aidl/android/hardware/graphics/composer3/PerFrameMetadataBlob.h>
-
#include <aidl/android/hardware/graphics/composer3/CommandResultPayload.h>
-#include <aidl/android/hardware/graphics/composer3/DisplayCommand.h>
-#include <aidl/android/hardware/graphics/common/ColorTransform.h>
-#include <aidl/android/hardware/graphics/common/FRect.h>
-#include <aidl/android/hardware/graphics/common/Rect.h>
-#include <aidl/android/hardware/graphics/common/Transform.h>
#include <log/log.h>
#include <sync/sync.h>
-#include <aidlcommonsupport/NativeHandle.h>
-using aidl::android::hardware::graphics::common::BlendMode;
-using aidl::android::hardware::graphics::common::ColorTransform;
using aidl::android::hardware::graphics::common::Dataspace;
-using aidl::android::hardware::graphics::common::FRect;
-using aidl::android::hardware::graphics::common::Rect;
-using aidl::android::hardware::graphics::common::Transform;
-
-using namespace aidl::android::hardware::graphics::composer3;
-
-using aidl::android::hardware::common::NativeHandle;
namespace aidl::android::hardware::graphics::composer3 {
@@ -69,35 +45,37 @@
// Parse and execute commands from the command queue. The commands are
// actually return values from the server and will be saved in ReturnData.
- void parse(const std::vector<CommandResultPayload>& results) {
+ void parse(std::vector<CommandResultPayload>&& results) {
resetData();
- for (const auto& result : results) {
+ for (auto& result : results) {
switch (result.getTag()) {
case CommandResultPayload::Tag::error:
- parseSetError(result.get<CommandResultPayload::Tag::error>());
+ parseSetError(std::move(result.get<CommandResultPayload::Tag::error>()));
break;
case CommandResultPayload::Tag::changedCompositionTypes:
- parseSetChangedCompositionTypes(
- result.get<CommandResultPayload::Tag::changedCompositionTypes>());
+ parseSetChangedCompositionTypes(std::move(
+ result.get<CommandResultPayload::Tag::changedCompositionTypes>()));
break;
case CommandResultPayload::Tag::displayRequest:
parseSetDisplayRequests(
- result.get<CommandResultPayload::Tag::displayRequest>());
+ std::move(result.get<CommandResultPayload::Tag::displayRequest>()));
break;
case CommandResultPayload::Tag::presentFence:
- parseSetPresentFence(result.get<CommandResultPayload::Tag::presentFence>());
+ parseSetPresentFence(
+ std::move(result.get<CommandResultPayload::Tag::presentFence>()));
break;
case CommandResultPayload::Tag::releaseFences:
- parseSetReleaseFences(result.get<CommandResultPayload::Tag::releaseFences>());
+ parseSetReleaseFences(
+ std::move(result.get<CommandResultPayload::Tag::releaseFences>()));
break;
case CommandResultPayload::Tag::presentOrValidateResult:
- parseSetPresentOrValidateDisplayResult(
- result.get<CommandResultPayload::Tag::presentOrValidateResult>());
+ parseSetPresentOrValidateDisplayResult(std::move(
+ result.get<CommandResultPayload::Tag::presentOrValidateResult>()));
break;
case CommandResultPayload::Tag::clientTargetProperty:
- parseSetClientTargetProperty(
- result.get<CommandResultPayload::Tag::clientTargetProperty>());
+ parseSetClientTargetProperty(std::move(
+ result.get<CommandResultPayload::Tag::clientTargetProperty>()));
break;
}
}
@@ -105,211 +83,140 @@
std::vector<CommandError> takeErrors() { return std::move(mErrors); }
- bool hasChanges(int64_t display, uint32_t* outNumChangedCompositionTypes,
+ void hasChanges(int64_t display, uint32_t* outNumChangedCompositionTypes,
uint32_t* outNumLayerRequestMasks) const {
auto found = mReturnData.find(display);
if (found == mReturnData.end()) {
*outNumChangedCompositionTypes = 0;
*outNumLayerRequestMasks = 0;
- return false;
+ return;
}
const ReturnData& data = found->second;
- *outNumChangedCompositionTypes = static_cast<uint32_t>(data.compositionTypes.size());
- *outNumLayerRequestMasks = static_cast<uint32_t>(data.requestMasks.size());
-
- return !(data.compositionTypes.empty() && data.requestMasks.empty());
+ *outNumChangedCompositionTypes = static_cast<uint32_t>(data.changedLayers.size());
+ *outNumLayerRequestMasks = static_cast<uint32_t>(data.displayRequests.layerRequests.size());
}
// Get and clear saved changed composition types.
- void takeChangedCompositionTypes(int64_t display, std::vector<int64_t>* outLayers,
- std::vector<Composition>* outTypes) {
+ std::vector<ChangedCompositionLayer> takeChangedCompositionTypes(int64_t display) {
auto found = mReturnData.find(display);
if (found == mReturnData.end()) {
- outLayers->clear();
- outTypes->clear();
- return;
+ return {};
}
ReturnData& data = found->second;
-
- *outLayers = std::move(data.changedLayers);
- *outTypes = std::move(data.compositionTypes);
+ return std::move(data.changedLayers);
}
// Get and clear saved display requests.
- void takeDisplayRequests(int64_t display, uint32_t* outDisplayRequestMask,
- std::vector<int64_t>* outLayers,
- std::vector<uint32_t>* outLayerRequestMasks) {
+ DisplayRequest takeDisplayRequests(int64_t display) {
auto found = mReturnData.find(display);
if (found == mReturnData.end()) {
- *outDisplayRequestMask = 0;
- outLayers->clear();
- outLayerRequestMasks->clear();
- return;
+ return {};
}
ReturnData& data = found->second;
-
- *outDisplayRequestMask = data.displayRequests;
- *outLayers = std::move(data.requestedLayers);
- *outLayerRequestMasks = std::move(data.requestMasks);
+ return std::move(data.displayRequests);
}
// Get and clear saved release fences.
- void takeReleaseFences(int64_t display, std::vector<int64_t>* outLayers,
- std::vector<int>* outReleaseFences) {
+ std::vector<ReleaseFences::Layer> takeReleaseFences(int64_t display) {
auto found = mReturnData.find(display);
if (found == mReturnData.end()) {
- outLayers->clear();
- outReleaseFences->clear();
- return;
+ return {};
}
ReturnData& data = found->second;
-
- *outLayers = std::move(data.releasedLayers);
- *outReleaseFences = std::move(data.releaseFences);
+ return std::move(data.releasedLayers);
}
// Get and clear saved present fence.
- void takePresentFence(int64_t display, int* outPresentFence) {
+ ndk::ScopedFileDescriptor takePresentFence(int64_t display) {
auto found = mReturnData.find(display);
if (found == mReturnData.end()) {
- *outPresentFence = -1;
- return;
+ return {};
}
ReturnData& data = found->second;
-
- *outPresentFence = data.presentFence;
- data.presentFence = -1;
+ return std::move(data.presentFence);
}
// Get what stage succeeded during PresentOrValidate: Present or Validate
- void takePresentOrValidateStage(int64_t display, uint32_t* state) {
+ std::optional<PresentOrValidate::Result> takePresentOrValidateStage(int64_t display) {
auto found = mReturnData.find(display);
if (found == mReturnData.end()) {
- *state = static_cast<uint32_t>(-1);
- return;
+ return std::nullopt;
}
ReturnData& data = found->second;
- *state = data.presentOrValidateState;
+ return data.presentOrValidateState;
}
// Get the client target properties requested by hardware composer.
- void takeClientTargetProperty(int64_t display, ClientTargetProperty* outClientTargetProperty,
- float* outWhitePointNits) {
+ ClientTargetPropertyWithNits takeClientTargetProperty(int64_t display) {
auto found = mReturnData.find(display);
// If not found, return the default values.
if (found == mReturnData.end()) {
- outClientTargetProperty->pixelFormat = common::PixelFormat::RGBA_8888;
- outClientTargetProperty->dataspace = Dataspace::UNKNOWN;
- *outWhitePointNits = -1.f;
- return;
+ return ClientTargetPropertyWithNits{
+ .clientTargetProperty = {common::PixelFormat::RGBA_8888, Dataspace::UNKNOWN},
+ .whitePointNits = -1.f,
+ };
}
ReturnData& data = found->second;
- *outClientTargetProperty = data.clientTargetProperty;
- *outWhitePointNits = data.clientTargetWhitePointNits;
+ return std::move(data.clientTargetProperty);
}
private:
void resetData() {
mErrors.clear();
-
- for (auto& data : mReturnData) {
- if (data.second.presentFence >= 0) {
- close(data.second.presentFence);
- }
- for (auto fence : data.second.releaseFences) {
- if (fence >= 0) {
- close(fence);
- }
- }
- }
-
mReturnData.clear();
}
- void parseSetError(const CommandError& error) { mErrors.emplace_back(error); }
+ void parseSetError(CommandError&& error) { mErrors.emplace_back(error); }
- void parseSetChangedCompositionTypes(const ChangedCompositionTypes& changedCompositionTypes) {
+ void parseSetChangedCompositionTypes(ChangedCompositionTypes&& changedCompositionTypes) {
auto& data = mReturnData[changedCompositionTypes.display];
-
- data.changedLayers.reserve(changedCompositionTypes.layers.size());
- data.compositionTypes.reserve(changedCompositionTypes.layers.size());
- for (const auto& layer : changedCompositionTypes.layers) {
- data.changedLayers.push_back(layer.layer);
- data.compositionTypes.push_back(layer.composition);
- }
+ data.changedLayers = std::move(changedCompositionTypes.layers);
}
- void parseSetDisplayRequests(const DisplayRequest& displayRequest) {
+ void parseSetDisplayRequests(DisplayRequest&& displayRequest) {
auto& data = mReturnData[displayRequest.display];
-
- data.displayRequests = displayRequest.mask;
- data.requestedLayers.reserve(displayRequest.layerRequests.size());
- data.requestMasks.reserve(displayRequest.layerRequests.size());
- for (const auto& layerRequest : displayRequest.layerRequests) {
- data.requestedLayers.push_back(layerRequest.layer);
- data.requestMasks.push_back(layerRequest.mask);
- }
+ data.displayRequests = std::move(displayRequest);
}
- void parseSetPresentFence(const PresentFence& presentFence) {
+ void parseSetPresentFence(PresentFence&& presentFence) {
auto& data = mReturnData[presentFence.display];
- if (data.presentFence >= 0) {
- close(data.presentFence);
- }
- data.presentFence = dup(presentFence.fence.get());
+ data.presentFence = std::move(presentFence.fence);
}
- void parseSetReleaseFences(const ReleaseFences& releaseFences) {
+ void parseSetReleaseFences(ReleaseFences&& releaseFences) {
auto& data = mReturnData[releaseFences.display];
- data.releasedLayers.reserve(releaseFences.layers.size());
- data.releaseFences.reserve(releaseFences.layers.size());
- for (const auto& layer : releaseFences.layers) {
- data.releasedLayers.push_back(layer.layer);
- data.releaseFences.push_back(dup(layer.fence.get()));
- }
+ data.releasedLayers = std::move(releaseFences.layers);
}
- void parseSetPresentOrValidateDisplayResult(const PresentOrValidate& presentOrValidate) {
+ void parseSetPresentOrValidateDisplayResult(const PresentOrValidate&& presentOrValidate) {
auto& data = mReturnData[presentOrValidate.display];
- data.presentOrValidateState =
- presentOrValidate.result == PresentOrValidate::Result::Presented ? 1 : 0;
+ data.presentOrValidateState = std::move(presentOrValidate.result);
}
- void parseSetClientTargetProperty(const ClientTargetPropertyWithNits& clientTargetProperty) {
+ void parseSetClientTargetProperty(const ClientTargetPropertyWithNits&& clientTargetProperty) {
auto& data = mReturnData[clientTargetProperty.display];
- data.clientTargetProperty.pixelFormat =
- clientTargetProperty.clientTargetProperty.pixelFormat;
- data.clientTargetProperty.dataspace = clientTargetProperty.clientTargetProperty.dataspace;
- data.clientTargetWhitePointNits = clientTargetProperty.whitePointNits;
+ data.clientTargetProperty = std::move(clientTargetProperty);
}
struct ReturnData {
- int32_t displayRequests = 0;
+ DisplayRequest displayRequests;
+ std::vector<ChangedCompositionLayer> changedLayers;
+ ndk::ScopedFileDescriptor presentFence;
+ std::vector<ReleaseFences::Layer> releasedLayers;
+ PresentOrValidate::Result presentOrValidateState;
- std::vector<int64_t> changedLayers;
- std::vector<Composition> compositionTypes;
-
- std::vector<int64_t> requestedLayers;
- std::vector<uint32_t> requestMasks;
-
- int presentFence = -1;
-
- std::vector<int64_t> releasedLayers;
- std::vector<int> releaseFences;
-
- uint32_t presentOrValidateState;
-
- ClientTargetProperty clientTargetProperty{common::PixelFormat::RGBA_8888,
- Dataspace::UNKNOWN};
- float clientTargetWhitePointNits = -1.f;
+ ClientTargetPropertyWithNits clientTargetProperty = {
+ .clientTargetProperty = {common::PixelFormat::RGBA_8888, Dataspace::UNKNOWN},
+ .whitePointNits = -1.f,
+ };
};
std::vector<CommandError> mErrors;
diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
index 5bab266..16d63e5 100644
--- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
+++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
@@ -30,9 +30,6 @@
#include <aidl/android/hardware/graphics/composer3/Color.h>
#include <aidl/android/hardware/graphics/composer3/Composition.h>
#include <aidl/android/hardware/graphics/composer3/FloatColor.h>
-#include <aidl/android/hardware/graphics/composer3/HandleIndex.h>
-#include <aidl/android/hardware/graphics/composer3/IComposer.h>
-#include <aidl/android/hardware/graphics/composer3/IComposerClient.h>
#include <aidl/android/hardware/graphics/composer3/PerFrameMetadata.h>
#include <aidl/android/hardware/graphics/composer3/PerFrameMetadataBlob.h>
diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/translate-ndk.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/translate-ndk.h
deleted file mode 100644
index 263167e..0000000
--- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/translate-ndk.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * Copyright (c) 2021, 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.
- */
-
-#pragma once
-
-#include <limits>
-#include "aidl/android/hardware/graphics/common/BlendMode.h"
-#include "aidl/android/hardware/graphics/common/FRect.h"
-#include "aidl/android/hardware/graphics/common/Rect.h"
-#include "aidl/android/hardware/graphics/composer3/Capability.h"
-#include "aidl/android/hardware/graphics/composer3/ClientTargetProperty.h"
-#include "aidl/android/hardware/graphics/composer3/Color.h"
-#include "aidl/android/hardware/graphics/composer3/Composition.h"
-#include "aidl/android/hardware/graphics/composer3/ContentType.h"
-#include "aidl/android/hardware/graphics/composer3/DisplayAttribute.h"
-#include "aidl/android/hardware/graphics/composer3/DisplayCapability.h"
-#include "aidl/android/hardware/graphics/composer3/DisplayConnectionType.h"
-#include "aidl/android/hardware/graphics/composer3/FloatColor.h"
-#include "aidl/android/hardware/graphics/composer3/FormatColorComponent.h"
-#include "aidl/android/hardware/graphics/composer3/HandleIndex.h"
-#include "aidl/android/hardware/graphics/composer3/IComposer.h"
-#include "aidl/android/hardware/graphics/composer3/PerFrameMetadata.h"
-#include "aidl/android/hardware/graphics/composer3/PerFrameMetadataBlob.h"
-#include "aidl/android/hardware/graphics/composer3/PerFrameMetadataKey.h"
-#include "aidl/android/hardware/graphics/composer3/PowerMode.h"
-#include "aidl/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.h"
-#include "aidl/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.h"
-#include "android/hardware/graphics/composer/2.1/IComposer.h"
-#include "android/hardware/graphics/composer/2.1/IComposerCallback.h"
-#include "android/hardware/graphics/composer/2.1/IComposerClient.h"
-#include "android/hardware/graphics/composer/2.2/IComposerClient.h"
-#include "android/hardware/graphics/composer/2.3/IComposerClient.h"
-#include "android/hardware/graphics/composer/2.4/IComposerClient.h"
-#include "android/hardware/graphics/composer/2.4/types.h"
-
-namespace android::h2a {
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_4::VsyncPeriodChangeTimeline& in,
- aidl::android::hardware::graphics::composer3::VsyncPeriodChangeTimeline* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_1::IComposerClient::Rect& in,
- aidl::android::hardware::graphics::common::Rect* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_1::IComposerClient::FRect& in,
- aidl::android::hardware::graphics::common::FRect* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_1::IComposerClient::Color& in,
- aidl::android::hardware::graphics::composer3::Color* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_3::IComposerClient::PerFrameMetadata& in,
- aidl::android::hardware::graphics::composer3::PerFrameMetadata* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_2::IComposerClient::FloatColor& in,
- aidl::android::hardware::graphics::composer3::FloatColor* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_3::IComposerClient::PerFrameMetadataBlob&
- in,
- aidl::android::hardware::graphics::composer3::PerFrameMetadataBlob* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_4::IComposerClient::
- VsyncPeriodChangeConstraints& in,
- aidl::android::hardware::graphics::composer3::VsyncPeriodChangeConstraints* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_4::IComposerClient::ClientTargetProperty&
- in,
- aidl::android::hardware::graphics::composer3::ClientTargetProperty* out);
-
-} // namespace android::h2a
diff --git a/health/aidl/Android.bp b/health/aidl/Android.bp
index 6e2f1d4..22bb4fa 100644
--- a/health/aidl/Android.bp
+++ b/health/aidl/Android.bp
@@ -37,7 +37,6 @@
sdk_version: "module_current",
},
ndk: {
- separate_platform_variant: false,
vndk: {
enabled: true,
},
diff --git a/input/classifier/1.0/vts/functional/Android.bp b/input/classifier/1.0/vts/functional/Android.bp
index 58945d3..5ff1457 100644
--- a/input/classifier/1.0/vts/functional/Android.bp
+++ b/input/classifier/1.0/vts/functional/Android.bp
@@ -30,7 +30,10 @@
":inputconstants_aidl",
"VtsHalInputClassifierV1_0TargetTest.cpp",
],
- header_libs: ["jni_headers"],
+ header_libs: [
+ "jni_headers",
+ "libbinder_headers",
+ ],
static_libs: [
"android.hardware.input.classifier@1.0",
"android.hardware.input.common@1.0",
diff --git a/ir/OWNERS b/ir/OWNERS
new file mode 100644
index 0000000..04de9ef
--- /dev/null
+++ b/ir/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 163905
+connoro@google.com
diff --git a/ir/aidl/Android.bp b/ir/aidl/Android.bp
index 8741157..6dacb85 100644
--- a/ir/aidl/Android.bp
+++ b/ir/aidl/Android.bp
@@ -25,7 +25,6 @@
sdk_version: "module_current",
},
ndk: {
- separate_platform_variant: false,
vndk: {
// TODO(b/206116595) enable this
enabled: false,
diff --git a/memtrack/OWNERS b/memtrack/OWNERS
new file mode 100644
index 0000000..a182ed9
--- /dev/null
+++ b/memtrack/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 30545
+connoro@google.com
diff --git a/neuralnetworks/1.3/vts/functional/MemoryDomainTests.cpp b/neuralnetworks/1.3/vts/functional/MemoryDomainTests.cpp
index e2fa6e4..af3641a 100644
--- a/neuralnetworks/1.3/vts/functional/MemoryDomainTests.cpp
+++ b/neuralnetworks/1.3/vts/functional/MemoryDomainTests.cpp
@@ -1158,12 +1158,15 @@
auto [buffer, token] = allocateBuffer(preparedModel, {0}, {0}, kTestOperand.dimensions);
if (buffer == nullptr) return;
- Request::MemoryPool sharedMemory = createSharedMemoryPool(kTestOperandDataSize);
- Request::MemoryPool deviceMemory = createDeviceMemoryPool(token);
+ // Use an incompatible dimension and make sure the length matches with the bad dimension.
auto badDimensions = kTestOperand.dimensions;
badDimensions[0] = 2;
+ const uint32_t badTestOperandDataSize = kTestOperandDataSize * 2;
+
+ Request::MemoryPool sharedMemory = createSharedMemoryPool(badTestOperandDataSize);
+ Request::MemoryPool deviceMemory = createDeviceMemoryPool(token);
RequestArgument sharedMemoryArg = {
- .location = {.poolIndex = 0, .offset = 0, .length = kTestOperandDataSize},
+ .location = {.poolIndex = 0, .offset = 0, .length = badTestOperandDataSize},
.dimensions = badDimensions};
RequestArgument deviceMemoryArg = {.location = {.poolIndex = 1}};
RequestArgument deviceMemoryArgWithBadDimensions = {.location = {.poolIndex = 1},
diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl
index 3342619..c8efea0 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl
@@ -46,8 +46,8 @@
int maxConns;
int waitTime;
boolean enabled;
- android.hardware.radio.data.ApnTypes supportedApnTypesBitmap;
- android.hardware.radio.RadioAccessFamily bearerBitmap;
+ int supportedApnTypesBitmap;
+ int bearerBitmap;
int mtuV4;
int mtuV6;
boolean preferred;
diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/RadioCapability.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/RadioCapability.aidl
index d5716ac..5aaf5a7 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/RadioCapability.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/RadioCapability.aidl
@@ -36,7 +36,7 @@
parcelable RadioCapability {
int session;
int phase;
- android.hardware.radio.RadioAccessFamily raf;
+ int raf;
String logicalModemUuid;
int status;
const int PHASE_CONFIGURED = 0;
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl
index c618791..2b70e45 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl
@@ -50,12 +50,12 @@
oneway void getVoiceRegistrationState(in int serial);
oneway void isNrDualConnectivityEnabled(in int serial);
oneway void responseAcknowledgement();
- oneway void setAllowedNetworkTypesBitmap(in int serial, in android.hardware.radio.RadioAccessFamily networkTypeBitmap);
+ oneway void setAllowedNetworkTypesBitmap(in int serial, in int networkTypeBitmap);
oneway void setBandMode(in int serial, in android.hardware.radio.network.RadioBandMode mode);
oneway void setBarringPassword(in int serial, in String facility, in String oldPassword, in String newPassword);
oneway void setCdmaRoamingPreference(in int serial, in android.hardware.radio.network.CdmaRoamingType type);
oneway void setCellInfoListRate(in int serial, in int rate);
- oneway void setIndicationFilter(in int serial, in android.hardware.radio.network.IndicationFilter indicationFilter);
+ oneway void setIndicationFilter(in int serial, in int indicationFilter);
oneway void setLinkCapacityReportingCriteria(in int serial, in int hysteresisMs, in int hysteresisDlKbps, in int hysteresisUlKbps, in int[] thresholdsDownlinkKbps, in int[] thresholdsUplinkKbps, in android.hardware.radio.AccessNetwork accessNetwork);
oneway void setLocationUpdates(in int serial, in boolean enable);
oneway void setNetworkSelectionModeAutomatic(in int serial);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl
index d135a69..bd03c51 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl
@@ -44,7 +44,7 @@
oneway void networkScanResult(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.NetworkScanResult result);
oneway void networkStateChanged(in android.hardware.radio.RadioIndicationType type);
oneway void nitzTimeReceived(in android.hardware.radio.RadioIndicationType type, in String nitzTime, in long receivedTimeMs, in long ageMs);
- oneway void registrationFailed(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.CellIdentity cellIdentity, in String chosenPlmn, in android.hardware.radio.network.Domain domain, in int causeCode, in int additionalCauseCode);
+ oneway void registrationFailed(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.CellIdentity cellIdentity, in String chosenPlmn, in int domain, in int causeCode, in int additionalCauseCode);
oneway void restrictedStateChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.PhoneRestrictedState state);
oneway void suppSvcNotify(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.SuppSvcNotification suppSvc);
oneway void voiceRadioTechChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.RadioTechnology rat);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl
index 8cf4c31..5f6c736 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl
@@ -35,7 +35,7 @@
@VintfStability
interface IRadioNetworkResponse {
oneway void acknowledgeRequest(in int serial);
- oneway void getAllowedNetworkTypesBitmapResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.RadioAccessFamily networkTypeBitmap);
+ oneway void getAllowedNetworkTypesBitmapResponse(in android.hardware.radio.RadioResponseInfo info, in int networkTypeBitmap);
oneway void getAvailableBandModesResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RadioBandMode[] bandModes);
oneway void getAvailableNetworksResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.OperatorInfo[] networkInfos);
oneway void getBarringInfoResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CellIdentity cellIdentity, in android.hardware.radio.network.BarringInfo[] barringInfos);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyNumber.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyNumber.aidl
index 4f415ee..39bcf1a 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyNumber.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyNumber.aidl
@@ -37,7 +37,7 @@
String number;
String mcc;
String mnc;
- android.hardware.radio.voice.EmergencyServiceCategory categories;
+ int categories;
String[] urns;
int sources;
const int SOURCE_NETWORK_SIGNALING = 1;
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoice.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoice.aidl
index 68c82fa..34d155a 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoice.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoice.aidl
@@ -37,7 +37,7 @@
oneway void acceptCall(in int serial);
oneway void conference(in int serial);
oneway void dial(in int serial, in android.hardware.radio.voice.Dial dialInfo);
- oneway void emergencyDial(in int serial, in android.hardware.radio.voice.Dial dialInfo, in android.hardware.radio.voice.EmergencyServiceCategory categories, in String[] urns, in android.hardware.radio.voice.EmergencyCallRouting routing, in boolean hasKnownUserIntentEmergency, in boolean isTesting);
+ oneway void emergencyDial(in int serial, in android.hardware.radio.voice.Dial dialInfo, in int categories, in String[] urns, in android.hardware.radio.voice.EmergencyCallRouting routing, in boolean hasKnownUserIntentEmergency, in boolean isTesting);
oneway void exitEmergencyCallbackMode(in int serial);
oneway void explicitCallTransfer(in int serial);
oneway void getCallForwardStatus(in int serial, in android.hardware.radio.voice.CallForwardInfo callInfo);
diff --git a/radio/aidl/android/hardware/radio/data/DataProfileInfo.aidl b/radio/aidl/android/hardware/radio/data/DataProfileInfo.aidl
index 0f06119..7360202 100644
--- a/radio/aidl/android/hardware/radio/data/DataProfileInfo.aidl
+++ b/radio/aidl/android/hardware/radio/data/DataProfileInfo.aidl
@@ -93,11 +93,11 @@
/**
* Supported APN types bitmap. See ApnTypes for the value of each bit.
*/
- ApnTypes supportedApnTypesBitmap;
+ int supportedApnTypesBitmap;
/**
* The bearer bitmap. See RadioAccessFamily for the value of each bit.
*/
- RadioAccessFamily bearerBitmap;
+ int bearerBitmap;
/**
* Maximum transmission unit (MTU) size in bytes for IPv4.
*/
diff --git a/radio/aidl/android/hardware/radio/modem/RadioCapability.aidl b/radio/aidl/android/hardware/radio/modem/RadioCapability.aidl
index b7b8ef3..9bd5f21 100644
--- a/radio/aidl/android/hardware/radio/modem/RadioCapability.aidl
+++ b/radio/aidl/android/hardware/radio/modem/RadioCapability.aidl
@@ -71,7 +71,7 @@
/**
* 32-bit bitmap of RadioAccessFamily.
*/
- RadioAccessFamily raf;
+ int raf;
/**
* A UUID typically "com.xxxx.lmX" where X is the logical modem.
* RadioConst:MAX_UUID_LENGTH is the max length.
diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl
index aaf432a..7a22a9a 100644
--- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl
+++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl
@@ -195,7 +195,7 @@
*
* Response function is IRadioNetworkResponse.setAllowedNetworkTypesBitmapResponse()
*/
- void setAllowedNetworkTypesBitmap(in int serial, in RadioAccessFamily networkTypeBitmap);
+ void setAllowedNetworkTypesBitmap(in int serial, in int networkTypeBitmap);
/**
* Assign a specified band for RF configuration.
@@ -253,7 +253,7 @@
*
* Response function is IRadioNetworkResponse.setIndicationFilterResponse()
*/
- void setIndicationFilter(in int serial, in IndicationFilter indicationFilter);
+ void setIndicationFilter(in int serial, in int indicationFilter);
/**
* Sets the link capacity reporting criteria. The resulting reporting criteria are the AND of
diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl
index ba7610d..6863ac3 100644
--- a/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl
+++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl
@@ -136,8 +136,8 @@
* include the time spend in sleep / low power states. If it can not be guaranteed,
* there must not be any caching done at the modem and should fill in 0 for ageMs
*/
- void nitzTimeReceived(in RadioIndicationType type, in String nitzTime,
- in long receivedTimeMs, in long ageMs);
+ void nitzTimeReceived(
+ in RadioIndicationType type, in String nitzTime, in long receivedTimeMs, in long ageMs);
/**
* Report that Registration or a Location/Routing/Tracking Area update has failed.
@@ -165,7 +165,7 @@
* MAX_INT if this value is unused.
*/
void registrationFailed(in RadioIndicationType type, in CellIdentity cellIdentity,
- in String chosenPlmn, in Domain domain, in int causeCode, in int additionalCauseCode);
+ in String chosenPlmn, in int domain, in int causeCode, in int additionalCauseCode);
/**
* Indicates a restricted state change (eg, for Domain Specific Access Control).
diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl
index 30f4221..e650321 100644
--- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl
+++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl
@@ -62,8 +62,7 @@
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:NO_RESOURCES
*/
- void getAllowedNetworkTypesBitmapResponse(
- in RadioResponseInfo info, in RadioAccessFamily networkTypeBitmap);
+ void getAllowedNetworkTypesBitmapResponse(in RadioResponseInfo info, in int networkTypeBitmap);
/**
* @param info Response info struct containing response type, serial no. and error
diff --git a/radio/aidl/android/hardware/radio/voice/EmergencyNumber.aidl b/radio/aidl/android/hardware/radio/voice/EmergencyNumber.aidl
index aa4dde2..ddc5d76 100644
--- a/radio/aidl/android/hardware/radio/voice/EmergencyNumber.aidl
+++ b/radio/aidl/android/hardware/radio/voice/EmergencyNumber.aidl
@@ -78,7 +78,7 @@
* The bitfield of EmergencyServiceCategory(s). See EmergencyServiceCategory for the value of
* each bit.
*/
- EmergencyServiceCategory categories;
+ int categories;
/**
* The list of emergency Uniform Resource Names (URN).
*/
diff --git a/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl b/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl
index a012be4..b25e63d 100644
--- a/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl
+++ b/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl
@@ -117,9 +117,9 @@
*
* Response function is IRadioVoiceResponse.emergencyDialResponse()
*/
- void emergencyDial(in int serial, in Dial dialInfo, in EmergencyServiceCategory categories,
- in String[] urns, in EmergencyCallRouting routing,
- in boolean hasKnownUserIntentEmergency, in boolean isTesting);
+ void emergencyDial(in int serial, in Dial dialInfo, in int categories, in String[] urns,
+ in EmergencyCallRouting routing, in boolean hasKnownUserIntentEmergency,
+ in boolean isTesting);
/**
* Request the radio's system selection module to exit emergency callback mode. Radio must not
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h
index ec76300..1731b78 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h
@@ -41,9 +41,8 @@
::ndk::ScopedAStatus getVoiceRegistrationState(int32_t serial) override;
::ndk::ScopedAStatus isNrDualConnectivityEnabled(int32_t serial) override;
::ndk::ScopedAStatus responseAcknowledgement() override;
- ::ndk::ScopedAStatus setAllowedNetworkTypesBitmap(
- int32_t serial,
- ::aidl::android::hardware::radio::RadioAccessFamily networkTypeBitmap) override;
+ ::ndk::ScopedAStatus setAllowedNetworkTypesBitmap(int32_t serial,
+ int32_t networkTypeBitmap) override;
::ndk::ScopedAStatus setBandMode(
int32_t serial, ::aidl::android::hardware::radio::network::RadioBandMode mode) override;
::ndk::ScopedAStatus setBarringPassword(int32_t serial, const std::string& facility,
@@ -53,9 +52,7 @@
int32_t serial,
::aidl::android::hardware::radio::network::CdmaRoamingType type) override;
::ndk::ScopedAStatus setCellInfoListRate(int32_t serial, int32_t rate) override;
- ::ndk::ScopedAStatus setIndicationFilter(
- int32_t serial,
- ::aidl::android::hardware::radio::network::IndicationFilter indicationFilter) override;
+ ::ndk::ScopedAStatus setIndicationFilter(int32_t serial, int32_t indicationFilter) override;
::ndk::ScopedAStatus setLinkCapacityReportingCriteria(
int32_t serial, int32_t hysteresisMs, int32_t hysteresisDlKbps,
int32_t hysteresisUlKbps, const std::vector<int32_t>& thresholdsDownlinkKbps,
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h
index 5839e3a..a0e1e82 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h
@@ -31,8 +31,7 @@
int32_t serial, const ::aidl::android::hardware::radio::voice::Dial& dialInfo) override;
::ndk::ScopedAStatus emergencyDial(
int32_t serial, const ::aidl::android::hardware::radio::voice::Dial& dialInfo,
- ::aidl::android::hardware::radio::voice::EmergencyServiceCategory categories,
- const std::vector<std::string>& urns,
+ int32_t categories, const std::vector<std::string>& urns,
::aidl::android::hardware::radio::voice::EmergencyCallRouting routing,
bool hasKnownUserIntentEmergency, bool isTesting) override;
::ndk::ScopedAStatus exitEmergencyCallbackMode(int32_t serial) override;
diff --git a/radio/aidl/compat/libradiocompat/modem/structs.cpp b/radio/aidl/compat/libradiocompat/modem/structs.cpp
index 53d5753..69e651b 100644
--- a/radio/aidl/compat/libradiocompat/modem/structs.cpp
+++ b/radio/aidl/compat/libradiocompat/modem/structs.cpp
@@ -25,7 +25,6 @@
namespace android::hardware::radio::compat {
using ::aidl::android::hardware::radio::AccessNetwork;
-using ::aidl::android::hardware::radio::RadioAccessFamily;
using ::aidl::android::hardware::radio::RadioTechnology;
namespace aidl = ::aidl::android::hardware::radio::modem;
@@ -40,7 +39,7 @@
return {
.session = capa.session,
.phase = static_cast<int32_t>(capa.phase),
- .raf = RadioAccessFamily(capa.raf),
+ .raf = static_cast<int32_t>(capa.raf),
.logicalModemUuid = capa.logicalModemUuid,
.status = static_cast<int32_t>(capa.status),
};
diff --git a/radio/aidl/compat/libradiocompat/network/RadioIndication-network.cpp b/radio/aidl/compat/libradiocompat/network/RadioIndication-network.cpp
index d4cbdbc..4eb99f7 100644
--- a/radio/aidl/compat/libradiocompat/network/RadioIndication-network.cpp
+++ b/radio/aidl/compat/libradiocompat/network/RadioIndication-network.cpp
@@ -208,8 +208,8 @@
const hidl_string& chosenPlmn, hidl_bitfield<V1_5::Domain> domain, int32_t causeCode,
int32_t additionalCauseCode) {
LOG_CALL << type;
- networkCb()->registrationFailed(toAidl(type), toAidl(cellIdentity), chosenPlmn,
- aidl::Domain(domain), causeCode, additionalCauseCode);
+ networkCb()->registrationFailed(toAidl(type), toAidl(cellIdentity), chosenPlmn, domain,
+ causeCode, additionalCauseCode);
return {};
}
diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp
index 8bfa0bb..d3b6002 100644
--- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp
+++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp
@@ -28,7 +28,6 @@
namespace android::hardware::radio::compat {
using ::aidl::android::hardware::radio::AccessNetwork;
-using ::aidl::android::hardware::radio::RadioAccessFamily;
using ::ndk::ScopedAStatus;
namespace aidl = ::aidl::android::hardware::radio::network;
constexpr auto ok = &ScopedAStatus::ok;
@@ -161,7 +160,7 @@
return ok();
}
-ScopedAStatus RadioNetwork::setAllowedNetworkTypesBitmap(int32_t serial, RadioAccessFamily ntype) {
+ScopedAStatus RadioNetwork::setAllowedNetworkTypesBitmap(int32_t serial, int32_t ntype) {
LOG_CALL << serial;
const auto raf = toHidlBitfield<V1_4::RadioAccessFamily>(ntype);
if (mHal1_6) {
@@ -197,7 +196,7 @@
return ok();
}
-ScopedAStatus RadioNetwork::setIndicationFilter(int32_t serial, aidl::IndicationFilter indFilter) {
+ScopedAStatus RadioNetwork::setIndicationFilter(int32_t serial, int32_t indFilter) {
LOG_CALL << serial;
mHal1_5->setIndicationFilter_1_5(serial, toHidlBitfield<V1_5::IndicationFilter>(indFilter));
return ok();
diff --git a/radio/aidl/compat/libradiocompat/network/RadioResponse-network.cpp b/radio/aidl/compat/libradiocompat/network/RadioResponse-network.cpp
index bab1d4a..5a98eb2 100644
--- a/radio/aidl/compat/libradiocompat/network/RadioResponse-network.cpp
+++ b/radio/aidl/compat/libradiocompat/network/RadioResponse-network.cpp
@@ -27,7 +27,6 @@
namespace android::hardware::radio::compat {
-using ::aidl::android::hardware::radio::RadioAccessFamily;
using ::aidl::android::hardware::radio::RadioTechnology;
using ::aidl::android::hardware::radio::RadioTechnologyFamily;
namespace aidl = ::aidl::android::hardware::radio::network;
@@ -44,16 +43,14 @@
const V1_6::RadioResponseInfo& info,
hidl_bitfield<V1_4::RadioAccessFamily> networkTypeBitmap) {
LOG_CALL << info.serial;
- networkCb()->getAllowedNetworkTypesBitmapResponse(toAidl(info),
- RadioAccessFamily(networkTypeBitmap));
+ networkCb()->getAllowedNetworkTypesBitmapResponse(toAidl(info), networkTypeBitmap);
return {};
}
Return<void> RadioResponse::getPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info,
V1_0::PreferredNetworkType nwType) {
LOG_CALL << info.serial;
- networkCb()->getAllowedNetworkTypesBitmapResponse( //
- toAidl(info), RadioAccessFamily(getRafFromNetworkType(nwType)));
+ networkCb()->getAllowedNetworkTypesBitmapResponse(toAidl(info), getRafFromNetworkType(nwType));
return {};
}
diff --git a/radio/aidl/compat/libradiocompat/voice/RadioVoice.cpp b/radio/aidl/compat/libradiocompat/voice/RadioVoice.cpp
index 7b1d1fa..71d1a56 100644
--- a/radio/aidl/compat/libradiocompat/voice/RadioVoice.cpp
+++ b/radio/aidl/compat/libradiocompat/voice/RadioVoice.cpp
@@ -53,7 +53,7 @@
}
ScopedAStatus RadioVoice::emergencyDial( //
- int32_t serial, const aidl::Dial& info, aidl::EmergencyServiceCategory categories,
+ int32_t serial, const aidl::Dial& info, int32_t categories,
const std::vector<std::string>& urns, aidl::EmergencyCallRouting routing,
bool knownUserIntentEmerg, bool isTesting) {
LOG_CALL << serial;
diff --git a/radio/aidl/compat/libradiocompat/voice/structs.cpp b/radio/aidl/compat/libradiocompat/voice/structs.cpp
index ae6342e..254ea20 100644
--- a/radio/aidl/compat/libradiocompat/voice/structs.cpp
+++ b/radio/aidl/compat/libradiocompat/voice/structs.cpp
@@ -147,7 +147,7 @@
.number = num.number,
.mcc = num.mcc,
.mnc = num.mnc,
- .categories = aidl::EmergencyServiceCategory(num.categories),
+ .categories = num.categories,
.urns = toAidl(num.urns),
.sources = num.sources,
};
diff --git a/radio/aidl/compat/service/service.cpp b/radio/aidl/compat/service/service.cpp
index 7433fee..8af05de 100644
--- a/radio/aidl/compat/service/service.cpp
+++ b/radio/aidl/compat/service/service.cpp
@@ -81,6 +81,7 @@
}
static void main() {
+ base::InitLogging(nullptr, base::LogdLogger(base::RADIO));
base::SetDefaultTag("radiocompat");
base::SetMinimumLogSeverity(base::VERBOSE);
LOG(DEBUG) << "Radio HAL compat service starting...";
diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp
index 935d2e5..8060e4b 100644
--- a/radio/aidl/vts/Android.bp
+++ b/radio/aidl/vts/Android.bp
@@ -29,6 +29,9 @@
],
srcs: [
"radio_aidl_hal_utils.cpp",
+ "radio_config_indication.cpp",
+ "radio_config_response.cpp",
+ "radio_config_test.cpp",
"radio_data_indication.cpp",
"radio_data_response.cpp",
"radio_data_test.cpp",
diff --git a/radio/aidl/vts/VtsHalRadioTargetTest.cpp b/radio/aidl/vts/VtsHalRadioTargetTest.cpp
index e829f8e..1ebc6af 100644
--- a/radio/aidl/vts/VtsHalRadioTargetTest.cpp
+++ b/radio/aidl/vts/VtsHalRadioTargetTest.cpp
@@ -16,6 +16,7 @@
#include <android/binder_process.h>
+#include "radio_config_utils.h"
#include "radio_data_utils.h"
#include "radio_messaging_utils.h"
#include "radio_modem_utils.h"
@@ -23,6 +24,12 @@
#include "radio_sim_utils.h"
#include "radio_voice_utils.h"
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioConfigTest);
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, RadioConfigTest,
+ testing::ValuesIn(android::getAidlHalInstanceNames(IRadioConfig::descriptor)),
+ android::PrintInstanceNameToString);
+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioDataTest);
INSTANTIATE_TEST_SUITE_P(
PerInstance, RadioDataTest,
diff --git a/radio/aidl/vts/radio_aidl_hal_utils.cpp b/radio/aidl/vts/radio_aidl_hal_utils.cpp
index 14a16c0..dc61a3c 100644
--- a/radio/aidl/vts/radio_aidl_hal_utils.cpp
+++ b/radio/aidl/vts/radio_aidl_hal_utils.cpp
@@ -18,12 +18,14 @@
#include "radio_aidl_hal_utils.h"
#include <iostream>
#include "VtsCoreUtil.h"
-
-using namespace aidl::android::hardware::radio::network;
+#include "radio_config_utils.h"
+#include "radio_sim_utils.h"
#define WAIT_TIMEOUT_PERIOD 75
-aidl::android::hardware::radio::sim::CardStatus cardStatus = {};
+sim::CardStatus cardStatus = {};
+int serial = 0;
+int count_ = 0;
int GetRandomSerialNumber() {
return rand();
@@ -103,23 +105,33 @@
RegState::UNKNOWN_EM == state;
}
+bool stringEndsWith(std::string const& string, std::string const& end) {
+ if (string.size() >= end.size()) {
+ return (0 == string.compare(string.size() - end.size() - 1, end.size(), end));
+ } else {
+ return false;
+ }
+}
+
bool isServiceValidForDeviceConfiguration(std::string& serviceName) {
if (isSsSsEnabled()) {
// Device is configured as SSSS.
- if (serviceName != RADIO_SERVICE_SLOT1_NAME) {
+ if (stringEndsWith(serviceName, RADIO_SERVICE_SLOT1_NAME)) {
ALOGI("%s instance is not valid for SSSS device.", serviceName.c_str());
return false;
}
} else if (isDsDsEnabled()) {
// Device is configured as DSDS.
- if (serviceName != RADIO_SERVICE_SLOT1_NAME && serviceName != RADIO_SERVICE_SLOT2_NAME) {
+ if (!stringEndsWith(serviceName, RADIO_SERVICE_SLOT1_NAME) &&
+ !stringEndsWith(serviceName, RADIO_SERVICE_SLOT2_NAME)) {
ALOGI("%s instance is not valid for DSDS device.", serviceName.c_str());
return false;
}
} else if (isTsTsEnabled()) {
// Device is configured as TSTS.
- if (serviceName != RADIO_SERVICE_SLOT1_NAME && serviceName != RADIO_SERVICE_SLOT2_NAME &&
- serviceName != RADIO_SERVICE_SLOT3_NAME) {
+ if (!stringEndsWith(serviceName, RADIO_SERVICE_SLOT1_NAME) &&
+ !stringEndsWith(serviceName, RADIO_SERVICE_SLOT2_NAME) &&
+ !stringEndsWith(serviceName, RADIO_SERVICE_SLOT3_NAME)) {
ALOGI("%s instance is not valid for TSTS device.", serviceName.c_str());
return false;
}
@@ -130,7 +142,7 @@
/*
* Notify that the response message is received.
*/
-void RadioResponseWaiter::notify(int receivedSerial) {
+void RadioServiceTest::notify(int receivedSerial) {
std::unique_lock<std::mutex> lock(mtx_);
if (serial == receivedSerial) {
count_++;
@@ -141,7 +153,7 @@
/*
* Wait till the response message is notified or till WAIT_TIMEOUT_PERIOD.
*/
-std::cv_status RadioResponseWaiter::wait() {
+std::cv_status RadioServiceTest::wait() {
std::unique_lock<std::mutex> lock(mtx_);
std::cv_status status = std::cv_status::no_timeout;
auto now = std::chrono::system_clock::now();
@@ -158,19 +170,37 @@
/**
* Specific features on the Radio HAL rely on Radio HAL Capabilities.
* The VTS test related to those features must not run if the related capability is disabled.
- * Typical usage within VTS: if (getRadioHalCapabilities()) return;
+ * Typical usage within VTS:
+ * if (getRadioHalCapabilities()) return;
*/
-bool RadioResponseWaiter::getRadioHalCapabilities() {
- // TODO(b/210712359): implement after RadioConfig VTS is created
- /**
- // Get HalDeviceCapabilities from the radio config
- std::shared_ptr<RadioConfigResponse> radioConfigRsp = new (std::nothrow)
- RadioConfigResponse(*this); radioConfig->setResponseFunctions(radioConfigRsp, nullptr); serial =
- GetRandomSerialNumber();
-
- radioConfig->getHalDeviceCapabilities(serial);
+bool RadioServiceTest::getRadioHalCapabilities() {
+ // Get HalDeviceCapabilities from RadioConfig
+ std::shared_ptr<RadioConfigResponse> radioConfigRsp =
+ ndk::SharedRefBase::make<RadioConfigResponse>(*this);
+ std::shared_ptr<RadioConfigIndication> radioConfigInd =
+ ndk::SharedRefBase::make<RadioConfigIndication>(*this);
+ radio_config->setResponseFunctions(radioConfigRsp, radioConfigInd);
+ serial = GetRandomSerialNumber();
+ radio_config->getHalDeviceCapabilities(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
return radioConfigRsp->modemReducedFeatureSet1;
- **/
- return true;
-}
\ No newline at end of file
+}
+
+/**
+ * Some VTS tests require the SIM card status to be present before running.
+ * Update the SIM card status, which can be accessed via the extern cardStatus.
+ */
+void RadioServiceTest::updateSimCardStatus() {
+ // Update CardStatus from RadioSim
+ std::shared_ptr<RadioSimResponse> radioSimRsp =
+ ndk::SharedRefBase::make<RadioSimResponse>(*this);
+ std::shared_ptr<RadioSimIndication> radioSimInd =
+ ndk::SharedRefBase::make<RadioSimIndication>(*this);
+ radio_sim->setResponseFunctions(radioSimRsp, radioSimInd);
+ serial = GetRandomSerialNumber();
+ radio_sim->getIccCardStatus(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioSimRsp->rspInfo.type);
+ EXPECT_EQ(serial, radioSimRsp->rspInfo.serial);
+ EXPECT_EQ(RadioError::NONE, radioSimRsp->rspInfo.error);
+}
diff --git a/radio/aidl/vts/radio_aidl_hal_utils.h b/radio/aidl/vts/radio_aidl_hal_utils.h
index 2f31fa8..414ffbc 100644
--- a/radio/aidl/vts/radio_aidl_hal_utils.h
+++ b/radio/aidl/vts/radio_aidl_hal_utils.h
@@ -19,15 +19,20 @@
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
#include <aidl/android/hardware/radio/RadioError.h>
+#include <aidl/android/hardware/radio/config/IRadioConfig.h>
#include <aidl/android/hardware/radio/network/RegState.h>
#include <aidl/android/hardware/radio/sim/CardStatus.h>
+#include <aidl/android/hardware/radio/sim/IRadioSim.h>
#include <utils/Log.h>
#include <vector>
using namespace aidl::android::hardware::radio;
+using aidl::android::hardware::radio::network::RegState;
using aidl::android::hardware::radio::sim::CardStatus;
extern CardStatus cardStatus;
+extern int serial;
+extern int count_;
/*
* MACRO used to skip test case when radio response return error REQUEST_NOT_SUPPORTED
@@ -102,12 +107,12 @@
/*
* Check if voice status is in emergency only.
*/
-bool isVoiceEmergencyOnly(aidl::android::hardware::radio::network::RegState state);
+bool isVoiceEmergencyOnly(RegState state);
/*
* Check if voice status is in service.
*/
-bool isVoiceInService(aidl::android::hardware::radio::network::RegState state);
+bool isVoiceInService(RegState state);
/*
* Check if service is valid for device configuration
@@ -115,26 +120,25 @@
bool isServiceValidForDeviceConfiguration(std::string& serviceName);
/**
- * Used when waiting for an asynchronous response from the HAL.
+ * RadioServiceTest base class
*/
-class RadioResponseWaiter {
+class RadioServiceTest {
protected:
std::mutex mtx_;
std::condition_variable cv_;
- int count_;
+ std::shared_ptr<config::IRadioConfig> radio_config;
+ std::shared_ptr<sim::IRadioSim> radio_sim;
public:
- /* Serial number for radio request */
- int serial;
-
/* Used as a mechanism to inform the test about data/event callback */
void notify(int receivedSerial);
/* Test code calls this function to wait for response */
std::cv_status wait();
- // TODO(b/210712359): this probably isn't the best place to put this, but it works for now
- // since all RadioXTest extend RadioResponseWaiter
- /* Used to get the radio HAL capabilities */
+ /* Get the radio HAL capabilities */
bool getRadioHalCapabilities();
+
+ /* Update SIM card status */
+ void updateSimCardStatus();
};
diff --git a/radio/aidl/vts/radio_config_indication.cpp b/radio/aidl/vts/radio_config_indication.cpp
new file mode 100644
index 0000000..a84c20b
--- /dev/null
+++ b/radio/aidl/vts/radio_config_indication.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#include "radio_config_utils.h"
+
+RadioConfigIndication::RadioConfigIndication(RadioServiceTest& parent) : parent_config(parent) {}
+
+ndk::ScopedAStatus RadioConfigIndication::simSlotsStatusChanged(
+ RadioIndicationType /*type*/, const std::vector<SimSlotStatus>& /*slotStatus*/) {
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_config_response.cpp b/radio/aidl/vts/radio_config_response.cpp
new file mode 100644
index 0000000..1a152fb
--- /dev/null
+++ b/radio/aidl/vts/radio_config_response.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#include "radio_config_utils.h"
+
+RadioConfigResponse::RadioConfigResponse(RadioServiceTest& parent) : parent_config(parent) {}
+
+ndk::ScopedAStatus RadioConfigResponse::getSimSlotsStatusResponse(
+ const RadioResponseInfo& /* info */, const std::vector<SimSlotStatus>& /* slotStatus */) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioConfigResponse::setSimSlotsMappingResponse(
+ const RadioResponseInfo& /* info */) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioConfigResponse::getPhoneCapabilityResponse(
+ const RadioResponseInfo& info, const PhoneCapability& phoneCapability) {
+ rspInfo = info;
+ phoneCap = phoneCapability;
+ parent_config.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioConfigResponse::setPreferredDataModemResponse(
+ const RadioResponseInfo& /* info */) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioConfigResponse::getNumOfLiveModemsResponse(
+ const RadioResponseInfo& /* info */, const int8_t /* numOfLiveModems */) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioConfigResponse::setNumOfLiveModemsResponse(
+ const RadioResponseInfo& /* info */) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioConfigResponse::getHalDeviceCapabilitiesResponse(
+ const RadioResponseInfo& info, bool modemReducedFeatures) {
+ modemReducedFeatureSet1 = modemReducedFeatures;
+ parent_config.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_config_test.cpp b/radio/aidl/vts/radio_config_test.cpp
new file mode 100644
index 0000000..2d7fe01
--- /dev/null
+++ b/radio/aidl/vts/radio_config_test.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+
+#include "radio_config_utils.h"
+
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+
+void RadioConfigTest::SetUp() {
+ std::string serviceName = GetParam();
+
+ if (!isServiceValidForDeviceConfiguration(serviceName)) {
+ ALOGI("Skipped the test due to device configuration.");
+ GTEST_SKIP();
+ }
+
+ radio_config = IRadioConfig::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
+ ASSERT_NE(nullptr, radio_config.get());
+
+ radioRsp_config = ndk::SharedRefBase::make<RadioConfigResponse>(*this);
+ ASSERT_NE(nullptr, radioRsp_config.get());
+
+ count_ = 0;
+
+ radioInd_config = ndk::SharedRefBase::make<RadioConfigIndication>(*this);
+ ASSERT_NE(nullptr, radioInd_config.get());
+
+ radio_config->setResponseFunctions(radioRsp_config, radioInd_config);
+}
+
+/*
+ * Test IRadioConfig.getHalDeviceCapabilities() for the response returned.
+ */
+TEST_P(RadioConfigTest, getHalDeviceCapabilities) {
+ serial = GetRandomSerialNumber();
+ ndk::ScopedAStatus res = radio_config->getHalDeviceCapabilities(serial);
+ ASSERT_OK(res);
+ ALOGI("getHalDeviceCapabilities, rspInfo.error = %s\n",
+ toString(radioRsp_config->rspInfo.error).c_str());
+}
diff --git a/radio/aidl/vts/radio_config_utils.h b/radio/aidl/vts/radio_config_utils.h
new file mode 100644
index 0000000..465c106
--- /dev/null
+++ b/radio/aidl/vts/radio_config_utils.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/radio/config/BnRadioConfigIndication.h>
+#include <aidl/android/hardware/radio/config/BnRadioConfigResponse.h>
+#include <aidl/android/hardware/radio/config/IRadioConfig.h>
+
+#include "radio_aidl_hal_utils.h"
+
+using namespace aidl::android::hardware::radio::config;
+
+class RadioConfigTest;
+
+/* Callback class for radio config response */
+class RadioConfigResponse : public BnRadioConfigResponse {
+ protected:
+ RadioServiceTest& parent_config;
+
+ public:
+ RadioConfigResponse(RadioServiceTest& parent_config);
+ virtual ~RadioConfigResponse() = default;
+
+ RadioResponseInfo rspInfo;
+ PhoneCapability phoneCap;
+ bool modemReducedFeatureSet1;
+
+ virtual ndk::ScopedAStatus getSimSlotsStatusResponse(
+ const RadioResponseInfo& info, const std::vector<SimSlotStatus>& slotStatus) override;
+
+ virtual ndk::ScopedAStatus setSimSlotsMappingResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus getPhoneCapabilityResponse(
+ const RadioResponseInfo& info, const PhoneCapability& phoneCapability) override;
+
+ virtual ndk::ScopedAStatus setPreferredDataModemResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus getNumOfLiveModemsResponse(const RadioResponseInfo& info,
+ const int8_t numOfLiveModems) override;
+
+ virtual ndk::ScopedAStatus setNumOfLiveModemsResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus getHalDeviceCapabilitiesResponse(
+ const RadioResponseInfo& info, bool modemReducedFeatureSet1) override;
+};
+
+/* Callback class for radio config indication */
+class RadioConfigIndication : public BnRadioConfigIndication {
+ protected:
+ RadioServiceTest& parent_config;
+
+ public:
+ RadioConfigIndication(RadioServiceTest& parent_config);
+ virtual ~RadioConfigIndication() = default;
+
+ virtual ndk::ScopedAStatus simSlotsStatusChanged(
+ RadioIndicationType type, const std::vector<SimSlotStatus>& slotStatus) override;
+};
+
+// The main test class for Radio AIDL Config.
+class RadioConfigTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
+ public:
+ virtual void SetUp() override;
+ ndk::ScopedAStatus updateSimCardStatus();
+
+ /* radio config service handle in RadioServiceTest */
+ /* radio config response handle */
+ std::shared_ptr<RadioConfigResponse> radioRsp_config;
+ /* radio config indication handle */
+ std::shared_ptr<RadioConfigIndication> radioInd_config;
+};
diff --git a/radio/aidl/vts/radio_data_indication.cpp b/radio/aidl/vts/radio_data_indication.cpp
index 1e02fe1..4d3c539 100644
--- a/radio/aidl/vts/radio_data_indication.cpp
+++ b/radio/aidl/vts/radio_data_indication.cpp
@@ -16,7 +16,7 @@
#include "radio_data_utils.h"
-RadioDataIndication::RadioDataIndication(RadioDataTest& parent) : parent_data(parent) {}
+RadioDataIndication::RadioDataIndication(RadioServiceTest& parent) : parent_data(parent) {}
ndk::ScopedAStatus RadioDataIndication::dataCallListChanged(
RadioIndicationType /*type*/, const std::vector<SetupDataCallResult>& /*dcList*/) {
diff --git a/radio/aidl/vts/radio_data_response.cpp b/radio/aidl/vts/radio_data_response.cpp
index 682ddfb..9b17bfb 100644
--- a/radio/aidl/vts/radio_data_response.cpp
+++ b/radio/aidl/vts/radio_data_response.cpp
@@ -16,7 +16,7 @@
#include "radio_data_utils.h"
-RadioDataResponse::RadioDataResponse(RadioResponseWaiter& parent) : parent_data(parent) {}
+RadioDataResponse::RadioDataResponse(RadioServiceTest& parent) : parent_data(parent) {}
ndk::ScopedAStatus RadioDataResponse::acknowledgeRequest(int32_t /*serial*/) {
return ndk::ScopedAStatus::ok();
diff --git a/radio/aidl/vts/radio_data_test.cpp b/radio/aidl/vts/radio_data_test.cpp
index dbf0eb7..8547e9d 100644
--- a/radio/aidl/vts/radio_data_test.cpp
+++ b/radio/aidl/vts/radio_data_test.cpp
@@ -14,10 +14,11 @@
* limitations under the License.
*/
+#include <aidl/android/hardware/radio/RadioAccessFamily.h>
#include <aidl/android/hardware/radio/config/IRadioConfig.h>
+#include <aidl/android/hardware/radio/data/ApnTypes.h>
#include <android-base/logging.h>
#include <android/binder_manager.h>
-#include <algorithm>
#include "radio_data_utils.h"
@@ -45,12 +46,17 @@
radio_data->setResponseFunctions(radioRsp_data, radioInd_data);
+ // Assert IRadioSim exists and SIM is present before testing
+ radio_sim = sim::IRadioSim::fromBinder(ndk::SpAIBinder(
+ AServiceManager_waitForService("android.hardware.radio.sim.IRadioSim/slot1")));
+ ASSERT_NE(nullptr, radio_sim.get());
+ updateSimCardStatus();
+ EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
+
// Assert IRadioConfig exists before testing
- std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
- aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
- ndk::SpAIBinder(AServiceManager_waitForService(
- "android.hardware.radio.config.IRadioConfig/default")));
- ASSERT_NE(nullptr, radioConfig.get());
+ radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
+ AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
+ ASSERT_NE(nullptr, radio_config.get());
}
ndk::ScopedAStatus RadioDataTest::getDataCallList() {
@@ -82,10 +88,18 @@
dataProfileInfo.maxConns = 20;
dataProfileInfo.waitTime = 0;
dataProfileInfo.enabled = true;
- // TODO(b/210712359): 320 was the previous value; need to support bitmaps
- dataProfileInfo.supportedApnTypesBitmap = ApnTypes::DEFAULT;
- // TODO(b/210712359): 161543 was the previous value; need to support bitmaps
- dataProfileInfo.bearerBitmap = RadioAccessFamily::LTE;
+ dataProfileInfo.supportedApnTypesBitmap =
+ static_cast<int32_t>(ApnTypes::IMS) | static_cast<int32_t>(ApnTypes::IA);
+ dataProfileInfo.bearerBitmap = static_cast<int32_t>(RadioAccessFamily::GPRS) |
+ static_cast<int32_t>(RadioAccessFamily::EDGE) |
+ static_cast<int32_t>(RadioAccessFamily::UMTS) |
+ static_cast<int32_t>(RadioAccessFamily::HSDPA) |
+ static_cast<int32_t>(RadioAccessFamily::HSUPA) |
+ static_cast<int32_t>(RadioAccessFamily::HSPA) |
+ static_cast<int32_t>(RadioAccessFamily::EHRPD) |
+ static_cast<int32_t>(RadioAccessFamily::LTE) |
+ static_cast<int32_t>(RadioAccessFamily::HSPAP) |
+ static_cast<int32_t>(RadioAccessFamily::IWLAN);
dataProfileInfo.mtuV4 = 0;
dataProfileInfo.mtuV6 = 0;
dataProfileInfo.preferred = true;
@@ -130,11 +144,8 @@
TrafficDescriptor trafficDescriptor;
OsAppId osAppId;
std::string osAppIdString("osAppId");
- // TODO(b/210712359): there should be a cleaner way to convert this
- std::vector<unsigned char> output(osAppIdString.length());
- std::transform(osAppIdString.begin(), osAppIdString.end(), output.begin(),
- [](char c) { return static_cast<unsigned char>(c); });
- osAppId.osAppId = output;
+ std::vector<unsigned char> osAppIdVec(osAppIdString.begin(), osAppIdString.end());
+ osAppId.osAppId = osAppIdVec;
trafficDescriptor.osAppId = osAppId;
DataProfileInfo dataProfileInfo;
@@ -151,10 +162,18 @@
dataProfileInfo.maxConns = 20;
dataProfileInfo.waitTime = 0;
dataProfileInfo.enabled = true;
- // TODO(b/210712359): 320 was the previous value; need to support bitmaps
- dataProfileInfo.supportedApnTypesBitmap = ApnTypes::DEFAULT;
- // TODO(b/210712359): 161543 was the previous value; need to support bitmaps
- dataProfileInfo.bearerBitmap = RadioAccessFamily::LTE;
+ dataProfileInfo.supportedApnTypesBitmap =
+ static_cast<int32_t>(ApnTypes::IMS) | static_cast<int32_t>(ApnTypes::IA);
+ dataProfileInfo.bearerBitmap = static_cast<int32_t>(RadioAccessFamily::GPRS) |
+ static_cast<int32_t>(RadioAccessFamily::EDGE) |
+ static_cast<int32_t>(RadioAccessFamily::UMTS) |
+ static_cast<int32_t>(RadioAccessFamily::HSDPA) |
+ static_cast<int32_t>(RadioAccessFamily::HSUPA) |
+ static_cast<int32_t>(RadioAccessFamily::HSPA) |
+ static_cast<int32_t>(RadioAccessFamily::EHRPD) |
+ static_cast<int32_t>(RadioAccessFamily::LTE) |
+ static_cast<int32_t>(RadioAccessFamily::HSPAP) |
+ static_cast<int32_t>(RadioAccessFamily::IWLAN);
dataProfileInfo.mtuV4 = 0;
dataProfileInfo.mtuV6 = 0;
dataProfileInfo.preferred = true;
diff --git a/radio/aidl/vts/radio_data_utils.h b/radio/aidl/vts/radio_data_utils.h
index ada8ac1..50c7878 100644
--- a/radio/aidl/vts/radio_data_utils.h
+++ b/radio/aidl/vts/radio_data_utils.h
@@ -23,17 +23,16 @@
#include "radio_aidl_hal_utils.h"
using namespace aidl::android::hardware::radio::data;
-using aidl::android::hardware::radio::sim::CardStatus;
class RadioDataTest;
/* Callback class for radio data response */
class RadioDataResponse : public BnRadioDataResponse {
protected:
- RadioResponseWaiter& parent_data;
+ RadioServiceTest& parent_data;
public:
- RadioDataResponse(RadioResponseWaiter& parent_data);
+ RadioDataResponse(RadioServiceTest& parent_data);
virtual ~RadioDataResponse() = default;
RadioResponseInfo rspInfo;
@@ -80,10 +79,10 @@
/* Callback class for radio data indication */
class RadioDataIndication : public BnRadioDataIndication {
protected:
- RadioDataTest& parent_data;
+ RadioServiceTest& parent_data;
public:
- RadioDataIndication(RadioDataTest& parent_data);
+ RadioDataIndication(RadioServiceTest& parent_data);
virtual ~RadioDataIndication() = default;
virtual ndk::ScopedAStatus dataCallListChanged(
@@ -99,7 +98,7 @@
};
// The main test class for Radio AIDL Data.
-class RadioDataTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
+class RadioDataTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
protected:
/* Get current data call list */
ndk::ScopedAStatus getDataCallList();
diff --git a/radio/aidl/vts/radio_messaging_indication.cpp b/radio/aidl/vts/radio_messaging_indication.cpp
index 7eeb266..c69611f 100644
--- a/radio/aidl/vts/radio_messaging_indication.cpp
+++ b/radio/aidl/vts/radio_messaging_indication.cpp
@@ -16,7 +16,7 @@
#include "radio_messaging_utils.h"
-RadioMessagingIndication::RadioMessagingIndication(RadioMessagingTest& parent)
+RadioMessagingIndication::RadioMessagingIndication(RadioServiceTest& parent)
: parent_messaging(parent) {}
ndk::ScopedAStatus RadioMessagingIndication::cdmaNewSms(RadioIndicationType /*type*/,
diff --git a/radio/aidl/vts/radio_messaging_response.cpp b/radio/aidl/vts/radio_messaging_response.cpp
index d73278f..718df7e 100644
--- a/radio/aidl/vts/radio_messaging_response.cpp
+++ b/radio/aidl/vts/radio_messaging_response.cpp
@@ -16,7 +16,7 @@
#include "radio_messaging_utils.h"
-RadioMessagingResponse::RadioMessagingResponse(RadioResponseWaiter& parent)
+RadioMessagingResponse::RadioMessagingResponse(RadioServiceTest& parent)
: parent_messaging(parent) {}
ndk::ScopedAStatus RadioMessagingResponse::acknowledgeIncomingGsmSmsWithPduResponse(
diff --git a/radio/aidl/vts/radio_messaging_test.cpp b/radio/aidl/vts/radio_messaging_test.cpp
index 58aeaab..8abd91d 100644
--- a/radio/aidl/vts/radio_messaging_test.cpp
+++ b/radio/aidl/vts/radio_messaging_test.cpp
@@ -44,12 +44,17 @@
radio_messaging->setResponseFunctions(radioRsp_messaging, radioInd_messaging);
+ // Assert IRadioSim exists and SIM is present before testing
+ radio_sim = sim::IRadioSim::fromBinder(ndk::SpAIBinder(
+ AServiceManager_waitForService("android.hardware.radio.sim.IRadioSim/slot1")));
+ ASSERT_NE(nullptr, radio_sim.get());
+ updateSimCardStatus();
+ EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
+
// Assert IRadioConfig exists before testing
- std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
- aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
- ndk::SpAIBinder(AServiceManager_waitForService(
- "android.hardware.radio.config.IRadioConfig/default")));
- ASSERT_NE(nullptr, radioConfig.get());
+ radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
+ AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
+ ASSERT_NE(nullptr, radio_config.get());
}
/*
diff --git a/radio/aidl/vts/radio_messaging_utils.h b/radio/aidl/vts/radio_messaging_utils.h
index 96cde08..7bb99cd 100644
--- a/radio/aidl/vts/radio_messaging_utils.h
+++ b/radio/aidl/vts/radio_messaging_utils.h
@@ -29,10 +29,10 @@
/* Callback class for radio messaging response */
class RadioMessagingResponse : public BnRadioMessagingResponse {
protected:
- RadioResponseWaiter& parent_messaging;
+ RadioServiceTest& parent_messaging;
public:
- RadioMessagingResponse(RadioResponseWaiter& parent_messaging);
+ RadioMessagingResponse(RadioServiceTest& parent_messaging);
virtual ~RadioMessagingResponse() = default;
RadioResponseInfo rspInfo;
@@ -110,10 +110,10 @@
/* Callback class for radio messaging indication */
class RadioMessagingIndication : public BnRadioMessagingIndication {
protected:
- RadioMessagingTest& parent_messaging;
+ RadioServiceTest& parent_messaging;
public:
- RadioMessagingIndication(RadioMessagingTest& parent_messaging);
+ RadioMessagingIndication(RadioServiceTest& parent_messaging);
virtual ~RadioMessagingIndication() = default;
virtual ndk::ScopedAStatus cdmaNewSms(RadioIndicationType type,
@@ -139,8 +139,7 @@
};
// The main test class for Radio AIDL Messaging.
-class RadioMessagingTest : public ::testing::TestWithParam<std::string>,
- public RadioResponseWaiter {
+class RadioMessagingTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
public:
virtual void SetUp() override;
diff --git a/radio/aidl/vts/radio_modem_indication.cpp b/radio/aidl/vts/radio_modem_indication.cpp
index 17f37a8..0bfcd66 100644
--- a/radio/aidl/vts/radio_modem_indication.cpp
+++ b/radio/aidl/vts/radio_modem_indication.cpp
@@ -16,7 +16,7 @@
#include "radio_modem_utils.h"
-RadioModemIndication::RadioModemIndication(RadioModemTest& parent) : parent_modem(parent) {}
+RadioModemIndication::RadioModemIndication(RadioServiceTest& parent) : parent_modem(parent) {}
ndk::ScopedAStatus RadioModemIndication::hardwareConfigChanged(
RadioIndicationType /*type*/, const std::vector<HardwareConfig>& /*configs*/) {
diff --git a/radio/aidl/vts/radio_modem_response.cpp b/radio/aidl/vts/radio_modem_response.cpp
index 7ac590f..53bfab4 100644
--- a/radio/aidl/vts/radio_modem_response.cpp
+++ b/radio/aidl/vts/radio_modem_response.cpp
@@ -16,7 +16,7 @@
#include "radio_modem_utils.h"
-RadioModemResponse::RadioModemResponse(RadioResponseWaiter& parent) : parent_modem(parent) {}
+RadioModemResponse::RadioModemResponse(RadioServiceTest& parent) : parent_modem(parent) {}
ndk::ScopedAStatus RadioModemResponse::acknowledgeRequest(int32_t /*serial*/) {
return ndk::ScopedAStatus::ok();
diff --git a/radio/aidl/vts/radio_modem_test.cpp b/radio/aidl/vts/radio_modem_test.cpp
index 406927f..b40bb7b 100644
--- a/radio/aidl/vts/radio_modem_test.cpp
+++ b/radio/aidl/vts/radio_modem_test.cpp
@@ -44,12 +44,17 @@
radio_modem->setResponseFunctions(radioRsp_modem, radioInd_modem);
+ // Assert IRadioSim exists and SIM is present before testing
+ radio_sim = sim::IRadioSim::fromBinder(ndk::SpAIBinder(
+ AServiceManager_waitForService("android.hardware.radio.sim.IRadioSim/slot1")));
+ ASSERT_NE(nullptr, radio_sim.get());
+ updateSimCardStatus();
+ EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
+
// Assert IRadioConfig exists before testing
- std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
- aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
- ndk::SpAIBinder(AServiceManager_waitForService(
- "android.hardware.radio.config.IRadioConfig/default")));
- ASSERT_NE(nullptr, radioConfig.get());
+ radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
+ AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
+ ASSERT_NE(nullptr, radio_config.get());
}
/*
diff --git a/radio/aidl/vts/radio_modem_utils.h b/radio/aidl/vts/radio_modem_utils.h
index cd9a30d..8779e0c 100644
--- a/radio/aidl/vts/radio_modem_utils.h
+++ b/radio/aidl/vts/radio_modem_utils.h
@@ -22,7 +22,6 @@
#include "radio_aidl_hal_utils.h"
-using namespace aidl::android::hardware::radio::config;
using namespace aidl::android::hardware::radio::modem;
class RadioModemTest;
@@ -30,10 +29,10 @@
/* Callback class for radio modem response */
class RadioModemResponse : public BnRadioModemResponse {
protected:
- RadioResponseWaiter& parent_modem;
+ RadioServiceTest& parent_modem;
public:
- RadioModemResponse(RadioResponseWaiter& parent_modem);
+ RadioModemResponse(RadioServiceTest& parent_modem);
virtual ~RadioModemResponse() = default;
RadioResponseInfo rspInfo;
@@ -87,10 +86,10 @@
/* Callback class for radio modem indication */
class RadioModemIndication : public BnRadioModemIndication {
protected:
- RadioModemTest& parent_modem;
+ RadioServiceTest& parent_modem;
public:
- RadioModemIndication(RadioModemTest& parent_modem);
+ RadioModemIndication(RadioServiceTest& parent_modem);
virtual ~RadioModemIndication() = default;
virtual ndk::ScopedAStatus hardwareConfigChanged(
@@ -109,7 +108,7 @@
};
// The main test class for Radio AIDL Modem.
-class RadioModemTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
+class RadioModemTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
public:
virtual void SetUp() override;
diff --git a/radio/aidl/vts/radio_network_indication.cpp b/radio/aidl/vts/radio_network_indication.cpp
index 7bed759..7acbff4 100644
--- a/radio/aidl/vts/radio_network_indication.cpp
+++ b/radio/aidl/vts/radio_network_indication.cpp
@@ -16,7 +16,7 @@
#include "radio_network_utils.h"
-RadioNetworkIndication::RadioNetworkIndication(RadioNetworkTest& parent) : parent_network(parent) {}
+RadioNetworkIndication::RadioNetworkIndication(RadioServiceTest& parent) : parent_network(parent) {}
ndk::ScopedAStatus RadioNetworkIndication::barringInfoChanged(
RadioIndicationType /*type*/, const CellIdentity& /*cellIdentity*/,
@@ -72,7 +72,7 @@
ndk::ScopedAStatus RadioNetworkIndication::registrationFailed(RadioIndicationType /*type*/,
const CellIdentity& /*cellIdentity*/,
const std::string& /*chosenPlmn*/,
- Domain /*domain*/,
+ int32_t /*domain*/,
int32_t /*causeCode*/,
int32_t /*additionalCauseCode*/) {
return ndk::ScopedAStatus::ok();
diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp
index b242341..ccae0f3 100644
--- a/radio/aidl/vts/radio_network_response.cpp
+++ b/radio/aidl/vts/radio_network_response.cpp
@@ -16,14 +16,14 @@
#include "radio_network_utils.h"
-RadioNetworkResponse::RadioNetworkResponse(RadioResponseWaiter& parent) : parent_network(parent) {}
+RadioNetworkResponse::RadioNetworkResponse(RadioServiceTest& parent) : parent_network(parent) {}
ndk::ScopedAStatus RadioNetworkResponse::acknowledgeRequest(int32_t /*serial*/) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::getAllowedNetworkTypesBitmapResponse(
- const RadioResponseInfo& info, const RadioAccessFamily networkTypeBitmap) {
+ const RadioResponseInfo& info, const int32_t networkTypeBitmap) {
rspInfo = info;
networkTypeBitmapResponse = networkTypeBitmap;
parent_network.notify(info.serial);
@@ -112,7 +112,7 @@
ndk::ScopedAStatus RadioNetworkResponse::getVoiceRegistrationStateResponse(
const RadioResponseInfo& info, const RegStateResult& regResponse) {
rspInfo = info;
- regStateResp.regState = regResponse.regState;
+ voiceRegResp.regState = regResponse.regState;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp
index 1cdbb6d..93c4c35 100644
--- a/radio/aidl/vts/radio_network_test.cpp
+++ b/radio/aidl/vts/radio_network_test.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <aidl/android/hardware/radio/RadioAccessFamily.h>
#include <aidl/android/hardware/radio/config/IRadioConfig.h>
#include <android-base/logging.h>
#include <android/binder_manager.h>
@@ -44,12 +45,17 @@
radio_network->setResponseFunctions(radioRsp_network, radioInd_network);
+ // Assert IRadioSim exists and SIM is present before testing
+ radio_sim = sim::IRadioSim::fromBinder(ndk::SpAIBinder(
+ AServiceManager_waitForService("android.hardware.radio.sim.IRadioSim/slot1")));
+ ASSERT_NE(nullptr, radio_sim.get());
+ updateSimCardStatus();
+ EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
+
// Assert IRadioConfig exists before testing
- std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
- aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
- ndk::SpAIBinder(AServiceManager_waitForService(
- "android.hardware.radio.config.IRadioConfig/default")));
- ASSERT_NE(nullptr, radioConfig.get());
+ radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
+ AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
+ ASSERT_NE(nullptr, radio_config.get());
}
/*
@@ -57,7 +63,7 @@
*/
TEST_P(RadioNetworkTest, setAllowedNetworkTypesBitmap) {
serial = GetRandomSerialNumber();
- RadioAccessFamily allowedNetworkTypesBitmap = RadioAccessFamily::LTE;
+ int32_t allowedNetworkTypesBitmap = static_cast<int32_t>(RadioAccessFamily::LTE);
radio_network->setAllowedNetworkTypesBitmap(serial, allowedNetworkTypesBitmap);
@@ -77,7 +83,7 @@
*/
TEST_P(RadioNetworkTest, getAllowedNetworkTypesBitmap) {
serial = GetRandomSerialNumber();
- RadioAccessFamily allowedNetworkTypesBitmap = RadioAccessFamily::LTE;
+ int32_t allowedNetworkTypesBitmap = static_cast<int32_t>(RadioAccessFamily::LTE);
radio_network->setAllowedNetworkTypesBitmap(serial, allowedNetworkTypesBitmap);
diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h
index caa1ecc..9f76769 100644
--- a/radio/aidl/vts/radio_network_utils.h
+++ b/radio/aidl/vts/radio_network_utils.h
@@ -29,18 +29,18 @@
/* Callback class for radio network response */
class RadioNetworkResponse : public BnRadioNetworkResponse {
protected:
- RadioResponseWaiter& parent_network;
+ RadioServiceTest& parent_network;
public:
- RadioNetworkResponse(RadioResponseWaiter& parent_network);
+ RadioNetworkResponse(RadioServiceTest& parent_network);
virtual ~RadioNetworkResponse() = default;
RadioResponseInfo rspInfo;
std::vector<RadioBandMode> radioBandModes;
std::vector<OperatorInfo> networkInfos;
bool isNrDualConnectivityEnabled;
- RadioAccessFamily networkTypeBitmapResponse;
- RegStateResult regStateResp;
+ int networkTypeBitmapResponse;
+ RegStateResult voiceRegResp;
CellIdentity barringCellIdentity;
std::vector<BarringInfo> barringInfos;
UsageSetting usageSetting;
@@ -48,7 +48,7 @@
virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
virtual ndk::ScopedAStatus getAllowedNetworkTypesBitmapResponse(
- const RadioResponseInfo& info, const RadioAccessFamily networkTypeBitmap) override;
+ const RadioResponseInfo& info, const int32_t networkTypeBitmap) override;
virtual ndk::ScopedAStatus getAvailableBandModesResponse(
const RadioResponseInfo& info, const std::vector<RadioBandMode>& bandModes) override;
@@ -150,10 +150,10 @@
/* Callback class for radio network indication */
class RadioNetworkIndication : public BnRadioNetworkIndication {
protected:
- RadioNetworkTest& parent_network;
+ RadioServiceTest& parent_network;
public:
- RadioNetworkIndication(RadioNetworkTest& parent_network);
+ RadioNetworkIndication(RadioServiceTest& parent_network);
virtual ~RadioNetworkIndication() = default;
virtual ndk::ScopedAStatus barringInfoChanged(
@@ -187,7 +187,7 @@
virtual ndk::ScopedAStatus registrationFailed(RadioIndicationType type,
const CellIdentity& cellIdentity,
- const std::string& chosenPlmn, Domain domain,
+ const std::string& chosenPlmn, int32_t domain,
int32_t causeCode,
int32_t additionalCauseCode) override;
@@ -202,7 +202,7 @@
};
// The main test class for Radio AIDL Network.
-class RadioNetworkTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
+class RadioNetworkTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
public:
virtual void SetUp() override;
diff --git a/radio/aidl/vts/radio_sim_indication.cpp b/radio/aidl/vts/radio_sim_indication.cpp
index 0385845..c03d947 100644
--- a/radio/aidl/vts/radio_sim_indication.cpp
+++ b/radio/aidl/vts/radio_sim_indication.cpp
@@ -16,7 +16,7 @@
#include "radio_sim_utils.h"
-RadioSimIndication::RadioSimIndication(RadioSimTest& parent) : parent_sim(parent) {}
+RadioSimIndication::RadioSimIndication(RadioServiceTest& parent) : parent_sim(parent) {}
ndk::ScopedAStatus RadioSimIndication::carrierInfoForImsiEncryption(RadioIndicationType /*info*/) {
return ndk::ScopedAStatus::ok();
diff --git a/radio/aidl/vts/radio_sim_response.cpp b/radio/aidl/vts/radio_sim_response.cpp
index 2c796fa..a783f43 100644
--- a/radio/aidl/vts/radio_sim_response.cpp
+++ b/radio/aidl/vts/radio_sim_response.cpp
@@ -16,7 +16,7 @@
#include "radio_sim_utils.h"
-RadioSimResponse::RadioSimResponse(RadioResponseWaiter& parent) : parent_sim(parent) {}
+RadioSimResponse::RadioSimResponse(RadioServiceTest& parent) : parent_sim(parent) {}
ndk::ScopedAStatus RadioSimResponse::acknowledgeRequest(int32_t /*serial*/) {
return ndk::ScopedAStatus::ok();
diff --git a/radio/aidl/vts/radio_sim_test.cpp b/radio/aidl/vts/radio_sim_test.cpp
index c70219f..5db77f6 100644
--- a/radio/aidl/vts/radio_sim_test.cpp
+++ b/radio/aidl/vts/radio_sim_test.cpp
@@ -43,20 +43,23 @@
ASSERT_NE(nullptr, radioInd_sim.get());
radio_sim->setResponseFunctions(radioRsp_sim, radioInd_sim);
+ // Assert SIM is present before testing
+ updateSimCardStatus();
+ EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
// Assert IRadioConfig exists before testing
- std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
- aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
- ndk::SpAIBinder(AServiceManager_waitForService(
- "android.hardware.radio.config.IRadioConfig/default")));
- ASSERT_NE(nullptr, radioConfig.get());
+ radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
+ AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
+ ASSERT_NE(nullptr, radio_config.get());
}
-ndk::ScopedAStatus RadioSimTest::updateSimCardStatus() {
+void RadioSimTest::updateSimCardStatus() {
serial = GetRandomSerialNumber();
radio_sim->getIccCardStatus(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
- return ndk::ScopedAStatus::ok();
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
}
/*
diff --git a/radio/aidl/vts/radio_sim_utils.h b/radio/aidl/vts/radio_sim_utils.h
index 6cb6790..b5e365d 100644
--- a/radio/aidl/vts/radio_sim_utils.h
+++ b/radio/aidl/vts/radio_sim_utils.h
@@ -29,10 +29,10 @@
/* Callback class for radio SIM response */
class RadioSimResponse : public BnRadioSimResponse {
protected:
- RadioResponseWaiter& parent_sim;
+ RadioServiceTest& parent_sim;
public:
- RadioSimResponse(RadioResponseWaiter& parent_sim);
+ RadioSimResponse(RadioServiceTest& parent_sim);
virtual ~RadioSimResponse() = default;
RadioResponseInfo rspInfo;
@@ -152,10 +152,10 @@
/* Callback class for radio SIM indication */
class RadioSimIndication : public BnRadioSimIndication {
protected:
- RadioSimTest& parent_sim;
+ RadioServiceTest& parent_sim;
public:
- RadioSimIndication(RadioSimTest& parent_sim);
+ RadioSimIndication(RadioServiceTest& parent_sim);
virtual ~RadioSimIndication() = default;
virtual ndk::ScopedAStatus carrierInfoForImsiEncryption(RadioIndicationType info) override;
@@ -190,16 +190,14 @@
};
// The main test class for Radio AIDL SIM.
-class RadioSimTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
- protected:
- /* Update Sim Card Status */
- virtual ndk::ScopedAStatus updateSimCardStatus();
-
+class RadioSimTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
public:
virtual void SetUp() override;
- /* radio SIM service handle */
- std::shared_ptr<IRadioSim> radio_sim;
+ /* Override updateSimCardStatus in RadioServiceTest to not call setResponseFunctions */
+ void updateSimCardStatus();
+
+ /* radio SIM service handle in RadioServiceTest */
/* radio SIM response handle */
std::shared_ptr<RadioSimResponse> radioRsp_sim;
/* radio SIM indication handle */
diff --git a/radio/aidl/vts/radio_voice_indication.cpp b/radio/aidl/vts/radio_voice_indication.cpp
index 2c46817..d814c18 100644
--- a/radio/aidl/vts/radio_voice_indication.cpp
+++ b/radio/aidl/vts/radio_voice_indication.cpp
@@ -16,7 +16,7 @@
#include "radio_voice_utils.h"
-RadioVoiceIndication::RadioVoiceIndication(RadioVoiceTest& parent) : parent_voice(parent) {}
+RadioVoiceIndication::RadioVoiceIndication(RadioServiceTest& parent) : parent_voice(parent) {}
ndk::ScopedAStatus RadioVoiceIndication::callRing(RadioIndicationType /*type*/, bool /*isGsm*/,
const CdmaSignalInfoRecord& /*record*/) {
diff --git a/radio/aidl/vts/radio_voice_response.cpp b/radio/aidl/vts/radio_voice_response.cpp
index ca350c6..a491613 100644
--- a/radio/aidl/vts/radio_voice_response.cpp
+++ b/radio/aidl/vts/radio_voice_response.cpp
@@ -16,7 +16,7 @@
#include "radio_voice_utils.h"
-RadioVoiceResponse::RadioVoiceResponse(RadioResponseWaiter& parent) : parent_voice(parent) {}
+RadioVoiceResponse::RadioVoiceResponse(RadioServiceTest& parent) : parent_voice(parent) {}
ndk::ScopedAStatus RadioVoiceResponse::acceptCallResponse(const RadioResponseInfo& /*info*/) {
return ndk::ScopedAStatus::ok();
diff --git a/radio/aidl/vts/radio_voice_test.cpp b/radio/aidl/vts/radio_voice_test.cpp
index 201f14c..717f3f0 100644
--- a/radio/aidl/vts/radio_voice_test.cpp
+++ b/radio/aidl/vts/radio_voice_test.cpp
@@ -15,6 +15,7 @@
*/
#include <aidl/android/hardware/radio/config/IRadioConfig.h>
+#include <aidl/android/hardware/radio/voice/EmergencyServiceCategory.h>
#include <android-base/logging.h>
#include <android/binder_manager.h>
@@ -44,12 +45,26 @@
radio_voice->setResponseFunctions(radioRsp_voice, radioInd_voice);
+ // Assert IRadioSim exists and SIM is present before testing
+ radio_sim = sim::IRadioSim::fromBinder(ndk::SpAIBinder(
+ AServiceManager_waitForService("android.hardware.radio.sim.IRadioSim/slot1")));
+ ASSERT_NE(nullptr, radio_sim.get());
+ updateSimCardStatus();
+ EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
+
// Assert IRadioConfig exists before testing
- std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
- aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
- ndk::SpAIBinder(AServiceManager_waitForService(
- "android.hardware.radio.config.IRadioConfig/default")));
- ASSERT_NE(nullptr, radioConfig.get());
+ radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
+ AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
+ ASSERT_NE(nullptr, radio_config.get());
+
+ if (isDsDsEnabled() || isTsTsEnabled()) {
+ radio_network = IRadioNetwork::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService(
+ "android.hardware.radio.network.IRadioNetwork/slot1")));
+ ASSERT_NE(nullptr, radio_network.get());
+ radioRsp_network = ndk::SharedRefBase::make<RadioNetworkResponse>(*this);
+ radioInd_network = ndk::SharedRefBase::make<RadioNetworkIndication>(*this);
+ radio_network->setResponseFunctions(radioRsp_network, radioInd_network);
+ }
}
ndk::ScopedAStatus RadioVoiceTest::clearPotentialEstablishedCalls() {
@@ -95,7 +110,7 @@
Dial dialInfo;
dialInfo.address = std::string("911");
- EmergencyServiceCategory categories = EmergencyServiceCategory::UNSPECIFIED;
+ int32_t categories = static_cast<int32_t>(EmergencyServiceCategory::UNSPECIFIED);
std::vector<std::string> urns = {""};
EmergencyCallRouting routing = EmergencyCallRouting::UNKNOWN;
@@ -112,16 +127,13 @@
// In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
// or Emergency_Only.
if (isDsDsEnabled() || isTsTsEnabled()) {
- // TODO(b/210712359): maybe create a local RadioNetwork instance
- /**
serial = GetRandomSerialNumber();
- radio_v1_6->getVoiceRegistrationState(serial);
+ radio_network->getVoiceRegistrationState(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
- if (isVoiceEmergencyOnly(radioRsp_v1_6->voiceRegResp.regState) ||
- isVoiceInService(radioRsp_v1_6->voiceRegResp.regState)) {
+ if (isVoiceEmergencyOnly(radioRsp_network->voiceRegResp.regState) ||
+ isVoiceInService(radioRsp_network->voiceRegResp.regState)) {
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
}
- **/
} else {
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
}
@@ -152,7 +164,7 @@
Dial dialInfo;
dialInfo.address = std::string("911");
- EmergencyServiceCategory categories = EmergencyServiceCategory::AMBULANCE;
+ int32_t categories = static_cast<int32_t>(EmergencyServiceCategory::AMBULANCE);
std::vector<std::string> urns = {"urn:service:sos.ambulance"};
EmergencyCallRouting routing = EmergencyCallRouting::UNKNOWN;
@@ -170,16 +182,13 @@
// In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
// or Emergency_Only.
if (isDsDsEnabled() || isTsTsEnabled()) {
- // TODO(b/210712359): maybe create a local RadioNetwork instance
- /**
serial = GetRandomSerialNumber();
- radio_v1_6->getVoiceRegistrationState_1_6(serial);
+ radio_network->getVoiceRegistrationState(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
- if (isVoiceEmergencyOnly(radioRsp_v1_6->voiceRegResp.regState) ||
- isVoiceInService(radioRsp_v1_6->voiceRegResp.regState)) {
+ if (isVoiceEmergencyOnly(radioRsp_network->voiceRegResp.regState) ||
+ isVoiceInService(radioRsp_network->voiceRegResp.regState)) {
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
}
- **/
} else {
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
}
@@ -209,7 +218,7 @@
Dial dialInfo;
dialInfo.address = std::string("911");
- EmergencyServiceCategory categories = EmergencyServiceCategory::UNSPECIFIED;
+ int32_t categories = static_cast<int32_t>(EmergencyServiceCategory::UNSPECIFIED);
std::vector<std::string> urns = {""};
EmergencyCallRouting routing = EmergencyCallRouting::EMERGENCY;
@@ -227,16 +236,13 @@
// In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
// or Emergency_Only.
if (isDsDsEnabled() || isTsTsEnabled()) {
- // TODO(b/210712359): maybe create a local RadioNetwork instance
- /**
serial = GetRandomSerialNumber();
- radio_v1_6->getVoiceRegistrationState_1_6(serial);
+ radio_network->getVoiceRegistrationState(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
- if (isVoiceEmergencyOnly(radioRsp_v1_6->voiceRegResp.regState) ||
- isVoiceInService(radioRsp_v1_6->voiceRegResp.regState)) {
+ if (isVoiceEmergencyOnly(radioRsp_network->voiceRegResp.regState) ||
+ isVoiceInService(radioRsp_network->voiceRegResp.regState)) {
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
}
- **/
} else {
EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
}
diff --git a/radio/aidl/vts/radio_voice_utils.h b/radio/aidl/vts/radio_voice_utils.h
index a676a7f..d61bf1e 100644
--- a/radio/aidl/vts/radio_voice_utils.h
+++ b/radio/aidl/vts/radio_voice_utils.h
@@ -21,6 +21,7 @@
#include <aidl/android/hardware/radio/voice/IRadioVoice.h>
#include "radio_aidl_hal_utils.h"
+#include "radio_network_utils.h"
using namespace aidl::android::hardware::radio::voice;
@@ -29,10 +30,10 @@
/* Callback class for radio voice response */
class RadioVoiceResponse : public BnRadioVoiceResponse {
protected:
- RadioResponseWaiter& parent_voice;
+ RadioServiceTest& parent_voice;
public:
- RadioVoiceResponse(RadioResponseWaiter& parent_voice);
+ RadioVoiceResponse(RadioServiceTest& parent_voice);
virtual ~RadioVoiceResponse() = default;
RadioResponseInfo rspInfo;
@@ -130,10 +131,10 @@
/* Callback class for radio voice indication */
class RadioVoiceIndication : public BnRadioVoiceIndication {
protected:
- RadioVoiceTest& parent_voice;
+ RadioServiceTest& parent_voice;
public:
- RadioVoiceIndication(RadioVoiceTest& parent_voice);
+ RadioVoiceIndication(RadioServiceTest& parent_voice);
virtual ~RadioVoiceIndication() = default;
virtual ndk::ScopedAStatus callRing(RadioIndicationType type, bool isGsm,
@@ -175,10 +176,13 @@
};
// The main test class for Radio AIDL Voice.
-class RadioVoiceTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
+class RadioVoiceTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
protected:
/* Clear Potential Established Calls */
virtual ndk::ScopedAStatus clearPotentialEstablishedCalls();
+ std::shared_ptr<network::IRadioNetwork> radio_network;
+ std::shared_ptr<RadioNetworkResponse> radioRsp_network;
+ std::shared_ptr<RadioNetworkIndication> radioInd_network;
public:
virtual void SetUp() override;
diff --git a/tv/tuner/1.1/default/Frontend.cpp b/tv/tuner/1.1/default/Frontend.cpp
index f5463a9..919c956 100644
--- a/tv/tuner/1.1/default/Frontend.cpp
+++ b/tv/tuner/1.1/default/Frontend.cpp
@@ -88,46 +88,60 @@
Return<Result> Frontend::scan(const FrontendSettings& settings, FrontendScanType type) {
ALOGV("%s", __FUNCTION__);
+
+ // If it's in middle of scanning, stop it first.
+ if (mScanThread.joinable()) {
+ mScanThread.join();
+ }
+
+ mFrontendSettings = settings;
+ mFrontendScanType = type;
+ mScanThread = std::thread(&Frontend::scanThreadLoop, this);
+
+ return Result::SUCCESS;
+}
+
+void Frontend::scanThreadLoop() {
FrontendScanMessage msg;
if (mIsLocked) {
msg.isEnd(true);
mCallback->onScanMessage(FrontendScanMessageType::END, msg);
- return Result::SUCCESS;
+ return;
}
uint32_t frequency;
- switch (settings.getDiscriminator()) {
+ switch (mFrontendSettings.getDiscriminator()) {
case FrontendSettings::hidl_discriminator::analog:
- frequency = settings.analog().frequency;
+ frequency = mFrontendSettings.analog().frequency;
break;
case FrontendSettings::hidl_discriminator::atsc:
- frequency = settings.atsc().frequency;
+ frequency = mFrontendSettings.atsc().frequency;
break;
case FrontendSettings::hidl_discriminator::atsc3:
- frequency = settings.atsc3().frequency;
+ frequency = mFrontendSettings.atsc3().frequency;
break;
case FrontendSettings::hidl_discriminator::dvbs:
- frequency = settings.dvbs().frequency;
+ frequency = mFrontendSettings.dvbs().frequency;
break;
case FrontendSettings::hidl_discriminator::dvbc:
- frequency = settings.dvbc().frequency;
+ frequency = mFrontendSettings.dvbc().frequency;
break;
case FrontendSettings::hidl_discriminator::dvbt:
- frequency = settings.dvbt().frequency;
+ frequency = mFrontendSettings.dvbt().frequency;
break;
case FrontendSettings::hidl_discriminator::isdbs:
- frequency = settings.isdbs().frequency;
+ frequency = mFrontendSettings.isdbs().frequency;
break;
case FrontendSettings::hidl_discriminator::isdbs3:
- frequency = settings.isdbs3().frequency;
+ frequency = mFrontendSettings.isdbs3().frequency;
break;
case FrontendSettings::hidl_discriminator::isdbt:
- frequency = settings.isdbt().frequency;
+ frequency = mFrontendSettings.isdbt().frequency;
break;
}
- if (type == FrontendScanType::SCAN_BLIND) {
+ if (mFrontendScanType == FrontendScanType::SCAN_BLIND) {
frequency += 100 * 1000;
}
@@ -204,8 +218,6 @@
msg.isLocked(true);
mCallback->onScanMessage(FrontendScanMessageType::LOCKED, msg);
mIsLocked = true;
-
- return Result::SUCCESS;
}
Return<Result> Frontend::scan_1_1(const FrontendSettings& settings, FrontendScanType type,
@@ -218,6 +230,10 @@
Return<Result> Frontend::stopScan() {
ALOGV("%s", __FUNCTION__);
+ if (mScanThread.joinable()) {
+ mScanThread.join();
+ }
+
mIsLocked = false;
return Result::SUCCESS;
}
diff --git a/tv/tuner/1.1/default/Frontend.h b/tv/tuner/1.1/default/Frontend.h
index a28fb64..bf739a8 100644
--- a/tv/tuner/1.1/default/Frontend.h
+++ b/tv/tuner/1.1/default/Frontend.h
@@ -20,6 +20,7 @@
#include <android/hardware/tv/tuner/1.1/IFrontend.h>
#include <fstream>
#include <iostream>
+#include <thread>
#include "Tuner.h"
using namespace std;
@@ -81,13 +82,17 @@
private:
virtual ~Frontend();
bool supportsSatellite();
+ void scanThreadLoop();
+
sp<IFrontendCallback> mCallback;
sp<Tuner> mTunerService;
FrontendType mType = FrontendType::UNDEFINED;
FrontendId mId = 0;
bool mIsLocked = false;
uint32_t mCiCamId;
-
+ std::thread mScanThread;
+ FrontendSettings mFrontendSettings;
+ FrontendScanType mFrontendScanType;
std::ifstream mFrontendData;
};
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl
index decf5b1..0ff2da9 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl
@@ -45,4 +45,6 @@
android.hardware.tv.tuner.ILnb openLnbById(in int lnbId);
android.hardware.tv.tuner.ILnb openLnbByName(in String lnbName, out int[] lnbId);
void setLna(in boolean bEnable);
+ void setMaxNumberOfFrontends(in android.hardware.tv.tuner.FrontendType frontendType, in int maxNumber);
+ int getMaxNumberOfFrontends(in android.hardware.tv.tuner.FrontendType frontendType);
}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl
index 1fcbb06..03def33 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl
@@ -18,6 +18,7 @@
import android.hardware.tv.tuner.DemuxCapabilities;
import android.hardware.tv.tuner.FrontendInfo;
+import android.hardware.tv.tuner.FrontendType;
import android.hardware.tv.tuner.IDemux;
import android.hardware.tv.tuner.IDescrambler;
import android.hardware.tv.tuner.IFrontend;
@@ -127,4 +128,24 @@
* @param bEnable true if activate LNA module; false if deactivate LNA
*/
void setLna(in boolean bEnable);
+
+ /**
+ * Set the maximum usable frontends number of a given frontend type.
+ *
+ * It is used by the client to enable or disable frontends when cable connection status
+ * is changed by user.
+ *
+ * @param frontendType the frontend type which the maximum usable number will be set.
+ * @param maxNumber the new maximum usable number.
+ */
+ void setMaxNumberOfFrontends(in FrontendType frontendType, in int maxNumber);
+
+ /**
+ * Get the maximum usable frontends number of a given frontend type.
+ *
+ * @param frontendType the frontend type which the maximum usable number will be queried.
+ *
+ * @return the maximum usable number of the queried frontend type.
+ */
+ int getMaxNumberOfFrontends(in FrontendType frontendType);
}
diff --git a/tv/tuner/aidl/default/Frontend.cpp b/tv/tuner/aidl/default/Frontend.cpp
index d36841c..714612d 100644
--- a/tv/tuner/aidl/default/Frontend.cpp
+++ b/tv/tuner/aidl/default/Frontend.cpp
@@ -87,47 +87,60 @@
::ndk::ScopedAStatus Frontend::scan(const FrontendSettings& in_settings, FrontendScanType in_type) {
ALOGV("%s", __FUNCTION__);
+ // If it's in middle of scanning, stop it first.
+ if (mScanThread.joinable()) {
+ mScanThread.join();
+ }
+
+ mFrontendSettings = in_settings;
+ mFrontendScanType = in_type;
+ mScanThread = std::thread(&Frontend::scanThreadLoop, this);
+
+ return ::ndk::ScopedAStatus::ok();
+}
+
+void Frontend::scanThreadLoop() {
if (mIsLocked) {
FrontendScanMessage msg;
msg.set<FrontendScanMessage::Tag::isEnd>(true);
mCallback->onScanMessage(FrontendScanMessageType::END, msg);
- return ::ndk::ScopedAStatus::ok();
+ return;
}
int64_t frequency = 0;
- switch (in_settings.getTag()) {
+ switch (mFrontendSettings.getTag()) {
case FrontendSettings::Tag::analog:
- frequency = in_settings.get<FrontendSettings::Tag::analog>().frequency;
+ frequency = mFrontendSettings.get<FrontendSettings::Tag::analog>().frequency;
break;
case FrontendSettings::Tag::atsc:
- frequency = in_settings.get<FrontendSettings::Tag::atsc>().frequency;
+ frequency = mFrontendSettings.get<FrontendSettings::Tag::atsc>().frequency;
break;
case FrontendSettings::Tag::atsc3:
- frequency = in_settings.get<FrontendSettings::Tag::atsc3>().frequency;
+ frequency = mFrontendSettings.get<FrontendSettings::Tag::atsc3>().frequency;
break;
case FrontendSettings::Tag::dvbs:
- frequency = in_settings.get<FrontendSettings::Tag::dvbs>().frequency;
+ frequency = mFrontendSettings.get<FrontendSettings::Tag::dvbs>().frequency;
break;
case FrontendSettings::Tag::dvbc:
- frequency = in_settings.get<FrontendSettings::Tag::dvbc>().frequency;
+ frequency = mFrontendSettings.get<FrontendSettings::Tag::dvbc>().frequency;
break;
case FrontendSettings::Tag::dvbt:
- frequency = in_settings.get<FrontendSettings::Tag::dvbt>().frequency;
+ frequency = mFrontendSettings.get<FrontendSettings::Tag::dvbt>().frequency;
break;
case FrontendSettings::Tag::isdbs:
- frequency = in_settings.get<FrontendSettings::Tag::isdbs>().frequency;
+ frequency = mFrontendSettings.get<FrontendSettings::Tag::isdbs>().frequency;
break;
case FrontendSettings::Tag::isdbs3:
- frequency = in_settings.get<FrontendSettings::Tag::isdbs3>().frequency;
+ frequency = mFrontendSettings.get<FrontendSettings::Tag::isdbs3>().frequency;
break;
case FrontendSettings::Tag::isdbt:
- frequency = in_settings.get<FrontendSettings::Tag::isdbt>().frequency;
+ frequency = mFrontendSettings.get<FrontendSettings::Tag::isdbt>().frequency;
break;
default:
break;
}
- if (in_type == FrontendScanType::SCAN_BLIND) {
+ if (mFrontendScanType == FrontendScanType::SCAN_BLIND) {
frequency += 100 * 1000;
}
@@ -250,13 +263,15 @@
mCallback->onScanMessage(FrontendScanMessageType::LOCKED, msg);
mIsLocked = true;
}
-
- return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus Frontend::stopScan() {
ALOGV("%s", __FUNCTION__);
+ if (mScanThread.joinable()) {
+ mScanThread.join();
+ }
+
mIsLocked = false;
return ::ndk::ScopedAStatus::ok();
}
diff --git a/tv/tuner/aidl/default/Frontend.h b/tv/tuner/aidl/default/Frontend.h
index 66ae901..fdedf1e 100644
--- a/tv/tuner/aidl/default/Frontend.h
+++ b/tv/tuner/aidl/default/Frontend.h
@@ -19,6 +19,7 @@
#include <aidl/android/hardware/tv/tuner/BnFrontend.h>
#include <fstream>
#include <iostream>
+#include <thread>
#include "Tuner.h"
using namespace std;
@@ -60,13 +61,17 @@
private:
virtual ~Frontend();
bool supportsSatellite();
+ void scanThreadLoop();
+
std::shared_ptr<IFrontendCallback> mCallback;
std::shared_ptr<Tuner> mTuner;
FrontendType mType = FrontendType::UNDEFINED;
int32_t mId = 0;
bool mIsLocked = false;
int32_t mCiCamId;
-
+ std::thread mScanThread;
+ FrontendSettings mFrontendSettings;
+ FrontendScanType mFrontendScanType;
std::ifstream mFrontendData;
};
diff --git a/tv/tuner/aidl/default/Tuner.cpp b/tv/tuner/aidl/default/Tuner.cpp
index 45f3dfa..48c1b66 100644
--- a/tv/tuner/aidl/default/Tuner.cpp
+++ b/tv/tuner/aidl/default/Tuner.cpp
@@ -64,6 +64,7 @@
FrontendStatusType::STREAM_ID_LIST,
};
mFrontendStatusCaps[0] = statusCaps;
+ mMaxUsableFrontends[FrontendType::ISDBS] = 1;
FrontendCapabilities capsAtsc3;
capsAtsc3.set<FrontendCapabilities::Tag::atsc3Caps>(FrontendAtsc3Capabilities());
@@ -78,6 +79,7 @@
FrontendStatusType::BANDWIDTH,
};
mFrontendStatusCaps[1] = statusCaps;
+ mMaxUsableFrontends[FrontendType::ATSC3] = 1;
FrontendCapabilities capsDvbc;
capsDvbc.set<FrontendCapabilities::Tag::dvbcCaps>(FrontendDvbcCapabilities());
@@ -89,6 +91,7 @@
FrontendStatusType::INTERLEAVINGS, FrontendStatusType::BANDWIDTH,
};
mFrontendStatusCaps[2] = statusCaps;
+ mMaxUsableFrontends[FrontendType::DVBC] = 1;
FrontendCapabilities capsDvbs;
capsDvbs.set<FrontendCapabilities::Tag::dvbsCaps>(FrontendDvbsCapabilities());
@@ -99,6 +102,7 @@
FrontendStatusType::ROLL_OFF, FrontendStatusType::IS_MISO,
};
mFrontendStatusCaps[3] = statusCaps;
+ mMaxUsableFrontends[FrontendType::DVBS] = 1;
FrontendCapabilities capsDvbt;
capsDvbt.set<FrontendCapabilities::Tag::dvbtCaps>(FrontendDvbtCapabilities());
@@ -115,6 +119,7 @@
FrontendStatusType::DVBT_CELL_IDS,
};
mFrontendStatusCaps[4] = statusCaps;
+ mMaxUsableFrontends[FrontendType::DVBT] = 1;
FrontendCapabilities capsIsdbt;
FrontendIsdbtCapabilities isdbtCaps{
@@ -145,6 +150,7 @@
FrontendStatusType::INTERLEAVINGS,
};
mFrontendStatusCaps[5] = statusCaps;
+ mMaxUsableFrontends[FrontendType::ISDBT] = 1;
FrontendCapabilities capsAnalog;
capsAnalog.set<FrontendCapabilities::Tag::analogCaps>(FrontendAnalogCapabilities());
@@ -156,6 +162,7 @@
FrontendStatusType::TS_DATA_RATES,
};
mFrontendStatusCaps[6] = statusCaps;
+ mMaxUsableFrontends[FrontendType::ANALOG] = 1;
FrontendCapabilities capsAtsc;
capsAtsc.set<FrontendCapabilities::Tag::atscCaps>(FrontendAtscCapabilities());
@@ -167,6 +174,7 @@
FrontendStatusType::IS_LINEAR,
};
mFrontendStatusCaps[7] = statusCaps;
+ mMaxUsableFrontends[FrontendType::ATSC] = 1;
FrontendCapabilities capsIsdbs3;
capsIsdbs3.set<FrontendCapabilities::Tag::isdbs3Caps>(FrontendIsdbs3Capabilities());
@@ -177,6 +185,7 @@
FrontendStatusType::IS_SHORT_FRAMES, FrontendStatusType::STREAM_ID_LIST,
};
mFrontendStatusCaps[8] = statusCaps;
+ mMaxUsableFrontends[FrontendType::ISDBS3] = 1;
FrontendCapabilities capsDtmb;
capsDtmb.set<FrontendCapabilities::Tag::dtmbCaps>(FrontendDtmbCapabilities());
@@ -187,6 +196,7 @@
FrontendStatusType::TRANSMISSION_MODE,
};
mFrontendStatusCaps[9] = statusCaps;
+ mMaxUsableFrontends[FrontendType::DTMB] = 1;
mLnbs.resize(2);
mLnbs[0] = ndk::SharedRefBase::make<Lnb>(0);
@@ -324,6 +334,25 @@
return ::ndk::ScopedAStatus::ok();
}
+::ndk::ScopedAStatus Tuner::setMaxNumberOfFrontends(FrontendType in_frontendType,
+ int32_t in_maxNumber) {
+ ALOGV("%s", __FUNCTION__);
+
+ // In the default implementation, every type only has one frontend.
+ if (in_maxNumber < 0 || in_maxNumber > 1) {
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(
+ static_cast<int32_t>(Result::INVALID_ARGUMENT));
+ }
+ mMaxUsableFrontends[in_frontendType] = in_maxNumber;
+ return ::ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus Tuner::getMaxNumberOfFrontends(FrontendType in_frontendType,
+ int32_t* _aidl_return) {
+ *_aidl_return = mMaxUsableFrontends[in_frontendType];
+ return ::ndk::ScopedAStatus::ok();
+}
+
binder_status_t Tuner::dump(int fd, const char** args, uint32_t numArgs) {
ALOGV("%s", __FUNCTION__);
{
diff --git a/tv/tuner/aidl/default/Tuner.h b/tv/tuner/aidl/default/Tuner.h
index b33a1be..216a2b6 100644
--- a/tv/tuner/aidl/default/Tuner.h
+++ b/tv/tuner/aidl/default/Tuner.h
@@ -57,6 +57,10 @@
std::vector<int32_t>* out_lnbId,
std::shared_ptr<ILnb>* _aidl_return) override;
::ndk::ScopedAStatus setLna(bool in_bEnable) override;
+ ::ndk::ScopedAStatus setMaxNumberOfFrontends(FrontendType in_frontendType,
+ int32_t in_maxNumber) override;
+ ::ndk::ScopedAStatus getMaxNumberOfFrontends(FrontendType in_frontendType,
+ int32_t* _aidl_return) override;
binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
@@ -81,6 +85,7 @@
// First used id will be 0.
int32_t mLastUsedId = -1;
vector<std::shared_ptr<Lnb>> mLnbs;
+ map<FrontendType, int32_t> mMaxUsableFrontends;
};
} // namespace tuner
diff --git a/tv/tuner/aidl/vts/functional/FrontendTests.cpp b/tv/tuner/aidl/vts/functional/FrontendTests.cpp
index 075ffad..41e98ea 100644
--- a/tv/tuner/aidl/vts/functional/FrontendTests.cpp
+++ b/tv/tuner/aidl/vts/functional/FrontendTests.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <aidl/android/hardware/tv/tuner/Result.h>
+
#include "FrontendTests.h"
ndk::ScopedAStatus FrontendCallback::onEvent(FrontendEventType frontendEventType) {
@@ -519,6 +521,41 @@
ASSERT_TRUE(closeFrontend());
}
+void FrontendTests::maxNumberOfFrontendsTest() {
+ ASSERT_TRUE(getFrontendIds());
+ for (size_t i = 0; i < mFeIds.size(); i++) {
+ ASSERT_TRUE(getFrontendInfo(mFeIds[i]));
+ int32_t defaultMax = -1;
+ ndk::ScopedAStatus status;
+ // Check default value
+ status = mService->getMaxNumberOfFrontends(mFrontendInfo.type, &defaultMax);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_TRUE(defaultMax > 0);
+ // Set to -1
+ status = mService->setMaxNumberOfFrontends(mFrontendInfo.type, -1);
+ ASSERT_TRUE(status.getServiceSpecificError() ==
+ static_cast<int32_t>(Result::INVALID_ARGUMENT));
+ // Set to defaultMax + 1
+ status = mService->setMaxNumberOfFrontends(mFrontendInfo.type, defaultMax + 1);
+ ASSERT_TRUE(status.getServiceSpecificError() ==
+ static_cast<int32_t>(Result::INVALID_ARGUMENT));
+ // Set to 0
+ status = mService->setMaxNumberOfFrontends(mFrontendInfo.type, 0);
+ ASSERT_TRUE(status.isOk());
+ // Check after set
+ int32_t currentMax = -1;
+ status = mService->getMaxNumberOfFrontends(mFrontendInfo.type, ¤tMax);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_TRUE(currentMax == 0);
+ // Reset to default
+ status = mService->setMaxNumberOfFrontends(mFrontendInfo.type, defaultMax);
+ ASSERT_TRUE(status.isOk());
+ status = mService->getMaxNumberOfFrontends(mFrontendInfo.type, ¤tMax);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_TRUE(defaultMax == currentMax);
+ }
+}
+
void FrontendTests::scanTest(FrontendConfig frontendConf, FrontendScanType scanType) {
int32_t feId;
getFrontendIdByType(frontendConf.type, feId);
diff --git a/tv/tuner/aidl/vts/functional/FrontendTests.h b/tv/tuner/aidl/vts/functional/FrontendTests.h
index 8f769a0..1745f76 100644
--- a/tv/tuner/aidl/vts/functional/FrontendTests.h
+++ b/tv/tuner/aidl/vts/functional/FrontendTests.h
@@ -100,6 +100,7 @@
void tuneTest(FrontendConfig frontendConf);
void scanTest(FrontendConfig frontend, FrontendScanType type);
void debugInfoTest(FrontendConfig frontendConf);
+ void maxNumberOfFrontendsTest();
void setDvrTests(DvrTests* dvrTests) { mExternalDvrTests = dvrTests; }
void setDemux(std::shared_ptr<IDemux> demux) { getDvrTests()->setDemux(demux); }
diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp
index 202f83f..0566089 100644
--- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp
+++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp
@@ -704,6 +704,9 @@
bool mediaFilter = isMediaFilter(filterConf);
auto filter = mFilterTests.getFilterById(filterId);
+ // startTime needs to be set before calling setDelayHint.
+ auto startTime = std::chrono::steady_clock::now();
+
auto timeDelayInMs = std::chrono::milliseconds(filterConf.timeDelayInMs);
if (timeDelayInMs.count() > 0) {
FilterDelayHint delayHint;
@@ -724,15 +727,22 @@
ASSERT_EQ(filter->setDelayHint(delayHint).isOk(), !mediaFilter);
}
- // start and stop filter in order to circumvent callback scheduler race
- // conditions after adjusting filter delays.
+ // start and stop filter (and wait for first callback) in order to
+ // circumvent callback scheduler race conditions after adjusting filter
+ // delays.
+ auto cb = mFilterTests.getFilterCallbacks().at(filterId);
+ auto future =
+ cb->verifyFilterCallback([](const std::vector<DemuxFilterEvent>&) { return true; });
mFilterTests.startFilter(filterId);
+
+ auto timeout = std::chrono::seconds(30);
+ ASSERT_EQ(future.wait_for(timeout), std::future_status::ready);
+
mFilterTests.stopFilter(filterId);
if (!mediaFilter) {
- auto cb = mFilterTests.getFilterCallbacks().at(filterId);
int callbackSize = 0;
- auto future = cb->verifyFilterCallback(
+ future = cb->verifyFilterCallback(
[&callbackSize](const std::vector<DemuxFilterEvent>& events) {
for (const auto& event : events) {
callbackSize += getDemuxFilterEventDataLength(event);
@@ -744,11 +754,9 @@
// hint beforehand.
ASSERT_TRUE(mFilterTests.configFilter(filterConf.settings, filterId));
- auto startTime = std::chrono::steady_clock::now();
ASSERT_TRUE(mFilterTests.startFilter(filterId));
// block and wait for callback to be received.
- auto timeout = std::chrono::seconds(30);
ASSERT_EQ(future.wait_for(timeout), std::future_status::ready);
auto duration = std::chrono::steady_clock::now() - startTime;
@@ -891,6 +899,14 @@
mFrontendTests.debugInfoTest(frontendMap[live.frontendId]);
}
+TEST_P(TunerFrontendAidlTest, maxNumberOfFrontends) {
+ description("Test Max Frontend number");
+ if (!live.hasFrontendConnection) {
+ return;
+ }
+ mFrontendTests.maxNumberOfFrontendsTest();
+}
+
TEST_P(TunerBroadcastAidlTest, BroadcastDataFlowVideoFilterTest) {
description("Test Video Filter functionality in Broadcast use case.");
if (!live.hasFrontendConnection) {
diff --git a/wifi/1.5/default/wifi_feature_flags.cpp b/wifi/1.5/default/wifi_feature_flags.cpp
index 124ba32..70ce55a 100644
--- a/wifi/1.5/default/wifi_feature_flags.cpp
+++ b/wifi/1.5/default/wifi_feature_flags.cpp
@@ -157,43 +157,42 @@
// List of pre-defined interface combinations that can be enabled at runtime via
// setting the property: "kDebugPresetInterfaceCombinationIdxProperty" to the
// corresponding index value.
-static const std::vector<
- std::pair<std::string, std::vector<IWifiChip::ChipMode>>>
- kDebugChipModes{
+static const std::vector<std::pair<std::string, std::vector<IWifiChip::ChipMode>>> kDebugChipModes{
// Legacy combination - No STA/AP concurrencies.
// 0 - (1 AP) or (1 STA + 1 of (P2P or NAN))
{"No STA/AP Concurrency",
{{kMainModeId,
- ChipIfaceCombination::make_vec(
- {{{{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}},
+ ChipIfaceCombination::make_vec({{{{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}},
// STA + AP concurrency
// 1 - (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN))
{"STA + AP Concurrency",
- {{kMainModeId,
- ChipIfaceCombination::make_vec(
- {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}},
+ {{kMainModeId, ChipIfaceCombination::make_vec(
+ {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}},
// STA + STA concurrency
// 2 - (1 STA + 1 AP) or (2 STA + 1 of (P2P or NAN))
{"Dual STA Concurrency",
- {{kMainModeId,
- ChipIfaceCombination::make_vec(
- {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}},
+ {{kMainModeId, ChipIfaceCombination::make_vec(
+ {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}},
// AP + AP + STA concurrency
// 3 - (1 STA + 2 AP) or (1 STA + 1 of (P2P or NAN))
{"Dual AP Concurrency",
- {{kMainModeId,
- ChipIfaceCombination::make_vec(
- {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}},
+ {{kMainModeId, ChipIfaceCombination::make_vec(
+ {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}},
// STA + STA concurrency and AP + AP + STA concurrency
// 4 - (1 STA + 2 AP) or (2 STA + 1 of (P2P or NAN))
{"Dual STA & Dual AP Concurrency",
+ {{kMainModeId, ChipIfaceCombination::make_vec(
+ {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}},
+
+ // STA + STA concurrency
+ // 5 - (1 STA + 1 AP (bridged or single) | P2P | NAN), or (2 STA))
+ {"Dual STA or STA plus single other interface",
{{kMainModeId,
- ChipIfaceCombination::make_vec(
- {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}}};
+ ChipIfaceCombination::make_vec({{{{STA}, 1}, {{P2P, NAN, AP}, 1}}, {{{STA}, 2}}})}}}};
#undef STA
#undef AP