Merge "Add CAMERA in light type for android.hardware.light"
diff --git a/audio/7.1/Android.bp b/audio/7.1/Android.bp
index d0d96b6..52980e2 100644
--- a/audio/7.1/Android.bp
+++ b/audio/7.1/Android.bp
@@ -13,11 +13,13 @@
name: "android.hardware.audio@7.1",
root: "android.hardware",
srcs: [
+ "types.hal",
"IDevice.hal",
"IDevicesFactory.hal",
"IPrimaryDevice.hal",
"IStreamIn.hal",
"IStreamOut.hal",
+ "IStreamOutLatencyModeCallback.hal",
],
interfaces: [
"android.hardware.audio@7.0",
diff --git a/audio/7.1/IDevice.hal b/audio/7.1/IDevice.hal
index 373d17f..e0b1e92 100644
--- a/audio/7.1/IDevice.hal
+++ b/audio/7.1/IDevice.hal
@@ -85,4 +85,16 @@
Result retval,
IStreamIn inStream,
AudioConfig suggestedConfig);
+
+ /**
+ * Notifies the device module about the connection state of an input/output
+ * device attached to it. The devicePort identifies the device and may also
+ * provide extra information such as raw audio descriptors.
+ *
+ * @param devicePort audio device port.
+ * @param connected whether the device is connected.
+ * @return retval operation completion status.
+ */
+ setConnectedState_7_1(AudioPort devicePort, bool connected)
+ generates (Result retval);
};
diff --git a/audio/7.1/IStreamOut.hal b/audio/7.1/IStreamOut.hal
index 092a9a0..b2013cf 100644
--- a/audio/7.1/IStreamOut.hal
+++ b/audio/7.1/IStreamOut.hal
@@ -16,7 +16,54 @@
package android.hardware.audio@7.1;
+import @7.0::Result;
import @7.0::IStreamOut;
+import IStreamOutLatencyModeCallback;
+
interface IStreamOut extends @7.0::IStreamOut {
+ /**
+ * Indicates the requested latency mode for this output stream.
+ *
+ * The requested mode can be one of the modes returned by
+ * getRecommendedLatencyModes() API.
+ *
+ * Optional method.
+ * Mandated only on specific spatial audio streams indicated by
+ * AUDIO_OUTPUT_FLAG_SPATIALIZER flag if they can be routed to a BT classic sink.
+ *
+ * @return retval operation completion status.
+ */
+ setLatencyMode(LatencyMode mode) generates (Result retval);
+
+ /**
+ * Indicates which latency modes are currently supported on this output stream.
+ * If the transport protocol (e.g Bluetooth A2DP) used by this output stream to reach
+ * the output device supports variable latency modes, the HAL indicates which
+ * modes are currently supported.
+ * The framework can then call setLatencyMode() with one of the supported modes to select
+ * the desired operation mode.
+ *
+ * Optional method.
+ * Mandated only on specific spatial audio streams indicated by
+ * AUDIO_OUTPUT_FLAG_SPATIALIZER flag if they can be routed to a BT classic sink.
+ *
+ * @return retval operation completion status.
+ * @return modes currrently supported latency modes.
+ */
+ getRecommendedLatencyModes() generates (Result retval, vec<LatencyMode> modes);
+
+ /**
+ * Set the callback interface for notifying changes in supported latency modes.
+ *
+ * Calling this method with a null pointer will result in releasing
+ * the callback.
+ *
+ * Optional method.
+ * Mandated only on specific spatial audio streams indicated by
+ * AUDIO_OUTPUT_FLAG_SPATIALIZER flag if they can be routed to a BT classic sink.
+ *
+ * @return retval operation completion status.
+ */
+ setLatencyModeCallback(IStreamOutLatencyModeCallback callback) generates (Result retval);
};
diff --git a/audio/7.1/IStreamOutLatencyModeCallback.hal b/audio/7.1/IStreamOutLatencyModeCallback.hal
new file mode 100644
index 0000000..45b453f
--- /dev/null
+++ b/audio/7.1/IStreamOutLatencyModeCallback.hal
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package android.hardware.audio@7.1;
+
+/**
+ * Callback interface for output stream variable latency mode feature.
+ */
+interface IStreamOutLatencyModeCallback {
+ /**
+ * Called with the new list of supported latency modes when a change occurs.
+ */
+ oneway onRecommendedLatencyModeChanged(vec<LatencyMode> modes);
+};
diff --git a/audio/7.1/config/api/current.txt b/audio/7.1/config/api/current.txt
index 01c2e4b..2963904 100644
--- a/audio/7.1/config/api/current.txt
+++ b/audio/7.1/config/api/current.txt
@@ -62,6 +62,8 @@
enum_constant public static final android.audio.policy.configuration.V7_1.AudioChannelMask AUDIO_CHANNEL_OUT_7POINT1;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioChannelMask AUDIO_CHANNEL_OUT_7POINT1POINT2;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioChannelMask AUDIO_CHANNEL_OUT_7POINT1POINT4;
+ enum_constant public static final android.audio.policy.configuration.V7_1.AudioChannelMask AUDIO_CHANNEL_OUT_9POINT1POINT4;
+ enum_constant public static final android.audio.policy.configuration.V7_1.AudioChannelMask AUDIO_CHANNEL_OUT_9POINT1POINT6;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioChannelMask AUDIO_CHANNEL_OUT_HAPTIC_AB;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioChannelMask AUDIO_CHANNEL_OUT_MONO;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioChannelMask AUDIO_CHANNEL_OUT_MONO_HAPTIC_A;
@@ -125,6 +127,7 @@
enum_constant public static final android.audio.policy.configuration.V7_1.AudioDevice AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioDevice AUDIO_DEVICE_OUT_AUX_DIGITAL;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioDevice AUDIO_DEVICE_OUT_AUX_LINE;
+ enum_constant public static final android.audio.policy.configuration.V7_1.AudioDevice AUDIO_DEVICE_OUT_BLE_BROADCAST;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioDevice AUDIO_DEVICE_OUT_BLE_HEADSET;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioDevice AUDIO_DEVICE_OUT_BLE_SPEAKER;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_A2DP;
@@ -284,6 +287,7 @@
enum_constant public static final android.audio.policy.configuration.V7_1.AudioInOutFlag AUDIO_OUTPUT_FLAG_NON_BLOCKING;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioInOutFlag AUDIO_OUTPUT_FLAG_PRIMARY;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioInOutFlag AUDIO_OUTPUT_FLAG_RAW;
+ enum_constant public static final android.audio.policy.configuration.V7_1.AudioInOutFlag AUDIO_OUTPUT_FLAG_SPATIALIZER;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioInOutFlag AUDIO_OUTPUT_FLAG_SYNC;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioInOutFlag AUDIO_OUTPUT_FLAG_TTS;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioInOutFlag AUDIO_OUTPUT_FLAG_VOIP_RX;
@@ -458,6 +462,7 @@
method @Nullable public String getName();
method @Nullable public java.util.List<android.audio.policy.configuration.V7_1.AudioUsage> getPreferredUsage();
method @Nullable public java.util.List<android.audio.policy.configuration.V7_1.Profile> getProfile();
+ method @Nullable public long getRecommendedMuteDurationMs();
method @Nullable public android.audio.policy.configuration.V7_1.Role getRole();
method public void setFlags(@Nullable java.util.List<android.audio.policy.configuration.V7_1.AudioInOutFlag>);
method public void setGains(@Nullable android.audio.policy.configuration.V7_1.Gains);
@@ -465,6 +470,7 @@
method public void setMaxOpenCount(@Nullable long);
method public void setName(@Nullable String);
method public void setPreferredUsage(@Nullable java.util.List<android.audio.policy.configuration.V7_1.AudioUsage>);
+ method public void setRecommendedMuteDurationMs(@Nullable long);
method public void setRole(@Nullable android.audio.policy.configuration.V7_1.Role);
}
diff --git a/audio/7.1/config/audio_policy_configuration.xsd b/audio/7.1/config/audio_policy_configuration.xsd
index 731bb7c..414552e 100644
--- a/audio/7.1/config/audio_policy_configuration.xsd
+++ b/audio/7.1/config/audio_policy_configuration.xsd
@@ -179,6 +179,7 @@
<xs:enumeration value="AUDIO_OUTPUT_FLAG_VOIP_RX" />
<xs:enumeration value="AUDIO_OUTPUT_FLAG_INCALL_MUSIC" />
<xs:enumeration value="AUDIO_OUTPUT_FLAG_GAPLESS_OFFLOAD" />
+ <xs:enumeration value="AUDIO_OUTPUT_FLAG_SPATIALIZER" />
<xs:enumeration value="AUDIO_INPUT_FLAG_FAST" />
<xs:enumeration value="AUDIO_INPUT_FLAG_HW_HOTWORD" />
<xs:enumeration value="AUDIO_INPUT_FLAG_RAW" />
@@ -225,6 +226,7 @@
</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute name="recommendedMuteDurationMs" type="xs:unsignedInt"/>
</xs:complexType>
<xs:unique name="mixPortProfileUniqueness">
<xs:selector xpath="profile"/>
@@ -276,6 +278,7 @@
<xs:enumeration value="AUDIO_DEVICE_OUT_ECHO_CANCELLER"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_BLE_HEADSET"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_BLE_SPEAKER"/>
+ <xs:enumeration value="AUDIO_DEVICE_OUT_BLE_BROADCAST"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_DEFAULT"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_STUB"/>
@@ -510,6 +513,8 @@
<xs:enumeration value="AUDIO_CHANNEL_OUT_7POINT1"/>
<xs:enumeration value="AUDIO_CHANNEL_OUT_7POINT1POINT2"/>
<xs:enumeration value="AUDIO_CHANNEL_OUT_7POINT1POINT4"/>
+ <xs:enumeration value="AUDIO_CHANNEL_OUT_9POINT1POINT4"/>
+ <xs:enumeration value="AUDIO_CHANNEL_OUT_9POINT1POINT6"/>
<xs:enumeration value="AUDIO_CHANNEL_OUT_13POINT_360RA"/>
<xs:enumeration value="AUDIO_CHANNEL_OUT_22POINT2"/>
<xs:enumeration value="AUDIO_CHANNEL_OUT_MONO_HAPTIC_A"/>
diff --git a/audio/7.1/types.hal b/audio/7.1/types.hal
new file mode 100644
index 0000000..9d8ee4d
--- /dev/null
+++ b/audio/7.1/types.hal
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio@7.1;
+
+/**
+ * Latency modes used for the variable latency feature on output streams.
+ * Used by setLatencyMode() and getRecommendedLatencyModes() methods.
+ */
+
+@export(name="audio_latency_mode_t", value_prefix="AUDIO_LATENCY_MODE_")
+enum LatencyMode : int32_t {
+ /** No specific constraint on the latency */
+ FREE = 0,
+ /** A relatively low latency compatible with head tracking operation (e.g less than 100ms) */
+ LOW = 1,
+};
diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp
index c172674..6a0cfa5 100644
--- a/audio/aidl/Android.bp
+++ b/audio/aidl/Android.bp
@@ -47,6 +47,11 @@
vndk: {
enabled: true,
},
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.bluetooth",
+ ],
+ min_sdk_version: "31",
},
},
versions: [
diff --git a/audio/common/7.1/enums/include/android_audio_policy_configuration_V7_1-enums.h b/audio/common/7.1/enums/include/android_audio_policy_configuration_V7_1-enums.h
index 815f869..6f6a0ca 100644
--- a/audio/common/7.1/enums/include/android_audio_policy_configuration_V7_1-enums.h
+++ b/audio/common/7.1/enums/include/android_audio_policy_configuration_V7_1-enums.h
@@ -97,10 +97,12 @@
case AudioChannelMask::AUDIO_CHANNEL_OUT_13POINT_360RA:
case AudioChannelMask::AUDIO_CHANNEL_INDEX_MASK_13:
return 13;
+ case AudioChannelMask::AUDIO_CHANNEL_OUT_9POINT1POINT4:
case AudioChannelMask::AUDIO_CHANNEL_INDEX_MASK_14:
return 14;
case AudioChannelMask::AUDIO_CHANNEL_INDEX_MASK_15:
return 15;
+ case AudioChannelMask::AUDIO_CHANNEL_OUT_9POINT1POINT6:
case AudioChannelMask::AUDIO_CHANNEL_INDEX_MASK_16:
return 16;
case AudioChannelMask::AUDIO_CHANNEL_INDEX_MASK_17:
@@ -170,6 +172,7 @@
case AudioDevice::AUDIO_DEVICE_OUT_ECHO_CANCELLER:
case AudioDevice::AUDIO_DEVICE_OUT_BLE_HEADSET:
case AudioDevice::AUDIO_DEVICE_OUT_BLE_SPEAKER:
+ case AudioDevice::AUDIO_DEVICE_OUT_BLE_BROADCAST:
case AudioDevice::AUDIO_DEVICE_OUT_DEFAULT:
case AudioDevice::AUDIO_DEVICE_OUT_STUB:
return true;
diff --git a/audio/core/all-versions/default/Device.cpp b/audio/core/all-versions/default/Device.cpp
index ac5a3ba..ca8c03d 100644
--- a/audio/core/all-versions/default/Device.cpp
+++ b/audio/core/all-versions/default/Device.cpp
@@ -616,6 +616,21 @@
#endif
+#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
+Return<Result> Device::setConnectedState_7_1(const AudioPort& devicePort, bool connected) {
+ if (version() >= AUDIO_DEVICE_API_VERSION_3_2 &&
+ mDevice->set_device_connected_state_v7 != nullptr) {
+ audio_port_v7 halPort;
+ if (status_t status = HidlUtils::audioPortToHal(devicePort, &halPort); status != NO_ERROR) {
+ return analyzeStatus("audioPortToHal", status);
+ }
+ return analyzeStatus("set_device_connected_state_v7",
+ mDevice->set_device_connected_state_v7(mDevice, &halPort, connected));
+ }
+ return Result::NOT_SUPPORTED;
+}
+#endif
+
} // namespace implementation
} // namespace CPP_VERSION
} // namespace audio
diff --git a/audio/core/all-versions/default/StreamOut.cpp b/audio/core/all-versions/default/StreamOut.cpp
index d4a89d7..09df4ed 100644
--- a/audio/core/all-versions/default/StreamOut.cpp
+++ b/audio/core/all-versions/default/StreamOut.cpp
@@ -761,6 +761,73 @@
ALOGW_IF(!result.isOk(), "Client callback failed: %s", result.description().c_str());
return 0;
}
+
+#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
+Return<Result> StreamOut::setLatencyMode(LatencyMode mode) {
+ return mStream->set_latency_mode != nullptr
+ ? Stream::analyzeStatus(
+ "set_latency_mode",
+ mStream->set_latency_mode(mStream,
+ static_cast<audio_latency_mode_t>(mode)))
+ : Result::NOT_SUPPORTED;
+};
+
+Return<void> StreamOut::getRecommendedLatencyModes(getRecommendedLatencyModes_cb _hidl_cb) {
+ Result retval = Result::NOT_SUPPORTED;
+ hidl_vec<LatencyMode> hidlModes;
+ size_t num_modes = AUDIO_LATENCY_MODE_CNT;
+ audio_latency_mode_t modes[AUDIO_LATENCY_MODE_CNT];
+
+ if (mStream->get_recommended_latency_modes != nullptr &&
+ mStream->get_recommended_latency_modes(mStream, &modes[0], &num_modes) == 0) {
+ if (num_modes == 0 || num_modes > AUDIO_LATENCY_MODE_CNT) {
+ ALOGW("%s invalid number of modes returned: %zu", __func__, num_modes);
+ retval = Result::INVALID_STATE;
+ } else {
+ hidlModes.resize(num_modes);
+ for (size_t i = 0; i < num_modes; ++i) {
+ hidlModes[i] = static_cast<LatencyMode>(modes[i]);
+ }
+ retval = Result::OK;
+ }
+ }
+ _hidl_cb(retval, hidlModes);
+ return Void();
+};
+
+// static
+void StreamOut::latencyModeCallback(audio_latency_mode_t* modes, size_t num_modes, void* cookie) {
+ StreamOut* self = reinterpret_cast<StreamOut*>(cookie);
+ sp<IStreamOutLatencyModeCallback> callback = self->mLatencyModeCallback.load();
+ if (callback.get() == nullptr) return;
+
+ ALOGV("%s", __func__);
+
+ if (num_modes == 0 || num_modes > AUDIO_LATENCY_MODE_CNT) {
+ ALOGW("%s invalid number of modes returned: %zu", __func__, num_modes);
+ return;
+ }
+
+ hidl_vec<LatencyMode> hidlModes(num_modes);
+ for (size_t i = 0; i < num_modes; ++i) {
+ hidlModes[i] = static_cast<LatencyMode>(modes[i]);
+ }
+ Return<void> result = callback->onRecommendedLatencyModeChanged(hidlModes);
+ ALOGW_IF(!result.isOk(), "Client callback failed: %s", result.description().c_str());
+}
+
+Return<Result> StreamOut::setLatencyModeCallback(
+ const sp<IStreamOutLatencyModeCallback>& callback) {
+ if (mStream->set_latency_mode_callback == nullptr) return Result::NOT_SUPPORTED;
+ int result = mStream->set_latency_mode_callback(mStream, StreamOut::latencyModeCallback, this);
+ if (result == 0) {
+ mLatencyModeCallback = callback;
+ }
+ return Stream::analyzeStatus("set_latency_mode_callback", result, {ENOSYS} /*ignore*/);
+};
+
+#endif
+
#endif
} // namespace implementation
diff --git a/audio/core/all-versions/default/include/core/default/Device.h b/audio/core/all-versions/default/include/core/default/Device.h
index 0aeb6b3..8cde3e0 100644
--- a/audio/core/all-versions/default/include/core/default/Device.h
+++ b/audio/core/all-versions/default/include/core/default/Device.h
@@ -163,6 +163,9 @@
const hidl_vec<AudioPortConfig>& sinks,
createAudioPatch_cb _hidl_cb) override;
#endif
+#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
+ Return<Result> setConnectedState_7_1(const AudioPort& devicePort, bool connected) override;
+#endif
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
// Utility methods for extending interfaces.
diff --git a/audio/core/all-versions/default/include/core/default/StreamOut.h b/audio/core/all-versions/default/include/core/default/StreamOut.h
index 60ad5d5..ce5253f 100644
--- a/audio/core/all-versions/default/include/core/default/StreamOut.h
+++ b/audio/core/all-versions/default/include/core/default/StreamOut.h
@@ -153,6 +153,12 @@
Result doUpdateSourceMetadata(const SourceMetadata& sourceMetadata);
#if MAJOR_VERSION >= 7
Result doUpdateSourceMetadataV7(const SourceMetadata& sourceMetadata);
+#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
+ Return<Result> setLatencyMode(LatencyMode mode) override;
+ Return<void> getRecommendedLatencyModes(getRecommendedLatencyModes_cb _hidl_cb) override;
+ Return<Result> setLatencyModeCallback(
+ const sp<IStreamOutLatencyModeCallback>& callback) override;
+#endif
#endif
#endif // MAJOR_VERSION >= 4
@@ -163,6 +169,9 @@
mediautils::atomic_sp<IStreamOutCallback> mCallback; // for non-blocking write and drain
#if MAJOR_VERSION >= 6
mediautils::atomic_sp<IStreamOutEventCallback> mEventCallback;
+#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
+ mediautils::atomic_sp<IStreamOutLatencyModeCallback> mLatencyModeCallback;
+#endif
#endif
std::unique_ptr<CommandMQ> mCommandMQ;
std::unique_ptr<DataMQ> mDataMQ;
@@ -177,6 +186,9 @@
#if MAJOR_VERSION >= 6
static int asyncEventCallback(stream_event_callback_type_t event, void* param, void* cookie);
+#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
+ static void latencyModeCallback(audio_latency_mode_t* modes, size_t num_modes, void* cookie);
+#endif
#endif
};
diff --git a/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp
index b750f56..d82d4ad 100644
--- a/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp
@@ -16,3 +16,34 @@
// pull in all the <= 7.0 tests
#include "7.0/AudioPrimaryHidlHalTest.cpp"
+
+TEST_P(AudioHidlDeviceTest, SetConnectedState_7_1) {
+ doc::test("Check that the HAL can be notified of device connection and disconnection");
+ using AD = xsd::AudioDevice;
+ for (auto deviceType : {AD::AUDIO_DEVICE_OUT_HDMI, AD::AUDIO_DEVICE_OUT_WIRED_HEADPHONE,
+ AD::AUDIO_DEVICE_IN_USB_HEADSET}) {
+ SCOPED_TRACE("device=" + toString(deviceType));
+ for (bool state : {true, false}) {
+ SCOPED_TRACE("state=" + ::testing::PrintToString(state));
+ DeviceAddress address = {};
+ address.deviceType = toString(deviceType);
+ if (deviceType == AD::AUDIO_DEVICE_IN_USB_HEADSET) {
+ address.address.alsa({0, 0});
+ }
+ AudioPort devicePort;
+ devicePort.ext.device(address);
+ auto ret = getDevice()->setConnectedState_7_1(devicePort, state);
+ ASSERT_TRUE(ret.isOk());
+ if (ret == Result::NOT_SUPPORTED) {
+ doc::partialTest("setConnectedState_7_1 is not supported");
+ break; // other deviceType might be supported
+ }
+ ASSERT_OK(ret);
+ }
+ }
+
+ // Because there is no way of knowing if the devices were connected before
+ // calling setConnectedState, there is no way to restore the HAL to its
+ // initial state. To workaround this, destroy the HAL at the end of this test.
+ ASSERT_TRUE(resetDevice());
+}
diff --git a/automotive/evs/1.1/default/Android.bp b/automotive/evs/1.1/default/Android.bp
index ea1851f..4c08ef3 100644
--- a/automotive/evs/1.1/default/Android.bp
+++ b/automotive/evs/1.1/default/Android.bp
@@ -13,48 +13,46 @@
proprietary: true,
relative_install_path: "hw",
srcs: [
- "service.cpp",
- "EvsCamera.cpp",
- "EvsEnumerator.cpp",
- "EvsDisplay.cpp",
- "ConfigManager.cpp",
- "ConfigManagerUtil.cpp",
- "EvsUltrasonicsArray.cpp",
+ "*.cpp",
],
init_rc: ["android.hardware.automotive.evs@1.1-service.rc"],
-
shared_libs: [
+ "android.frameworks.automotive.display@1.0",
"android.hardware.automotive.evs@1.0",
"android.hardware.automotive.evs@1.1",
"android.hardware.camera.device@3.3",
+ "android.hardware.graphics.bufferqueue@1.0",
+ "android.hardware.graphics.bufferqueue@2.0",
"android.hidl.allocator@1.0",
"android.hidl.memory@1.0",
+ "android.hidl.token@1.0-utils",
+ "libEGL",
+ "libGLESv2",
"libbase",
"libbinder",
- "liblog",
+ "libbufferqueueconverter",
+ "libcamera_metadata",
"libhardware",
"libhidlbase",
"libhidlmemory",
"liblog",
+ "libtinyxml2",
"libui",
"libutils",
- "libcamera_metadata",
- "libtinyxml2",
- "android.hidl.token@1.0-utils",
- "android.frameworks.automotive.display@1.0",
- "android.hardware.graphics.bufferqueue@1.0",
- "android.hardware.graphics.bufferqueue@2.0",
],
-
cflags: [
"-O0",
"-g",
+ "-DLOG_TAG=\"MockEvsDriver\"",
+ "-DGL_GLEXT_PROTOTYPES",
+ "-DEGL_EGLEXT_PROTOTYPES",
],
-
+ include_dirs: [
+ "frameworks/native/include/",
+ ],
required: [
"evs_default_configuration.xml",
],
-
vintf_fragments: [
"manifest_android.hardware.automotive.evs@1.1-service.xml",
],
diff --git a/automotive/evs/1.1/default/ConfigManager.cpp b/automotive/evs/1.1/default/ConfigManager.cpp
index 986793e..ca8cfae 100644
--- a/automotive/evs/1.1/default/ConfigManager.cpp
+++ b/automotive/evs/1.1/default/ConfigManager.cpp
@@ -14,38 +14,40 @@
* limitations under the License.
*/
-#include <sstream>
-#include <fstream>
-#include <thread>
-
-#include <hardware/gralloc.h>
-#include <utils/SystemClock.h>
-#include <android/hardware/camera/device/3.2/ICameraDevice.h>
-
#include "ConfigManager.h"
-using ::android::hardware::camera::device::V3_2::StreamRotation;
+#include <android/hardware/camera/device/3.2/ICameraDevice.h>
+#include <hardware/gralloc.h>
+#include <utils/SystemClock.h>
+#include <fstream>
+#include <sstream>
+#include <thread>
+
+namespace android::hardware::automotive::evs::V1_1::implementation {
+
+using namespace std;
+using namespace tinyxml2;
+using hardware::camera::device::V3_2::StreamRotation;
ConfigManager::~ConfigManager() {
/* Nothing to do */
}
-
-void ConfigManager::readCameraInfo(const XMLElement * const aCameraElem) {
+void ConfigManager::readCameraInfo(const XMLElement* const aCameraElem) {
if (aCameraElem == nullptr) {
ALOGW("XML file does not have required camera element");
return;
}
- const XMLElement *curElem = aCameraElem->FirstChildElement();
+ const XMLElement* curElem = aCameraElem->FirstChildElement();
while (curElem != nullptr) {
if (!strcmp(curElem->Name(), "group")) {
/* camera group identifier */
- const char *id = curElem->FindAttribute("id")->Value();
+ const char* id = curElem->FindAttribute("id")->Value();
/* create a camera group to be filled */
- CameraGroupInfo *aCamera = new CameraGroupInfo();
+ CameraGroupInfo* aCamera = new CameraGroupInfo();
/* read camera device information */
if (!readCameraDeviceInfo(aCamera, curElem)) {
@@ -55,28 +57,26 @@
}
/* camera group synchronization */
- const char *sync = curElem->FindAttribute("synchronized")->Value();
+ const char* sync = curElem->FindAttribute("synchronized")->Value();
if (!strcmp(sync, "CALIBRATED")) {
- aCamera->synchronized =
- ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED;
+ aCamera->synchronized = ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED;
} else if (!strcmp(sync, "APPROXIMATE")) {
- aCamera->synchronized =
- ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE;
+ aCamera->synchronized = ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE;
} else {
- aCamera->synchronized = 0; // Not synchronized
+ aCamera->synchronized = 0; // Not synchronized
}
/* add a group to hash map */
mCameraGroupInfos.insert_or_assign(id, unique_ptr<CameraGroupInfo>(aCamera));
} else if (!strcmp(curElem->Name(), "device")) {
/* camera unique identifier */
- const char *id = curElem->FindAttribute("id")->Value();
+ const char* id = curElem->FindAttribute("id")->Value();
/* camera mount location */
- const char *pos = curElem->FindAttribute("position")->Value();
+ const char* pos = curElem->FindAttribute("position")->Value();
/* create a camera device to be filled */
- CameraInfo *aCamera = new CameraInfo();
+ CameraInfo* aCamera = new CameraInfo();
/* read camera device information */
if (!readCameraDeviceInfo(aCamera, curElem)) {
@@ -99,10 +99,7 @@
}
}
-
-bool
-ConfigManager::readCameraDeviceInfo(CameraInfo *aCamera,
- const XMLElement *aDeviceElem) {
+bool ConfigManager::readCameraDeviceInfo(CameraInfo* aCamera, const XMLElement* aDeviceElem) {
if (aCamera == nullptr || aDeviceElem == nullptr) {
return false;
}
@@ -113,16 +110,11 @@
/* read device capabilities */
totalEntries +=
- readCameraCapabilities(aDeviceElem->FirstChildElement("caps"),
- aCamera,
- totalDataSize);
-
+ readCameraCapabilities(aDeviceElem->FirstChildElement("caps"), aCamera, totalDataSize);
/* read camera metadata */
- totalEntries +=
- readCameraMetadata(aDeviceElem->FirstChildElement("characteristics"),
- aCamera,
- totalDataSize);
+ totalEntries += readCameraMetadata(aDeviceElem->FirstChildElement("characteristics"), aCamera,
+ totalDataSize);
/* construct camera_metadata_t */
if (!constructCameraMetadata(aCamera, totalEntries, totalDataSize)) {
@@ -133,40 +125,34 @@
return true;
}
-
-size_t
-ConfigManager::readCameraCapabilities(const XMLElement * const aCapElem,
- CameraInfo *aCamera,
- size_t &dataSize) {
+size_t ConfigManager::readCameraCapabilities(const XMLElement* const aCapElem, CameraInfo* aCamera,
+ size_t& dataSize) {
if (aCapElem == nullptr || aCamera == nullptr) {
return 0;
}
string token;
- const XMLElement *curElem = nullptr;
+ const XMLElement* curElem = nullptr;
/* a list of supported camera parameters/controls */
curElem = aCapElem->FirstChildElement("supported_controls");
if (curElem != nullptr) {
- const XMLElement *ctrlElem = curElem->FirstChildElement("control");
+ const XMLElement* ctrlElem = curElem->FirstChildElement("control");
while (ctrlElem != nullptr) {
- const char *nameAttr = ctrlElem->FindAttribute("name")->Value();;
+ const char* nameAttr = ctrlElem->FindAttribute("name")->Value();
+ ;
const int32_t minVal = stoi(ctrlElem->FindAttribute("min")->Value());
const int32_t maxVal = stoi(ctrlElem->FindAttribute("max")->Value());
int32_t stepVal = 1;
- const XMLAttribute *stepAttr = ctrlElem->FindAttribute("step");
+ const XMLAttribute* stepAttr = ctrlElem->FindAttribute("step");
if (stepAttr != nullptr) {
stepVal = stoi(stepAttr->Value());
}
CameraParam aParam;
- if (ConfigManagerUtil::convertToEvsCameraParam(nameAttr,
- aParam)) {
- aCamera->controls.emplace(
- aParam,
- make_tuple(minVal, maxVal, stepVal)
- );
+ if (ConfigManagerUtil::convertToEvsCameraParam(nameAttr, aParam)) {
+ aCamera->controls.emplace(aParam, make_tuple(minVal, maxVal, stepVal));
}
ctrlElem = ctrlElem->NextSiblingElement("control");
@@ -177,11 +163,11 @@
curElem = aCapElem->FirstChildElement("stream");
while (curElem != nullptr) {
/* read 5 attributes */
- const XMLAttribute *idAttr = curElem->FindAttribute("id");
- const XMLAttribute *widthAttr = curElem->FindAttribute("width");
- const XMLAttribute *heightAttr = curElem->FindAttribute("height");
- const XMLAttribute *fmtAttr = curElem->FindAttribute("format");
- const XMLAttribute *fpsAttr = curElem->FindAttribute("framerate");
+ const XMLAttribute* idAttr = curElem->FindAttribute("id");
+ const XMLAttribute* widthAttr = curElem->FindAttribute("width");
+ const XMLAttribute* heightAttr = curElem->FindAttribute("height");
+ const XMLAttribute* fmtAttr = curElem->FindAttribute("format");
+ const XMLAttribute* fpsAttr = curElem->FindAttribute("framerate");
const int32_t id = stoi(idAttr->Value());
int32_t framerate = 0;
@@ -190,16 +176,13 @@
}
int32_t pixFormat;
- if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(),
- pixFormat)) {
- RawStreamConfiguration cfg = {
- id,
- stoi(widthAttr->Value()),
- stoi(heightAttr->Value()),
- pixFormat,
- ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT,
- framerate
- };
+ if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(), pixFormat)) {
+ RawStreamConfiguration cfg = {id,
+ stoi(widthAttr->Value()),
+ stoi(heightAttr->Value()),
+ pixFormat,
+ ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT,
+ framerate};
aCamera->streamConfigurations.insert_or_assign(id, cfg);
}
@@ -207,70 +190,58 @@
}
dataSize = calculate_camera_metadata_entry_data_size(
- get_camera_metadata_tag_type(
- ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS
- ),
- aCamera->streamConfigurations.size() * kStreamCfgSz
- );
+ get_camera_metadata_tag_type(ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS),
+ aCamera->streamConfigurations.size() * kStreamCfgSz);
/* a single camera metadata entry contains multiple stream configurations */
return dataSize > 0 ? 1 : 0;
}
-
-size_t
-ConfigManager::readCameraMetadata(const XMLElement * const aParamElem,
- CameraInfo *aCamera,
- size_t &dataSize) {
+size_t ConfigManager::readCameraMetadata(const XMLElement* const aParamElem, CameraInfo* aCamera,
+ size_t& dataSize) {
if (aParamElem == nullptr || aCamera == nullptr) {
return 0;
}
- const XMLElement *curElem = aParamElem->FirstChildElement("parameter");
+ const XMLElement* curElem = aParamElem->FirstChildElement("parameter");
size_t numEntries = 0;
camera_metadata_tag_t tag;
while (curElem != nullptr) {
if (!ConfigManagerUtil::convertToMetadataTag(curElem->FindAttribute("name")->Value(),
tag)) {
- switch(tag) {
+ switch (tag) {
case ANDROID_LENS_DISTORTION:
case ANDROID_LENS_POSE_ROTATION:
case ANDROID_LENS_POSE_TRANSLATION:
case ANDROID_LENS_INTRINSIC_CALIBRATION: {
/* float[] */
size_t count = 0;
- void *data = ConfigManagerUtil::convertFloatArray(
- curElem->FindAttribute("size")->Value(),
- curElem->FindAttribute("value")->Value(),
- count
- );
+ void* data = ConfigManagerUtil::convertFloatArray(
+ curElem->FindAttribute("size")->Value(),
+ curElem->FindAttribute("value")->Value(), count);
aCamera->cameraMetadata.insert_or_assign(
- tag, make_pair(make_unique<void *>(data), count)
- );
+ tag, make_pair(make_unique<void*>(data), count));
++numEntries;
dataSize += calculate_camera_metadata_entry_data_size(
- get_camera_metadata_tag_type(tag), count
- );
+ get_camera_metadata_tag_type(tag), count);
break;
}
case ANDROID_REQUEST_AVAILABLE_CAPABILITIES: {
- camera_metadata_enum_android_request_available_capabilities_t *data =
- new camera_metadata_enum_android_request_available_capabilities_t[1];
+ camera_metadata_enum_android_request_available_capabilities_t* data =
+ new camera_metadata_enum_android_request_available_capabilities_t[1];
if (ConfigManagerUtil::convertToCameraCapability(
- curElem->FindAttribute("value")->Value(), *data)) {
- curElem->FindAttribute("value")->Value(),
- aCamera->cameraMetadata.insert_or_assign(
- tag, make_pair(make_unique<void *>(data), 1)
- );
+ curElem->FindAttribute("value")->Value(), *data)) {
+ curElem->FindAttribute("value")->Value(),
+ aCamera->cameraMetadata.insert_or_assign(
+ tag, make_pair(make_unique<void*>(data), 1));
++numEntries;
dataSize += calculate_camera_metadata_entry_data_size(
- get_camera_metadata_tag_type(tag), 1
- );
+ get_camera_metadata_tag_type(tag), 1);
}
break;
}
@@ -278,13 +249,11 @@
case ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS: {
/* a comma-separated list of physical camera devices */
size_t len = strlen(curElem->FindAttribute("value")->Value());
- char *data = new char[len + 1];
- memcpy(data,
- curElem->FindAttribute("value")->Value(),
- len * sizeof(char));
+ char* data = new char[len + 1];
+ memcpy(data, curElem->FindAttribute("value")->Value(), len * sizeof(char));
/* replace commas with null char */
- char *p = data;
+ char* p = data;
while (*p != '\0') {
if (*p == ',') {
*p = '\0';
@@ -293,19 +262,16 @@
}
aCamera->cameraMetadata.insert_or_assign(
- tag, make_pair(make_unique<void *>(data), len)
- );
+ tag, make_pair(make_unique<void*>(data), len));
++numEntries;
dataSize += calculate_camera_metadata_entry_data_size(
- get_camera_metadata_tag_type(tag), len
- );
+ get_camera_metadata_tag_type(tag), len);
break;
}
default:
- ALOGW("Parameter %s is not supported",
- curElem->FindAttribute("name")->Value());
+ ALOGW("Parameter %s is not supported", curElem->FindAttribute("name")->Value());
break;
}
}
@@ -316,11 +282,8 @@
return numEntries;
}
-
-bool
-ConfigManager::constructCameraMetadata(CameraInfo *aCamera,
- const size_t totalEntries,
- const size_t totalDataSize) {
+bool ConfigManager::constructCameraMetadata(CameraInfo* aCamera, const size_t totalEntries,
+ const size_t totalDataSize) {
if (aCamera == nullptr || !aCamera->allocate(totalEntries, totalDataSize)) {
ALOGE("Failed to allocate memory for camera metadata");
return false;
@@ -328,16 +291,15 @@
const size_t numStreamConfigs = aCamera->streamConfigurations.size();
unique_ptr<int32_t[]> data(new int32_t[kStreamCfgSz * numStreamConfigs]);
- int32_t *ptr = data.get();
- for (auto &cfg : aCamera->streamConfigurations) {
+ int32_t* ptr = data.get();
+ for (auto& cfg : aCamera->streamConfigurations) {
for (auto i = 0; i < kStreamCfgSz; ++i) {
- *ptr++ = cfg.second[i];
+ *ptr++ = cfg.second[i];
}
}
int32_t err = add_camera_metadata_entry(aCamera->characteristics,
ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS,
- data.get(),
- numStreamConfigs * kStreamCfgSz);
+ data.get(), numStreamConfigs * kStreamCfgSz);
if (err) {
ALOGE("Failed to add stream configurations to metadata, ignored");
@@ -345,11 +307,9 @@
}
bool success = true;
- for (auto &[tag, entry] : aCamera->cameraMetadata) {
+ for (auto& [tag, entry] : aCamera->cameraMetadata) {
/* try to add new camera metadata entry */
- int32_t err = add_camera_metadata_entry(aCamera->characteristics,
- tag,
- entry.first.get(),
+ int32_t err = add_camera_metadata_entry(aCamera->characteristics, tag, entry.first.get(),
entry.second);
if (err) {
ALOGE("Failed to add an entry with a tag 0x%X", tag);
@@ -376,8 +336,7 @@
return success;
}
-
-void ConfigManager::readSystemInfo(const XMLElement * const aSysElem) {
+void ConfigManager::readSystemInfo(const XMLElement* const aSysElem) {
if (aSysElem == nullptr) {
return;
}
@@ -389,24 +348,22 @@
*/
/* read number of cameras available in the system */
- const XMLElement *xmlElem = aSysElem->FirstChildElement("num_cameras");
+ const XMLElement* xmlElem = aSysElem->FirstChildElement("num_cameras");
if (xmlElem != nullptr) {
- mSystemInfo.numCameras =
- stoi(xmlElem->FindAttribute("value")->Value());
+ mSystemInfo.numCameras = stoi(xmlElem->FindAttribute("value")->Value());
}
}
-
-void ConfigManager::readDisplayInfo(const XMLElement * const aDisplayElem) {
+void ConfigManager::readDisplayInfo(const XMLElement* const aDisplayElem) {
if (aDisplayElem == nullptr) {
ALOGW("XML file does not have required camera element");
return;
}
- const XMLElement *curDev = aDisplayElem->FirstChildElement("device");
+ const XMLElement* curDev = aDisplayElem->FirstChildElement("device");
while (curDev != nullptr) {
- const char *id = curDev->FindAttribute("id")->Value();
- //const char *pos = curDev->FirstAttribute("position")->Value();
+ const char* id = curDev->FindAttribute("id")->Value();
+ // const char *pos = curDev->FirstAttribute("position")->Value();
unique_ptr<DisplayInfo> dpy(new DisplayInfo());
if (dpy == nullptr) {
@@ -414,27 +371,26 @@
return;
}
- const XMLElement *cap = curDev->FirstChildElement("caps");
+ const XMLElement* cap = curDev->FirstChildElement("caps");
if (cap != nullptr) {
- const XMLElement *curStream = cap->FirstChildElement("stream");
+ const XMLElement* curStream = cap->FirstChildElement("stream");
while (curStream != nullptr) {
/* read 4 attributes */
- const XMLAttribute *idAttr = curStream->FindAttribute("id");
- const XMLAttribute *widthAttr = curStream->FindAttribute("width");
- const XMLAttribute *heightAttr = curStream->FindAttribute("height");
- const XMLAttribute *fmtAttr = curStream->FindAttribute("format");
+ const XMLAttribute* idAttr = curStream->FindAttribute("id");
+ const XMLAttribute* widthAttr = curStream->FindAttribute("width");
+ const XMLAttribute* heightAttr = curStream->FindAttribute("height");
+ const XMLAttribute* fmtAttr = curStream->FindAttribute("format");
const int32_t id = stoi(idAttr->Value());
int32_t pixFormat;
- if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(),
- pixFormat)) {
+ if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(), pixFormat)) {
RawStreamConfiguration cfg = {
- id,
- stoi(widthAttr->Value()),
- stoi(heightAttr->Value()),
- pixFormat,
- ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT,
- 0 // unused
+ id,
+ stoi(widthAttr->Value()),
+ stoi(heightAttr->Value()),
+ pixFormat,
+ ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT,
+ 0 // unused
};
dpy->streamConfigurations.insert_or_assign(id, cfg);
}
@@ -450,7 +406,6 @@
return;
}
-
bool ConfigManager::readConfigDataFromXML() noexcept {
XMLDocument xmlDoc;
@@ -464,7 +419,7 @@
}
/* retrieve the root element */
- const XMLElement *rootElem = xmlDoc.RootElement();
+ const XMLElement* rootElem = xmlDoc.RootElement();
if (strcmp(rootElem->Name(), "configuration")) {
ALOGE("A configuration file is not in the required format. "
"See /etc/automotive/evs/evs_configuration.dtd");
@@ -487,12 +442,10 @@
ALOGI("Parsing configuration file takes %lf (ms)",
(double)(parsingEnd - parsingStart) / 1000000.0);
-
return true;
}
-
-std::unique_ptr<ConfigManager> ConfigManager::Create(const char *path) {
+std::unique_ptr<ConfigManager> ConfigManager::Create(const char* path) {
unique_ptr<ConfigManager> cfgMgr(new ConfigManager(path));
/*
@@ -510,3 +463,4 @@
}
}
+} // namespace android::hardware::automotive::evs::V1_1::implementation
diff --git a/automotive/evs/1.1/default/ConfigManager.h b/automotive/evs/1.1/default/ConfigManager.h
index b0b2670..0a15360 100644
--- a/automotive/evs/1.1/default/ConfigManager.h
+++ b/automotive/evs/1.1/default/ConfigManager.h
@@ -13,28 +13,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef CONFIG_MANAGER_H
-#define CONFIG_MANAGER_H
-
-#include <vector>
-#include <string>
-#include <unordered_map>
-#include <unordered_set>
-
-#include <tinyxml2.h>
-
-#include <system/camera_metadata.h>
-#include <log/log.h>
-#include <android/hardware/automotive/evs/1.1/types.h>
+#ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_CONFIGMANAGER_H
+#define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_CONFIGMANAGER_H
#include "ConfigManagerUtil.h"
-using namespace std;
-using namespace tinyxml2;
+#include <android/hardware/automotive/evs/1.1/types.h>
+#include <log/log.h>
+#include <system/camera_metadata.h>
+#include <tinyxml2.h>
-using ::android::hardware::hidl_vec;
-using ::android::hardware::camera::device::V3_2::Stream;
-using ::android::hardware::automotive::evs::V1_1::CameraParam;
+#include <string>
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
+
+namespace android::hardware::automotive::evs::V1_1::implementation {
+
+using hardware::hidl_vec;
+using hardware::automotive::evs::V1_1::CameraParam;
+using hardware::camera::device::V3_2::Stream;
/*
* Plese note that this is different from what is defined in
@@ -45,8 +43,8 @@
typedef std::array<int32_t, kStreamCfgSz> RawStreamConfiguration;
class ConfigManager {
-public:
- static std::unique_ptr<ConfigManager> Create(const char *path = "");
+ public:
+ static std::unique_ptr<ConfigManager> Create(const char* path = "");
ConfigManager(const ConfigManager&) = delete;
ConfigManager& operator=(const ConfigManager&) = delete;
@@ -54,15 +52,11 @@
/* Camera device's capabilities and metadata */
class CameraInfo {
- public:
- CameraInfo() :
- characteristics(nullptr) {
- /* Nothing to do */
+ public:
+ CameraInfo() : characteristics(nullptr) { /* Nothing to do */
}
- virtual ~CameraInfo() {
- free_camera_metadata(characteristics);
- }
+ virtual ~CameraInfo() { free_camera_metadata(characteristics); }
/* Allocate memory for camera_metadata_t */
bool allocate(size_t entry_cap, size_t data_cap) {
@@ -79,50 +73,49 @@
* List of supported controls that the primary client can program.
* Paraemters are stored with its valid range
*/
- unordered_map<CameraParam,
- tuple<int32_t, int32_t, int32_t>> controls;
+ std::unordered_map<CameraParam, std::tuple<int32_t, int32_t, int32_t>> controls;
/*
* List of supported output stream configurations; each array stores
* format, width, height, and direction values in the order.
*/
- unordered_map<int32_t, RawStreamConfiguration> streamConfigurations;
+ std::unordered_map<int32_t, RawStreamConfiguration> streamConfigurations;
/*
* Internal storage for camera metadata. Each entry holds a pointer to
* data and number of elements
*/
- unordered_map<camera_metadata_tag_t,
- pair<unique_ptr<void *>, size_t>> cameraMetadata;
+ std::unordered_map<camera_metadata_tag_t, std::pair<std::unique_ptr<void*>, size_t>>
+ cameraMetadata;
/* Camera module characteristics */
- camera_metadata_t *characteristics;
+ camera_metadata_t* characteristics;
};
class CameraGroupInfo : public CameraInfo {
- public:
+ public:
CameraGroupInfo() {}
/* ID of member camera devices */
- unordered_set<string> devices;
+ std::unordered_set<std::string> devices;
/* The capture operation of member camera devices are synchronized */
bool synchronized = false;
};
class SystemInfo {
- public:
+ public:
/* number of available cameras */
int32_t numCameras = 0;
};
class DisplayInfo {
- public:
+ public:
/*
* List of supported input stream configurations; each array stores
* format, width, height, and direction values in the order.
*/
- unordered_map<int32_t, RawStreamConfiguration> streamConfigurations;
+ std::unordered_map<int32_t, RawStreamConfiguration> streamConfigurations;
};
/*
@@ -131,80 +124,74 @@
* @return SystemInfo
* Constant reference of SystemInfo.
*/
- const SystemInfo &getSystemInfo() {
- return mSystemInfo;
- }
+ const SystemInfo& getSystemInfo() { return mSystemInfo; }
/*
* Return a list of cameras
*
* This function assumes that it is not being called frequently.
*
- * @return vector<string>
+ * @return std::vector<std::string>
* A vector that contains unique camera device identifiers.
*/
- vector<string> getCameraList() {
- vector<string> aList;
- for (auto &v : mCameraInfo) {
- aList.emplace_back(v.first);
+ std::vector<std::string> getCameraList() {
+ std::vector<std::string> aList;
+ for (auto& v : mCameraInfo) {
+ aList.push_back(v.first);
}
return aList;
}
-
/*
* Return a list of cameras
*
* @return CameraGroupInfo
* A pointer to a camera group identified by a given id.
*/
- unique_ptr<CameraGroupInfo>& getCameraGroupInfo(const string& gid) {
+ std::unique_ptr<CameraGroupInfo>& getCameraGroupInfo(const std::string& gid) {
return mCameraGroupInfos[gid];
}
-
/*
* Return a camera metadata
*
* @param cameraId
- * Unique camera node identifier in string
+ * Unique camera node identifier in std::string
*
- * @return unique_ptr<CameraInfo>
+ * @return std::unique_ptr<CameraInfo>
* A pointer to CameraInfo that is associated with a given camera
* ID. This returns a null pointer if this does not recognize a
* given camera identifier.
*/
- unique_ptr<CameraInfo>& getCameraInfo(const string cameraId) noexcept {
+ std::unique_ptr<CameraInfo>& getCameraInfo(const std::string cameraId) noexcept {
return mCameraInfo[cameraId];
}
-private:
+ private:
/* Constructors */
- ConfigManager(const char *xmlPath) :
- mConfigFilePath(xmlPath) {
- }
+ ConfigManager(const char* xmlPath) : mConfigFilePath(xmlPath) {}
/* System configuration */
SystemInfo mSystemInfo;
/* Internal data structure for camera device information */
- unordered_map<string, unique_ptr<CameraInfo>> mCameraInfo;
+ std::unordered_map<std::string, std::unique_ptr<CameraInfo>> mCameraInfo;
/* Internal data structure for camera device information */
- unordered_map<string, unique_ptr<DisplayInfo>> mDisplayInfo;
+ std::unordered_map<std::string, std::unique_ptr<DisplayInfo>> mDisplayInfo;
/* Camera groups are stored in <groud id, CameraGroupInfo> hash map */
- unordered_map<string, unique_ptr<CameraGroupInfo>> mCameraGroupInfos;
+ std::unordered_map<std::string, std::unique_ptr<CameraGroupInfo>> mCameraGroupInfos;
/*
* Camera positions are stored in <position, camera id set> hash map.
* The position must be one of front, rear, left, and right.
*/
- unordered_map<string, unordered_set<string>> mCameraPosition;
+ std::unordered_map<std::string, std::unordered_set<std::string>> mCameraPosition;
/* A path to XML configuration file */
- const char *mConfigFilePath;
+ const char* mConfigFilePath;
/*
* Parse a given EVS configuration file and store the information
@@ -221,7 +208,7 @@
* @param aSysElem
* A pointer to "system" XML element.
*/
- void readSystemInfo(const XMLElement * const aSysElem);
+ void readSystemInfo(const tinyxml2::XMLElement* const aSysElem);
/*
* read the information of camera devices
@@ -230,7 +217,7 @@
* A pointer to "camera" XML element that may contain multiple
* "device" elements.
*/
- void readCameraInfo(const XMLElement * const aCameraElem);
+ void readCameraInfo(const tinyxml2::XMLElement* const aCameraElem);
/*
* read display device information
@@ -239,7 +226,7 @@
* A pointer to "display" XML element that may contain multiple
* "device" elements.
*/
- void readDisplayInfo(const XMLElement * const aDisplayElem);
+ void readDisplayInfo(const tinyxml2::XMLElement* const aDisplayElem);
/*
* read camera device information
@@ -255,8 +242,7 @@
* Return false upon any failure in reading and processing camera
* device information.
*/
- bool readCameraDeviceInfo(CameraInfo *aCamera,
- const XMLElement *aDeviceElem);
+ bool readCameraDeviceInfo(CameraInfo* aCamera, const tinyxml2::XMLElement* aDeviceElem);
/*
* read camera metadata
@@ -273,9 +259,8 @@
* @return size_t
* Number of camera metadata entries
*/
- size_t readCameraCapabilities(const XMLElement * const aCapElem,
- CameraInfo *aCamera,
- size_t &dataSize);
+ size_t readCameraCapabilities(const tinyxml2::XMLElement* const aCapElem, CameraInfo* aCamera,
+ size_t& dataSize);
/*
* read camera metadata
@@ -291,9 +276,8 @@
* @return size_t
* Number of camera metadata entries
*/
- size_t readCameraMetadata(const XMLElement * const aParamElem,
- CameraInfo *aCamera,
- size_t &dataSize);
+ size_t readCameraMetadata(const tinyxml2::XMLElement* const aParamElem, CameraInfo* aCamera,
+ size_t& dataSize);
/*
* construct camera_metadata_t from camera capabilities and metadata
@@ -310,9 +294,9 @@
* or its size is not large enough to add all found camera metadata
* entries.
*/
- bool constructCameraMetadata(CameraInfo *aCamera,
- const size_t totalEntries,
+ bool constructCameraMetadata(CameraInfo* aCamera, const size_t totalEntries,
const size_t totalDataSize);
};
-#endif // CONFIG_MANAGER_H
+} // namespace android::hardware::automotive::evs::V1_1::implementation
+#endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_CONFIGMANAGER_H
diff --git a/automotive/evs/1.1/default/ConfigManagerUtil.cpp b/automotive/evs/1.1/default/ConfigManagerUtil.cpp
index d10f236..5edd405 100644
--- a/automotive/evs/1.1/default/ConfigManagerUtil.cpp
+++ b/automotive/evs/1.1/default/ConfigManagerUtil.cpp
@@ -16,43 +16,45 @@
#include "ConfigManagerUtil.h"
-#include <string>
-#include <sstream>
-#include <linux/videodev2.h>
-
#include <log/log.h>
#include <system/graphics-base-v1.0.h>
+#include <linux/videodev2.h>
+#include <sstream>
+#include <string>
-bool ConfigManagerUtil::convertToEvsCameraParam(const string &id,
- CameraParam &camParam) {
+namespace android::hardware::automotive::evs::V1_1::implementation {
+
+using namespace std;
+
+bool ConfigManagerUtil::convertToEvsCameraParam(const string& id, CameraParam& camParam) {
string trimmed = ConfigManagerUtil::trimString(id);
bool success = true;
if (!trimmed.compare("BRIGHTNESS")) {
- camParam = CameraParam::BRIGHTNESS;
+ camParam = CameraParam::BRIGHTNESS;
} else if (!trimmed.compare("CONTRAST")) {
- camParam = CameraParam::CONTRAST;
+ camParam = CameraParam::CONTRAST;
} else if (!trimmed.compare("AUTOGAIN")) {
- camParam = CameraParam::AUTOGAIN;
+ camParam = CameraParam::AUTOGAIN;
} else if (!trimmed.compare("GAIN")) {
- camParam = CameraParam::GAIN;
+ camParam = CameraParam::GAIN;
} else if (!trimmed.compare("AUTO_WHITE_BALANCE")) {
- camParam = CameraParam::AUTO_WHITE_BALANCE;
+ camParam = CameraParam::AUTO_WHITE_BALANCE;
} else if (!trimmed.compare("WHITE_BALANCE_TEMPERATURE")) {
- camParam = CameraParam::WHITE_BALANCE_TEMPERATURE;
+ camParam = CameraParam::WHITE_BALANCE_TEMPERATURE;
} else if (!trimmed.compare("SHARPNESS")) {
- camParam = CameraParam::SHARPNESS;
+ camParam = CameraParam::SHARPNESS;
} else if (!trimmed.compare("AUTO_EXPOSURE")) {
- camParam = CameraParam::AUTO_EXPOSURE;
+ camParam = CameraParam::AUTO_EXPOSURE;
} else if (!trimmed.compare("ABSOLUTE_EXPOSURE")) {
- camParam = CameraParam::ABSOLUTE_EXPOSURE;
+ camParam = CameraParam::ABSOLUTE_EXPOSURE;
} else if (!trimmed.compare("ABSOLUTE_FOCUS")) {
- camParam = CameraParam::ABSOLUTE_FOCUS;
+ camParam = CameraParam::ABSOLUTE_FOCUS;
} else if (!trimmed.compare("AUTO_FOCUS")) {
- camParam = CameraParam::AUTO_FOCUS;
+ camParam = CameraParam::AUTO_FOCUS;
} else if (!trimmed.compare("ABSOLUTE_ZOOM")) {
- camParam = CameraParam::ABSOLUTE_ZOOM;
+ camParam = CameraParam::ABSOLUTE_ZOOM;
} else {
success = false;
}
@@ -60,18 +62,16 @@
return success;
}
-
-bool ConfigManagerUtil::convertToPixelFormat(const string &format,
- int32_t &pixFormat) {
+bool ConfigManagerUtil::convertToPixelFormat(const string& format, int32_t& pixFormat) {
string trimmed = ConfigManagerUtil::trimString(format);
bool success = true;
if (!trimmed.compare("RGBA_8888")) {
- pixFormat = HAL_PIXEL_FORMAT_RGBA_8888;
+ pixFormat = HAL_PIXEL_FORMAT_RGBA_8888;
} else if (!trimmed.compare("YCRCB_420_SP")) {
- pixFormat = HAL_PIXEL_FORMAT_YCRCB_420_SP;
+ pixFormat = HAL_PIXEL_FORMAT_YCRCB_420_SP;
} else if (!trimmed.compare("YCBCR_422_I")) {
- pixFormat = HAL_PIXEL_FORMAT_YCBCR_422_I;
+ pixFormat = HAL_PIXEL_FORMAT_YCBCR_422_I;
} else {
success = false;
}
@@ -79,21 +79,19 @@
return success;
}
-
-bool ConfigManagerUtil::convertToMetadataTag(const char *name,
- camera_metadata_tag &aTag) {
+bool ConfigManagerUtil::convertToMetadataTag(const char* name, camera_metadata_tag& aTag) {
if (!strcmp(name, "LENS_DISTORTION")) {
- aTag = ANDROID_LENS_DISTORTION;
+ aTag = ANDROID_LENS_DISTORTION;
} else if (!strcmp(name, "LENS_INTRINSIC_CALIBRATION")) {
- aTag = ANDROID_LENS_INTRINSIC_CALIBRATION;
+ aTag = ANDROID_LENS_INTRINSIC_CALIBRATION;
} else if (!strcmp(name, "LENS_POSE_ROTATION")) {
- aTag = ANDROID_LENS_POSE_ROTATION;
+ aTag = ANDROID_LENS_POSE_ROTATION;
} else if (!strcmp(name, "LENS_POSE_TRANSLATION")) {
- aTag = ANDROID_LENS_POSE_TRANSLATION;
+ aTag = ANDROID_LENS_POSE_TRANSLATION;
} else if (!strcmp(name, "REQUEST_AVAILABLE_CAPABILITIES")) {
- aTag = ANDROID_REQUEST_AVAILABLE_CAPABILITIES;
+ aTag = ANDROID_REQUEST_AVAILABLE_CAPABILITIES;
} else if (!strcmp(name, "LOGICAL_MULTI_CAMERA_PHYSICAL_IDS")) {
- aTag = ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS;
+ aTag = ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS;
} else {
return false;
}
@@ -101,11 +99,8 @@
return true;
}
-
bool ConfigManagerUtil::convertToCameraCapability(
- const char *name,
- camera_metadata_enum_android_request_available_capabilities_t &cap) {
-
+ const char* name, camera_metadata_enum_android_request_available_capabilities_t& cap) {
if (!strcmp(name, "DEPTH_OUTPUT")) {
cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT;
} else if (!strcmp(name, "LOGICAL_MULTI_CAMERA")) {
@@ -121,14 +116,13 @@
return true;
}
-
-float *ConfigManagerUtil::convertFloatArray(const char *sz, const char *vals,
- size_t &count, const char delimiter) {
+float* ConfigManagerUtil::convertFloatArray(const char* sz, const char* vals, size_t& count,
+ const char delimiter) {
string size_string(sz);
string value_string(vals);
count = stoi(size_string);
- float *result = new float[count];
+ float* result = new float[count];
stringstream values(value_string);
int32_t idx = 0;
@@ -140,8 +134,7 @@
return result;
}
-
-string ConfigManagerUtil::trimString(const string &src, const string &ws) {
+string ConfigManagerUtil::trimString(const string& src, const string& ws) {
const auto s = src.find_first_not_of(ws);
if (s == string::npos) {
return "";
@@ -153,3 +146,4 @@
return src.substr(s, r);
}
+} // namespace android::hardware::automotive::evs::V1_1::implementation
diff --git a/automotive/evs/1.1/default/ConfigManagerUtil.h b/automotive/evs/1.1/default/ConfigManagerUtil.h
index 1710cac..9d42ec1 100644
--- a/automotive/evs/1.1/default/ConfigManagerUtil.h
+++ b/automotive/evs/1.1/default/ConfigManagerUtil.h
@@ -13,57 +13,48 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef CONFIG_MANAGER_UTIL_H
-#define CONFIG_MANAGER_UTIL_H
+#ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_CONFIGMANAGERUTIL_H
+#define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_CONFIGMANAGERUTIL_H
-#include <utility>
-#include <string>
-#include <system/camera_metadata.h>
#include <android/hardware/automotive/evs/1.1/types.h>
+#include <system/camera_metadata.h>
+#include <string>
+#include <utility>
-using namespace std;
-using ::android::hardware::automotive::evs::V1_1::CameraParam;
-
+namespace android::hardware::automotive::evs::V1_1::implementation {
class ConfigManagerUtil {
-public:
+ public:
/**
* Convert a given string into V4L2_CID_*
*/
- static bool convertToEvsCameraParam(const string &id,
- CameraParam &camParam);
+ static bool convertToEvsCameraParam(const std::string& id, CameraParam& camParam);
/**
* Convert a given string into android.hardware.graphics.common.PixelFormat
*/
- static bool convertToPixelFormat(const string &format,
- int32_t &pixelFormat);
+ static bool convertToPixelFormat(const std::string& format, int32_t& pixelFormat);
/**
* Convert a given string into corresponding camera metadata data tag defined in
* system/media/camera/include/system/camera_metadta_tags.h
*/
- static bool convertToMetadataTag(const char *name,
- camera_metadata_tag &aTag);
+ static bool convertToMetadataTag(const char* name, camera_metadata_tag& aTag);
/**
* Convert a given string into a floating value array
*/
- static float *convertFloatArray(const char *sz,
- const char *vals,
- size_t &count,
+ static float* convertFloatArray(const char* sz, const char* vals, size_t& count,
const char delimiter = ',');
/**
* Trim a string
*/
- static string trimString(const string &src,
- const string &ws = " \n\r\t\f\v");
+ static std::string trimString(const std::string& src, const std::string& ws = " \n\r\t\f\v");
/**
* Convert a given string to corresponding camera capabilities
*/
static bool convertToCameraCapability(
- const char *name,
- camera_metadata_enum_android_request_available_capabilities_t &cap);
-
+ const char* name, camera_metadata_enum_android_request_available_capabilities_t& cap);
};
-#endif // CONFIG_MANAGER_UTIL_H
+} // namespace android::hardware::automotive::evs::V1_1::implementation
+#endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_CONFIGMANAGERUTIL_H
diff --git a/automotive/evs/1.1/default/EvsCamera.cpp b/automotive/evs/1.1/default/EvsCamera.cpp
index 0e69ed4..520670a 100644
--- a/automotive/evs/1.1/default/EvsCamera.cpp
+++ b/automotive/evs/1.1/default/EvsCamera.cpp
@@ -14,69 +14,69 @@
* limitations under the License.
*/
-#define LOG_TAG "android.hardware.automotive.evs@1.1-service"
-
#include "EvsCamera.h"
+#include "ConfigManager.h"
#include "EvsEnumerator.h"
#include <ui/GraphicBufferAllocator.h>
#include <ui/GraphicBufferMapper.h>
#include <utils/SystemClock.h>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace evs {
-namespace V1_1 {
-namespace implementation {
-
-
-// Special camera names for which we'll initialize alternate test data
-const char EvsCamera::kCameraName_Backup[] = "backup";
-
+namespace {
// Arbitrary limit on number of graphics buffers allowed to be allocated
// Safeguards against unreasonable resource consumption and provides a testable limit
-const unsigned MAX_BUFFERS_IN_FLIGHT = 100;
+constexpr unsigned kMaxBuffersInFlight = 100;
+// Minimum number of buffers to run a video stream
+constexpr int kMinimumBuffersInFlight = 1;
-EvsCamera::EvsCamera(const char *id,
- unique_ptr<ConfigManager::CameraInfo> &camInfo) :
- mFramesAllowed(0),
- mFramesInUse(0),
- mStreamState(STOPPED),
- mCameraInfo(camInfo) {
+// Colors for the colorbar test pattern in ABGR format
+constexpr uint32_t kColors[] = {
+ 0xFFFFFFFF, // white
+ 0xFF00FFFF, // yellow
+ 0xFFFFFF00, // cyan
+ 0xFF00FF00, // green
+ 0xFFFF00FF, // fuchsia
+ 0xFF0000FF, // red
+ 0xFFFF0000, // blue
+ 0xFF000000, // black
+};
+constexpr uint32_t kNumColors = sizeof(kColors) / sizeof(kColors[0]);
- ALOGD("EvsCamera instantiated");
+} // namespace
+
+namespace android::hardware::automotive::evs::V1_1::implementation {
+
+using V1_0::EvsResult;
+
+EvsCamera::EvsCamera(const char* id, std::unique_ptr<ConfigManager::CameraInfo>& camInfo)
+ : mFramesAllowed(0), mFramesInUse(0), mStreamState(STOPPED), mCameraInfo(camInfo) {
+ ALOGD("%s", __FUNCTION__);
/* set a camera id */
mDescription.v1.cameraId = id;
/* set camera metadata */
- mDescription.metadata.setToExternal((uint8_t *)camInfo->characteristics,
+ mDescription.metadata.setToExternal((uint8_t*)camInfo->characteristics,
get_camera_metadata_size(camInfo->characteristics));
}
-
EvsCamera::~EvsCamera() {
- ALOGD("EvsCamera being destroyed");
+ ALOGD("%s", __FUNCTION__);
forceShutdown();
}
-
-//
// This gets called if another caller "steals" ownership of the camera
-//
-void EvsCamera::forceShutdown()
-{
- ALOGD("EvsCamera forceShutdown");
+void EvsCamera::forceShutdown() {
+ ALOGD("%s", __FUNCTION__);
// Make sure our output stream is cleaned up
// (It really should be already)
stopVideoStream();
// Claim the lock while we work on internal state
- std::lock_guard <std::mutex> lock(mAccessLock);
+ std::lock_guard<std::mutex> lock(mAccessLock);
// Drop all the graphics buffers we've been using
if (mBuffers.size() > 0) {
@@ -96,19 +96,18 @@
mStreamState = DEAD;
}
-
// Methods from ::android::hardware::automotive::evs::V1_0::IEvsCamera follow.
Return<void> EvsCamera::getCameraInfo(getCameraInfo_cb _hidl_cb) {
- ALOGD("getCameraInfo");
+ ALOGD("%s", __FUNCTION__);
// Send back our self description
_hidl_cb(mDescription.v1);
- return Void();
+ return {};
}
-
Return<EvsResult> EvsCamera::setMaxFramesInFlight(uint32_t bufferCount) {
- ALOGD("setMaxFramesInFlight");
+ ALOGD("%s, bufferCount = %u", __FUNCTION__, bufferCount);
+
std::lock_guard<std::mutex> lock(mAccessLock);
// If we've been displaced by another owner of the camera, then we can't do anything else
@@ -131,9 +130,9 @@
}
}
+Return<EvsResult> EvsCamera::startVideoStream(const ::android::sp<V1_0::IEvsCameraStream>& stream) {
+ ALOGD("%s", __FUNCTION__);
-Return<EvsResult> EvsCamera::startVideoStream(const ::android::sp<IEvsCameraStream_1_0>& stream) {
- ALOGD("startVideoStream");
std::lock_guard<std::mutex> lock(mAccessLock);
// If we've been displaced by another owner of the camera, then we can't do anything else
@@ -141,82 +140,86 @@
ALOGE("ignoring startVideoStream call when camera has been lost.");
return EvsResult::OWNERSHIP_LOST;
}
+
if (mStreamState != STOPPED) {
ALOGE("ignoring startVideoStream call when a stream is already running.");
return EvsResult::STREAM_ALREADY_RUNNING;
}
// If the client never indicated otherwise, configure ourselves for a single streaming buffer
- if (mFramesAllowed < 1) {
- if (!setAvailableFrames_Locked(1)) {
+ if (mFramesAllowed < kMinimumBuffersInFlight) {
+ if (!setAvailableFrames_Locked(kMinimumBuffersInFlight)) {
ALOGE("Failed to start stream because we couldn't get a graphics buffer");
return EvsResult::BUFFER_NOT_AVAILABLE;
}
}
// Record the user's callback for use when we have a frame ready
- mStream = IEvsCameraStream_1_1::castFrom(stream).withDefault(nullptr);
- if (mStream == nullptr) {
+ mStream = IEvsCameraStream::castFrom(stream).withDefault(nullptr);
+ if (!mStream) {
ALOGE("Default implementation does not support v1.0 IEvsCameraStream");
return EvsResult::INVALID_ARG;
}
// Start the frame generation thread
mStreamState = RUNNING;
- mCaptureThread = std::thread([this](){ generateFrames(); });
+ mCaptureThread = std::thread([this]() { generateFrames(); });
return EvsResult::OK;
}
-
-Return<void> EvsCamera::doneWithFrame(const BufferDesc_1_0& buffer) {
- std::lock_guard <std::mutex> lock(mAccessLock);
- returnBuffer(buffer.bufferId, buffer.memHandle);
-
- return Void();
-}
-
-
-Return<void> EvsCamera::stopVideoStream() {
- ALOGD("stopVideoStream");
- std::unique_lock <std::mutex> lock(mAccessLock);
-
- if (mStreamState == RUNNING) {
- // Tell the GenerateFrames loop we want it to stop
- mStreamState = STOPPING;
-
- // Block outside the mutex until the "stop" flag has been acknowledged
- // We won't send any more frames, but the client might still get some already in flight
- ALOGD("Waiting for stream thread to end...");
- lock.unlock();
- mCaptureThread.join();
- lock.lock();
-
- mStreamState = STOPPED;
- mStream = nullptr;
- ALOGD("Stream marked STOPPED.");
- }
-
- return Void();
-}
-
-
-Return<int32_t> EvsCamera::getExtendedInfo(uint32_t opaqueIdentifier) {
- ALOGD("getExtendedInfo");
+Return<void> EvsCamera::doneWithFrame(const V1_0::BufferDesc& buffer) {
std::lock_guard<std::mutex> lock(mAccessLock);
+ returnBufferLocked(buffer.bufferId, buffer.memHandle);
- // For any single digit value, return the index itself as a test value
- if (opaqueIdentifier <= 9) {
- return opaqueIdentifier;
- }
-
- // Return zero by default as required by the spec
- return 0;
+ return {};
}
+Return<void> EvsCamera::stopVideoStream() {
+ ALOGD("%s", __FUNCTION__);
-Return<EvsResult> EvsCamera::setExtendedInfo(uint32_t /*opaqueIdentifier*/, int32_t /*opaqueValue*/) {
- ALOGD("setExtendedInfo");
+ std::unique_lock<std::mutex> lock(mAccessLock);
+
+ if (mStreamState != RUNNING) {
+ return {};
+ }
+
+ // Tell the GenerateFrames loop we want it to stop
+ mStreamState = STOPPING;
+
+ // Block outside the mutex until the "stop" flag has been acknowledged
+ // We won't send any more frames, but the client might still get some already in flight
+ ALOGD("Waiting for stream thread to end...");
+ lock.unlock();
+ if (mCaptureThread.joinable()) {
+ mCaptureThread.join();
+ }
+ lock.lock();
+
+ mStreamState = STOPPED;
+ mStream = nullptr;
+ ALOGD("Stream marked STOPPED.");
+
+ return {};
+}
+
+Return<int32_t> EvsCamera::getExtendedInfo(uint32_t opaqueIdentifier) {
+ ALOGD("%s", __FUNCTION__);
+
+ std::lock_guard<std::mutex> lock(mAccessLock);
+ const auto it = mExtInfo.find(opaqueIdentifier);
+ if (it == mExtInfo.end()) {
+ // Return zero by default as required by the spec
+ return 0;
+ } else {
+ return it->second[0];
+ }
+}
+
+Return<EvsResult> EvsCamera::setExtendedInfo([[maybe_unused]] uint32_t opaqueIdentifier,
+ [[maybe_unused]] int32_t opaqueValue) {
+ ALOGD("%s", __FUNCTION__);
+
std::lock_guard<std::mutex> lock(mAccessLock);
// If we've been displaced by another owner of the camera, then we can't do anything else
@@ -225,76 +228,73 @@
return EvsResult::OWNERSHIP_LOST;
}
- // We don't store any device specific information in this implementation
- return EvsResult::INVALID_ARG;
+ mExtInfo.insert_or_assign(opaqueIdentifier, opaqueValue);
+ return EvsResult::OK;
}
-
// Methods from ::android::hardware::automotive::evs::V1_1::IEvsCamera follow.
Return<void> EvsCamera::getCameraInfo_1_1(getCameraInfo_1_1_cb _hidl_cb) {
- ALOGD("getCameraInfo_1_1");
+ ALOGD("%s", __FUNCTION__);
// Send back our self description
_hidl_cb(mDescription);
- return Void();
+ return {};
}
-
-Return<void> EvsCamera::getPhysicalCameraInfo(const hidl_string& id,
+Return<void> EvsCamera::getPhysicalCameraInfo([[maybe_unused]] const hidl_string& id,
getCameraInfo_1_1_cb _hidl_cb) {
ALOGD("%s", __FUNCTION__);
// This works exactly same as getCameraInfo_1_1() in default implementation.
- (void)id;
_hidl_cb(mDescription);
- return Void();
+ return {};
}
+Return<EvsResult> EvsCamera::doneWithFrame_1_1(const hidl_vec<BufferDesc>& buffers) {
+ ALOGD("%s", __FUNCTION__);
-Return<EvsResult> EvsCamera::doneWithFrame_1_1(const hidl_vec<BufferDesc_1_1>& buffers) {
- std::lock_guard <std::mutex> lock(mAccessLock);
-
+ std::lock_guard<std::mutex> lock(mAccessLock);
for (auto&& buffer : buffers) {
- returnBuffer(buffer.bufferId, buffer.buffer.nativeHandle);
+ returnBufferLocked(buffer.bufferId, buffer.buffer.nativeHandle);
}
-
return EvsResult::OK;
}
-
Return<EvsResult> EvsCamera::pauseVideoStream() {
+ ALOGD("%s", __FUNCTION__);
// Default implementation does not support this.
return EvsResult::UNDERLYING_SERVICE_ERROR;
}
-
Return<EvsResult> EvsCamera::resumeVideoStream() {
+ ALOGD("%s", __FUNCTION__);
// Default implementation does not support this.
return EvsResult::UNDERLYING_SERVICE_ERROR;
}
-
Return<EvsResult> EvsCamera::setMaster() {
+ ALOGD("%s", __FUNCTION__);
// Default implementation does not expect multiple subscribers and therefore
// return a success code always.
return EvsResult::OK;
}
-Return<EvsResult> EvsCamera::forceMaster(const sp<IEvsDisplay_1_0>& ) {
+Return<EvsResult> EvsCamera::forceMaster(const sp<V1_0::IEvsDisplay>&) {
+ ALOGD("%s", __FUNCTION__);
// Default implementation does not expect multiple subscribers and therefore
// return a success code always.
return EvsResult::OK;
}
-
Return<EvsResult> EvsCamera::unsetMaster() {
+ ALOGD("%s", __FUNCTION__);
// Default implementation does not expect multiple subscribers and therefore
// return a success code always.
return EvsResult::OK;
}
-
Return<void> EvsCamera::getParameterList(getParameterList_cb _hidl_cb) {
+ ALOGD("%s", __FUNCTION__);
hidl_vec<CameraParam> hidlCtrls;
hidlCtrls.resize(mCameraInfo->controls.size());
unsigned idx = 0;
@@ -303,72 +303,132 @@
}
_hidl_cb(hidlCtrls);
- return Void();
-}
-
-
-Return<void> EvsCamera::getIntParameterRange(CameraParam id,
- getIntParameterRange_cb _hidl_cb) {
- auto range = mCameraInfo->controls[id];
- _hidl_cb(get<0>(range), get<1>(range), get<2>(range));
- return Void();
-}
-
-
-Return<void> EvsCamera::setIntParameter(CameraParam id, int32_t value,
- setIntParameter_cb _hidl_cb) {
- // Default implementation does not support this.
- (void)id;
- (void)value;
- _hidl_cb(EvsResult::INVALID_ARG, 0);
- return Void();
-}
-
-
-Return<void> EvsCamera::getIntParameter(CameraParam id,
- getIntParameter_cb _hidl_cb) {
- // Default implementation does not support this.
- (void)id;
- _hidl_cb(EvsResult::INVALID_ARG, 0);
- return Void();
-}
-
-
-Return<EvsResult> EvsCamera::setExtendedInfo_1_1(uint32_t opaqueIdentifier,
- const hidl_vec<uint8_t>& opaqueValue) {
- // Default implementation does not use an extended info.
- (void)opaqueIdentifier;
- (void)opaqueValue;
- return EvsResult::INVALID_ARG;
-}
-
-
-Return<void> EvsCamera::getExtendedInfo_1_1(uint32_t opaqueIdentifier,
- getExtendedInfo_1_1_cb _hidl_cb) {
- // Default implementation does not use an extended info.
- (void)opaqueIdentifier;
-
- hidl_vec<uint8_t> value;
- _hidl_cb(EvsResult::INVALID_ARG, value);
- return Void();
-}
-
-
-Return<void>
-EvsCamera::importExternalBuffers(const hidl_vec<BufferDesc_1_1>& /* buffers */,
- importExternalBuffers_cb _hidl_cb) {
- ALOGW("%s is not implemented yet.", __FUNCTION__);
- _hidl_cb(EvsResult::UNDERLYING_SERVICE_ERROR, 0);
return {};
}
+Return<void> EvsCamera::getIntParameterRange(CameraParam id, getIntParameterRange_cb _hidl_cb) {
+ ALOGD("%s", __FUNCTION__);
+ auto it = mCameraInfo->controls.find(id);
+ if (it == mCameraInfo->controls.end()) {
+ _hidl_cb(0, 0, 0);
+ } else {
+ _hidl_cb(std::get<0>(it->second), std::get<1>(it->second), std::get<2>(it->second));
+ }
+ return {};
+}
+
+Return<void> EvsCamera::setIntParameter(CameraParam id, int32_t value,
+ setIntParameter_cb _hidl_cb) {
+ ALOGD("%s", __FUNCTION__);
+ mParams.insert_or_assign(id, value);
+ _hidl_cb(EvsResult::OK, {value});
+ return {};
+}
+
+Return<void> EvsCamera::getIntParameter([[maybe_unused]] CameraParam id,
+ getIntParameter_cb _hidl_cb) {
+ ALOGD("%s", __FUNCTION__);
+ auto it = mParams.find(id);
+ std::vector<int32_t> values;
+ if (it == mParams.end()) {
+ _hidl_cb(EvsResult::INVALID_ARG, values);
+ } else {
+ values.push_back(it->second);
+ _hidl_cb(EvsResult::OK, values);
+ }
+ return {};
+}
+
+Return<EvsResult> EvsCamera::setExtendedInfo_1_1(uint32_t opaqueIdentifier,
+ const hidl_vec<uint8_t>& opaqueValue) {
+ ALOGD("%s", __FUNCTION__);
+ mExtInfo.insert_or_assign(opaqueIdentifier, opaqueValue);
+ return EvsResult::OK;
+}
+
+Return<void> EvsCamera::getExtendedInfo_1_1(uint32_t opaqueIdentifier,
+ getExtendedInfo_1_1_cb _hidl_cb) {
+ ALOGD("%s", __FUNCTION__);
+ auto status = EvsResult::OK;
+ hidl_vec<uint8_t> value;
+ const auto it = mExtInfo.find(opaqueIdentifier);
+ if (it == mExtInfo.end()) {
+ status = EvsResult::INVALID_ARG;
+ } else {
+ value = it->second;
+ }
+ _hidl_cb(status, value);
+ return {};
+}
+
+Return<void> EvsCamera::importExternalBuffers([[maybe_unused]] const hidl_vec<BufferDesc>& buffers,
+ importExternalBuffers_cb _hidl_cb) {
+ auto numBuffersToAdd = buffers.size();
+ if (numBuffersToAdd < 1) {
+ ALOGD("No buffers to add");
+ _hidl_cb(EvsResult::OK, mFramesAllowed);
+ return {};
+ }
+
+ {
+ std::scoped_lock<std::mutex> lock(mAccessLock);
+
+ if (numBuffersToAdd > (kMaxBuffersInFlight - mFramesAllowed)) {
+ numBuffersToAdd -= (kMaxBuffersInFlight - mFramesAllowed);
+ ALOGW("Exceed the limit on number of buffers. %" PRIu64 " buffers will be added only.",
+ static_cast<uint64_t>(numBuffersToAdd));
+ }
+
+ GraphicBufferMapper& mapper = GraphicBufferMapper::get();
+ const auto before = mFramesAllowed;
+ for (auto i = 0; i < numBuffersToAdd; ++i) {
+ // TODO: reject if external buffer is configured differently.
+ auto& b = buffers[i];
+ const AHardwareBuffer_Desc* pDesc =
+ reinterpret_cast<const AHardwareBuffer_Desc*>(&b.buffer.description);
+
+ // Import a buffer to add
+ buffer_handle_t memHandle = nullptr;
+ status_t result =
+ mapper.importBuffer(b.buffer.nativeHandle, pDesc->width, pDesc->height, 1,
+ pDesc->format, pDesc->usage, pDesc->stride, &memHandle);
+ if (result != android::NO_ERROR || !memHandle) {
+ ALOGW("Failed to import a buffer %d", b.bufferId);
+ continue;
+ }
+
+ auto stored = false;
+ for (auto&& rec : mBuffers) {
+ if (rec.handle == nullptr) {
+ // Use this existing entry
+ rec.handle = memHandle;
+ rec.inUse = false;
+
+ stored = true;
+ break;
+ }
+ }
+
+ if (!stored) {
+ // Add a BufferRecord wrapping this handle to our set of available buffers
+ mBuffers.emplace_back(memHandle);
+ }
+
+ ++mFramesAllowed;
+ }
+
+ _hidl_cb(EvsResult::OK, mFramesAllowed - before);
+ return {};
+ }
+}
bool EvsCamera::setAvailableFrames_Locked(unsigned bufferCount) {
- if (bufferCount < 1) {
- ALOGE("Ignoring request to set buffer count to zero");
+ if (bufferCount < kMinimumBuffersInFlight) {
+ ALOGE("Ignoring request to set buffer count below the minimum number of buffers to run a "
+ "video stream");
return false;
}
- if (bufferCount > MAX_BUFFERS_IN_FLIGHT) {
+ if (bufferCount > kMaxBuffersInFlight) {
ALOGE("Rejecting buffer request in excess of internal limit");
return false;
}
@@ -403,17 +463,16 @@
return true;
}
-
unsigned EvsCamera::increaseAvailableFrames_Locked(unsigned numToAdd) {
// Acquire the graphics buffer allocator
- GraphicBufferAllocator &alloc(GraphicBufferAllocator::get());
+ GraphicBufferAllocator& alloc(GraphicBufferAllocator::get());
unsigned added = 0;
while (added < numToAdd) {
buffer_handle_t memHandle = nullptr;
- status_t result = alloc.allocate(mWidth, mHeight, mFormat, 1, mUsage,
- &memHandle, &mStride, 0, "EvsCamera");
+ status_t result = alloc.allocate(mWidth, mHeight, mFormat, 1, mUsage, &memHandle, &mStride,
+ 0, "EvsCamera");
if (result != NO_ERROR) {
ALOGE("Error %d allocating %d x %d graphics buffer", result, mWidth, mHeight);
break;
@@ -436,7 +495,7 @@
}
if (!stored) {
// Add a BufferRecord wrapping this handle to our set of available buffers
- mBuffers.emplace_back(memHandle);
+ mBuffers.push_back(std::move(BufferRecord(memHandle)));
}
mFramesAllowed++;
@@ -446,10 +505,9 @@
return added;
}
-
unsigned EvsCamera::decreaseAvailableFrames_Locked(unsigned numToRemove) {
// Acquire the graphics buffer allocator
- GraphicBufferAllocator &alloc(GraphicBufferAllocator::get());
+ GraphicBufferAllocator& alloc(GraphicBufferAllocator::get());
unsigned removed = 0;
@@ -472,14 +530,12 @@
return removed;
}
-
// This is the asynchronous frame generation thread that runs in parallel with the
// main serving thread. There is one for each active camera instance.
void EvsCamera::generateFrames() {
ALOGD("Frame generation loop started");
unsigned idx;
-
while (true) {
bool timeForFrame = false;
nsecs_t startTime = systemTime(SYSTEM_TIME_MONOTONIC);
@@ -521,9 +577,9 @@
if (timeForFrame) {
// Assemble the buffer description we'll transmit below
- BufferDesc_1_1 newBuffer = {};
+ BufferDesc newBuffer = {};
AHardwareBuffer_Desc* pDesc =
- reinterpret_cast<AHardwareBuffer_Desc *>(&newBuffer.buffer.description);
+ reinterpret_cast<AHardwareBuffer_Desc*>(&newBuffer.buffer.description);
pDesc->width = mWidth;
pDesc->height = mHeight;
pDesc->layers = 1;
@@ -534,19 +590,16 @@
newBuffer.pixelSize = sizeof(uint32_t);
newBuffer.bufferId = idx;
newBuffer.deviceId = mDescription.v1.cameraId;
- newBuffer.timestamp = elapsedRealtimeNano();
+ newBuffer.timestamp = elapsedRealtimeNano() * 1e+3; // timestamps is in microseconds
// Write test data into the image buffer
fillTestFrame(newBuffer);
// Issue the (asynchronous) callback to the client -- can't be holding the lock
- hidl_vec<BufferDesc_1_1> frames;
- frames.resize(1);
- frames[0] = newBuffer;
- auto result = mStream->deliverFrame_1_1(frames);
+ auto result = mStream->deliverFrame_1_1({newBuffer});
if (result.isOk()) {
- ALOGD("Delivered %p as id %d",
- newBuffer.buffer.nativeHandle.getNativeHandle(), newBuffer.bufferId);
+ ALOGD("Delivered %p as id %d", newBuffer.buffer.nativeHandle.getNativeHandle(),
+ newBuffer.bufferId);
} else {
// This can happen if the client dies and is likely unrecoverable.
// To avoid consuming resources generating failing calls, we stop sending
@@ -563,63 +616,50 @@
}
}
- // We arbitrarily choose to generate frames at 12 fps to ensure we pass the 10fps test requirement
- static const int kTargetFrameRate = 12;
- static const nsecs_t kTargetFrameTimeUs = 1000*1000 / kTargetFrameRate;
+ // We arbitrarily choose to generate frames at 15 fps to ensure we pass the 10fps test
+ // requirement
+ static const int kTargetFrameRate = 15;
+ static const nsecs_t kTargetFrameIntervalUs = 1000 * 1000 / kTargetFrameRate;
const nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
- const nsecs_t workTimeUs = (now - startTime) / 1000;
- const nsecs_t sleepDurationUs = kTargetFrameTimeUs - workTimeUs;
+ const nsecs_t elapsedTimeUs = (now - startTime) / 1000;
+ const nsecs_t sleepDurationUs = kTargetFrameIntervalUs - elapsedTimeUs;
if (sleepDurationUs > 0) {
usleep(sleepDurationUs);
}
}
// If we've been asked to stop, send an event to signal the actual end of stream
- EvsEventDesc event;
- event.aType = EvsEventType::STREAM_STOPPED;
- auto result = mStream->notify(event);
- if (!result.isOk()) {
+ EvsEventDesc event = {
+ .aType = EvsEventType::STREAM_STOPPED,
+ };
+ if (!mStream->notify(event).isOk()) {
ALOGE("Error delivering end of stream marker");
}
return;
}
-
-void EvsCamera::fillTestFrame(const BufferDesc_1_1& buff) {
+void EvsCamera::fillTestFrame(const BufferDesc& buff) {
// Lock our output buffer for writing
- uint32_t *pixels = nullptr;
+ uint32_t* pixels = nullptr;
const AHardwareBuffer_Desc* pDesc =
- reinterpret_cast<const AHardwareBuffer_Desc *>(&buff.buffer.description);
- GraphicBufferMapper &mapper = GraphicBufferMapper::get();
+ reinterpret_cast<const AHardwareBuffer_Desc*>(&buff.buffer.description);
+ GraphicBufferMapper& mapper = GraphicBufferMapper::get();
mapper.lock(buff.buffer.nativeHandle,
GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_NEVER,
- android::Rect(pDesc->width, pDesc->height),
- (void **) &pixels);
+ android::Rect(pDesc->width, pDesc->height), (void**)&pixels);
// If we failed to lock the pixel buffer, we're about to crash, but log it first
if (!pixels) {
ALOGE("Camera failed to gain access to image buffer for writing");
+ return;
}
- // Fill in the test pixels
+ // Fill in the test pixels; the colorbar in ABGR format
for (unsigned row = 0; row < pDesc->height; row++) {
for (unsigned col = 0; col < pDesc->width; col++) {
- // Index into the row to check the pixel at this column.
- // We expect 0xFF in the LSB channel, a vertical gradient in the
- // second channel, a horitzontal gradient in the third channel, and
- // 0xFF in the MSB.
- // The exception is the very first 32 bits which is used for the
- // time varying frame signature to avoid getting fooled by a static image.
- uint32_t expectedPixel = 0xFF0000FF | // MSB and LSB
- ((row & 0xFF) << 8) | // vertical gradient
- ((col & 0xFF) << 16); // horizontal gradient
- if ((row | col) == 0) {
- static uint32_t sFrameTicker = 0;
- expectedPixel = (sFrameTicker) & 0xFF;
- sFrameTicker++;
- }
- pixels[col] = expectedPixel;
+ const uint32_t index = col * kNumColors / pDesc->width;
+ pixels[col] = kColors[index];
}
// Point to the next row
// NOTE: stride retrieved from gralloc is in units of pixels
@@ -630,39 +670,35 @@
mapper.unlock(buff.buffer.nativeHandle);
}
-
-void EvsCamera::fillTestFrame(const BufferDesc_1_0& buff) {
- BufferDesc_1_1 newBufDesc = {};
- AHardwareBuffer_Desc desc = {
- buff.width, // width
- buff.height, // height
- 1, // layers, always 1 for EVS
- buff.format, // One of AHardwareBuffer_Format
- buff.usage, // Combination of AHardwareBuffer_UsageFlags
- buff.stride, // Row stride in pixels
- 0, // Reserved
- 0 // Reserved
+void EvsCamera::fillTestFrame(const V1_0::BufferDesc& buff) {
+ BufferDesc newBuffer = {
+ .buffer.nativeHandle = buff.memHandle,
+ .pixelSize = buff.pixelSize,
+ .bufferId = buff.bufferId,
};
- memcpy(&desc, &newBufDesc.buffer.description, sizeof(desc));
- newBufDesc.buffer.nativeHandle = buff.memHandle;
- newBufDesc.pixelSize = buff.pixelSize;
- newBufDesc.bufferId = buff.bufferId;
-
- return fillTestFrame(newBufDesc);
+ AHardwareBuffer_Desc* pDesc =
+ reinterpret_cast<AHardwareBuffer_Desc*>(&newBuffer.buffer.description);
+ *pDesc = {
+ buff.width, // width
+ buff.height, // height
+ 1, // layers, always 1 for EVS
+ buff.format, // One of AHardwareBuffer_Format
+ buff.usage, // Combination of AHardwareBuffer_UsageFlags
+ buff.stride, // Row stride in pixels
+ 0, // Reserved
+ 0 // Reserved
+ };
+ return fillTestFrame(newBuffer);
}
-
-void EvsCamera::returnBuffer(const uint32_t bufferId, const buffer_handle_t memHandle) {
- std::lock_guard <std::mutex> lock(mAccessLock);
-
+void EvsCamera::returnBufferLocked(const uint32_t bufferId, const buffer_handle_t memHandle) {
if (memHandle == nullptr) {
ALOGE("ignoring doneWithFrame called with null handle");
} else if (bufferId >= mBuffers.size()) {
- ALOGE("ignoring doneWithFrame called with invalid bufferId %d (max is %zu)",
- bufferId, mBuffers.size()-1);
+ ALOGE("ignoring doneWithFrame called with invalid bufferId %d (max is %zu)", bufferId,
+ mBuffers.size() - 1);
} else if (!mBuffers[bufferId].inUse) {
- ALOGE("ignoring doneWithFrame called on frame %d which is already free",
- bufferId);
+ ALOGE("ignoring doneWithFrame called on frame %d which is already free", bufferId);
} else {
// Mark the frame as available
mBuffers[bufferId].inUse = false;
@@ -683,42 +719,33 @@
}
}
-
-sp<EvsCamera> EvsCamera::Create(const char *deviceName) {
- unique_ptr<ConfigManager::CameraInfo> nullCamInfo = nullptr;
+sp<EvsCamera> EvsCamera::Create(const char* deviceName) {
+ std::unique_ptr<ConfigManager::CameraInfo> nullCamInfo = nullptr;
return Create(deviceName, nullCamInfo);
}
-
-sp<EvsCamera> EvsCamera::Create(const char *deviceName,
- unique_ptr<ConfigManager::CameraInfo> &camInfo,
- const Stream *streamCfg) {
+sp<EvsCamera> EvsCamera::Create(const char* deviceName,
+ std::unique_ptr<ConfigManager::CameraInfo>& camInfo,
+ [[maybe_unused]] const Stream* streamCfg) {
sp<EvsCamera> evsCamera = new EvsCamera(deviceName, camInfo);
if (evsCamera == nullptr) {
return nullptr;
}
- /* default implementation does not use a given configuration */
- (void)streamCfg;
-
- /* Use the first resolution from the list for the testing */
+ // Use the first resolution from the list for the testing
+ // TODO(b/214835237): Uses a given Stream configuration to choose the best
+ // stream configuration.
auto it = camInfo->streamConfigurations.begin();
evsCamera->mWidth = it->second[1];
evsCamera->mHeight = it->second[2];
- evsCamera->mDescription.v1.vendorFlags = 0xFFFFFFFF; // Arbitrary test value
+ evsCamera->mDescription.v1.vendorFlags = 0xFFFFFFFF; // Arbitrary test value
evsCamera->mFormat = HAL_PIXEL_FORMAT_RGBA_8888;
- evsCamera->mUsage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE |
- GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY;
+ evsCamera->mUsage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE |
+ GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY;
return evsCamera;
}
-
-} // namespace implementation
-} // namespace V1_0
-} // namespace evs
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::evs::V1_1::implementation
diff --git a/automotive/evs/1.1/default/EvsCamera.h b/automotive/evs/1.1/default/EvsCamera.h
index 6163a34..1ea1186 100644
--- a/automotive/evs/1.1/default/EvsCamera.h
+++ b/automotive/evs/1.1/default/EvsCamera.h
@@ -17,91 +17,70 @@
#ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSCAMERA_H
#define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSCAMERA_H
-#include <android/hardware/automotive/evs/1.1/types.h>
+#include "ConfigManager.h"
+
#include <android/hardware/automotive/evs/1.1/IEvsCamera.h>
#include <android/hardware/automotive/evs/1.1/IEvsCameraStream.h>
#include <android/hardware/automotive/evs/1.1/IEvsDisplay.h>
+#include <android/hardware/automotive/evs/1.1/types.h>
#include <ui/GraphicBuffer.h>
#include <thread>
-#include "ConfigManager.h"
-
-using BufferDesc_1_0 = ::android::hardware::automotive::evs::V1_0::BufferDesc;
-using BufferDesc_1_1 = ::android::hardware::automotive::evs::V1_1::BufferDesc;
-using IEvsCameraStream_1_0 = ::android::hardware::automotive::evs::V1_0::IEvsCameraStream;
-using IEvsCameraStream_1_1 = ::android::hardware::automotive::evs::V1_1::IEvsCameraStream;
-using ::android::hardware::automotive::evs::V1_0::EvsResult;
-using ::android::hardware::automotive::evs::V1_0::CameraDesc;
-using IEvsDisplay_1_0 = ::android::hardware::automotive::evs::V1_0::IEvsDisplay;
-using IEvsDisplay_1_1 = ::android::hardware::automotive::evs::V1_1::IEvsDisplay;
-
-
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace evs {
-namespace V1_1 {
-namespace implementation {
-
+namespace android::hardware::automotive::evs::V1_1::implementation {
// From EvsEnumerator.h
class EvsEnumerator;
-
class EvsCamera : public IEvsCamera {
-public:
+ public:
// Methods from ::android::hardware::automotive::evs::V1_0::IEvsCamera follow.
- Return<void> getCameraInfo(getCameraInfo_cb _hidl_cb) override;
- Return<EvsResult> setMaxFramesInFlight(uint32_t bufferCount) override;
- Return<EvsResult> startVideoStream(const ::android::sp<IEvsCameraStream_1_0>& stream) override;
- Return<void> stopVideoStream() override;
- Return<void> doneWithFrame(const BufferDesc_1_0& buffer) override;
+ Return<void> getCameraInfo(getCameraInfo_cb _hidl_cb) override;
+ Return<V1_0::EvsResult> setMaxFramesInFlight(uint32_t bufferCount) override;
+ Return<V1_0::EvsResult> startVideoStream(const sp<V1_0::IEvsCameraStream>& stream) override;
+ Return<void> stopVideoStream() override;
+ Return<void> doneWithFrame(const V1_0::BufferDesc& buffer) override;
- Return<int32_t> getExtendedInfo(uint32_t opaqueIdentifier) override;
- Return<EvsResult> setExtendedInfo(uint32_t opaqueIdentifier, int32_t opaqueValue) override;
+ Return<int32_t> getExtendedInfo(uint32_t opaqueIdentifier) override;
+ Return<V1_0::EvsResult> setExtendedInfo(uint32_t opaqueIdentifier,
+ int32_t opaqueValue) override;
// Methods from ::android::hardware::automotive::evs::V1_1::IEvsCamera follow.
- Return<void> getCameraInfo_1_1(getCameraInfo_1_1_cb _hidl_cb) override;
- Return<void> getPhysicalCameraInfo(const hidl_string& id,
- getPhysicalCameraInfo_cb _hidl_cb) override;
- Return<EvsResult> pauseVideoStream() override;
- Return<EvsResult> resumeVideoStream() override;
- Return<EvsResult> doneWithFrame_1_1(const hidl_vec<BufferDesc_1_1>& buffer) override;
- Return<EvsResult> setMaster() override;
- Return<EvsResult> forceMaster(const sp<IEvsDisplay_1_0>& display) override;
- Return<EvsResult> unsetMaster() override;
- Return<void> getParameterList(getParameterList_cb _hidl_cb) override;
- Return<void> getIntParameterRange(CameraParam id,
- getIntParameterRange_cb _hidl_cb) override;
- Return<void> setIntParameter(CameraParam id, int32_t value,
- setIntParameter_cb _hidl_cb) override;
- Return<void> getIntParameter(CameraParam id,
- getIntParameter_cb _hidl_cb) override;
- Return<EvsResult> setExtendedInfo_1_1(uint32_t opaqueIdentifier,
- const hidl_vec<uint8_t>& opaqueValue) override;
- Return<void> getExtendedInfo_1_1(uint32_t opaqueIdentifier,
- getExtendedInfo_1_1_cb _hidl_cb) override;
- Return<void> importExternalBuffers(const hidl_vec<BufferDesc_1_1>& buffers,
- importExternalBuffers_cb _hidl_cb) override;
+ Return<void> getCameraInfo_1_1(getCameraInfo_1_1_cb _hidl_cb) override;
+ Return<void> getPhysicalCameraInfo(const hidl_string& id,
+ getPhysicalCameraInfo_cb _hidl_cb) override;
+ Return<V1_0::EvsResult> pauseVideoStream() override;
+ Return<V1_0::EvsResult> resumeVideoStream() override;
+ Return<V1_0::EvsResult> doneWithFrame_1_1(const hidl_vec<BufferDesc>& buffer) override;
+ Return<V1_0::EvsResult> setMaster() override;
+ Return<V1_0::EvsResult> forceMaster(const sp<V1_0::IEvsDisplay>& display) override;
+ Return<V1_0::EvsResult> unsetMaster() override;
+ Return<void> getParameterList(getParameterList_cb _hidl_cb) override;
+ Return<void> getIntParameterRange(CameraParam id, getIntParameterRange_cb _hidl_cb) override;
+ Return<void> setIntParameter(CameraParam id, int32_t value,
+ setIntParameter_cb _hidl_cb) override;
+ Return<void> getIntParameter(CameraParam id, getIntParameter_cb _hidl_cb) override;
+ Return<V1_0::EvsResult> setExtendedInfo_1_1(uint32_t opaqueIdentifier,
+ const hidl_vec<uint8_t>& opaqueValue) override;
+ Return<void> getExtendedInfo_1_1(uint32_t opaqueIdentifier,
+ getExtendedInfo_1_1_cb _hidl_cb) override;
+ Return<void> importExternalBuffers(const hidl_vec<BufferDesc>& buffers,
+ importExternalBuffers_cb _hidl_cb) override;
- static sp<EvsCamera> Create(const char *deviceName);
- static sp<EvsCamera> Create(const char *deviceName,
- unique_ptr<ConfigManager::CameraInfo> &camInfo,
- const Stream *streamCfg = nullptr);
+ static sp<EvsCamera> Create(const char* deviceName);
+ static sp<EvsCamera> Create(const char* deviceName,
+ std::unique_ptr<ConfigManager::CameraInfo>& camInfo,
+ const Stream* streamCfg = nullptr);
EvsCamera(const EvsCamera&) = delete;
EvsCamera& operator=(const EvsCamera&) = delete;
virtual ~EvsCamera() override;
- void forceShutdown(); // This gets called if another caller "steals" ownership of the camera
+ void forceShutdown(); // This gets called if another caller "steals" ownership of the camera
const CameraDesc& getDesc() { return mDescription; };
- static const char kCameraName_Backup[];
-
-private:
- EvsCamera(const char *id,
- unique_ptr<ConfigManager::CameraInfo> &camInfo);
+ private:
+ EvsCamera(const char* id, std::unique_ptr<ConfigManager::CameraInfo>& camInfo);
// These three functions are expected to be called while mAccessLock is held
//
bool setAvailableFrames_Locked(unsigned bufferCount);
@@ -109,34 +88,34 @@
unsigned decreaseAvailableFrames_Locked(unsigned numToRemove);
void generateFrames();
- void fillTestFrame(const BufferDesc_1_0& buff);
- void fillTestFrame(const BufferDesc_1_1& buff);
- void returnBuffer(const uint32_t bufferId, const buffer_handle_t memHandle);
+ void fillTestFrame(const V1_0::BufferDesc& buff);
+ void fillTestFrame(const BufferDesc& buff);
+ void returnBufferLocked(const uint32_t bufferId, const buffer_handle_t memHandle);
sp<EvsEnumerator> mEnumerator; // The enumerator object that created this camera
- CameraDesc mDescription = {}; // The properties of this camera
+ CameraDesc mDescription = {}; // The properties of this camera
- std::thread mCaptureThread; // The thread we'll use to synthesize frames
+ std::thread mCaptureThread; // The thread we'll use to synthesize frames
- uint32_t mWidth = 0; // Horizontal pixel count in the buffers
- uint32_t mHeight = 0; // Vertical pixel count in the buffers
- uint32_t mFormat = 0; // Values from android_pixel_format_t
- uint64_t mUsage = 0; // Values from from Gralloc.h
- uint32_t mStride = 0; // Bytes per line in the buffers
+ uint32_t mWidth = 0; // Horizontal pixel count in the buffers
+ uint32_t mHeight = 0; // Vertical pixel count in the buffers
+ uint32_t mFormat = 0; // Values from android_pixel_format_t
+ uint64_t mUsage = 0; // Values from from Gralloc.h
+ uint32_t mStride = 0; // Bytes per line in the buffers
- sp<IEvsCameraStream_1_1> mStream = nullptr; // The callback used to deliver each frame
+ sp<IEvsCameraStream> mStream = nullptr; // The callback used to deliver each frame
struct BufferRecord {
buffer_handle_t handle;
bool inUse;
- explicit BufferRecord(buffer_handle_t h) : handle(h), inUse(false) {};
+ explicit BufferRecord(buffer_handle_t h) : handle(h), inUse(false){};
};
- std::vector <BufferRecord> mBuffers; // Graphics buffers to transfer images
- unsigned mFramesAllowed; // How many buffers are we currently using
- unsigned mFramesInUse; // How many buffers are currently outstanding
+ std::vector<BufferRecord> mBuffers; // Graphics buffers to transfer images
+ unsigned mFramesAllowed; // How many buffers are we currently using
+ unsigned mFramesInUse; // How many buffers are currently outstanding
enum StreamStateValues {
STOPPED,
@@ -150,14 +129,13 @@
std::mutex mAccessLock;
// Static camera module information
- unique_ptr<ConfigManager::CameraInfo> &mCameraInfo;
+ std::unique_ptr<ConfigManager::CameraInfo>& mCameraInfo;
+
+ // For the extended info
+ std::unordered_map<uint32_t, hidl_vec<uint8_t>> mExtInfo;
+ std::unordered_map<CameraParam, int32_t> mParams;
};
-} // namespace implementation
-} // namespace V1_1
-} // namespace evs
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::evs::V1_1::implementation
#endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSCAMERA_H
diff --git a/automotive/evs/1.1/default/EvsDisplay.cpp b/automotive/evs/1.1/default/EvsDisplay.cpp
index 2b5a4a9..f7169e5 100644
--- a/automotive/evs/1.1/default/EvsDisplay.cpp
+++ b/automotive/evs/1.1/default/EvsDisplay.cpp
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-#define LOG_TAG "android.hardware.automotive.evs@1.1-service"
-
#include "EvsDisplay.h"
#include <ui/GraphicBufferAllocator.h>
@@ -23,51 +21,53 @@
using ::android::frameworks::automotive::display::V1_0::HwDisplayConfig;
using ::android::frameworks::automotive::display::V1_0::HwDisplayState;
+using ::android::frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService;
+using ::android::hardware::automotive::evs::V1_0::DisplayDesc;
+using ::android::hardware::automotive::evs::V1_0::DisplayState;
+using ::android::hardware::automotive::evs::V1_0::EvsResult;
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace evs {
-namespace V1_1 {
-namespace implementation {
+namespace {
+ // Arbitrary magic number for self-recognition
+ constexpr uint32_t kDefaultDisplayBufferId = 0x3870;
+
+} // namespace
+
+namespace android::hardware::automotive::evs::V1_1::implementation {
EvsDisplay::EvsDisplay() {
EvsDisplay(nullptr, 0);
}
-
EvsDisplay::EvsDisplay(sp<IAutomotiveDisplayProxyService> pDisplayProxy, uint64_t displayId)
: mDisplayProxy(pDisplayProxy),
- mDisplayId(displayId) {
+ mDisplayId(displayId),
+ mGlWrapper(std::make_unique<GlWrapper>()) {
ALOGD("EvsDisplay instantiated");
// Set up our self description
// NOTE: These are arbitrary values chosen for testing
- mInfo.displayId = "Mock Display";
- mInfo.vendorFlags = 3870;
+ mInfo.displayId = "Mock Display";
+ mInfo.vendorFlags = 3870;
// Assemble the buffer description we'll use for our render target
- mBuffer.width = 320;
- mBuffer.height = 240;
- mBuffer.format = HAL_PIXEL_FORMAT_RGBA_8888;
- mBuffer.usage = GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER;
- mBuffer.bufferId = 0x3870; // Arbitrary magic number for self recognition
- mBuffer.pixelSize = 4;
+ mBuffer.width = 640;
+ mBuffer.height = 360;
+ mBuffer.format = HAL_PIXEL_FORMAT_RGBA_8888;
+ mBuffer.usage = GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER;
+ mBuffer.bufferId = kDefaultDisplayBufferId;
+ mBuffer.pixelSize = 4;
}
-
EvsDisplay::~EvsDisplay() {
ALOGD("EvsDisplay being destroyed");
forceShutdown();
}
-
/**
* This gets called if another caller "steals" ownership of the display
*/
-void EvsDisplay::forceShutdown()
-{
+void EvsDisplay::forceShutdown() {
ALOGD("EvsDisplay forceShutdown");
std::lock_guard<std::mutex> lock(mAccessLock);
@@ -84,6 +84,11 @@
GraphicBufferAllocator& alloc(GraphicBufferAllocator::get());
alloc.free(mBuffer.memHandle);
mBuffer.memHandle = nullptr;
+
+ if (mGlWrapper) {
+ mGlWrapper->hideWindow(mDisplayProxy, mDisplayId);
+ mGlWrapper->shutdown();
+ }
}
// Put this object into an unrecoverable error state since somebody else
@@ -91,20 +96,18 @@
mRequestedState = DisplayState::DEAD;
}
-
/**
* Returns basic information about the EVS display provided by the system.
* See the description of the DisplayDesc structure for details.
*/
-Return<void> EvsDisplay::getDisplayInfo(getDisplayInfo_cb _hidl_cb) {
+Return<void> EvsDisplay::getDisplayInfo(getDisplayInfo_cb _hidl_cb) {
ALOGD("getDisplayInfo");
// Send back our self description
_hidl_cb(mInfo);
- return Void();
+ return {};
}
-
/**
* Clients may set the display state to express their desired state.
* The HAL implementation must gracefully accept a request for any state
@@ -124,18 +127,28 @@
}
// Ensure we recognize the requested state so we don't go off the rails
- if (state < DisplayState::NUM_STATES) {
- // Record the requested state
- mRequestedState = state;
- return EvsResult::OK;
- }
- else {
- // Turn off the display if asked for an unrecognized state
- mRequestedState = DisplayState::NOT_VISIBLE;
+ if (state >= DisplayState::NUM_STATES) {
return EvsResult::INVALID_ARG;
}
-}
+ if (!mGlWrapper) {
+ switch (state) {
+ case DisplayState::NOT_VISIBLE:
+ mGlWrapper->hideWindow(mDisplayProxy, mDisplayId);
+ break;
+ case DisplayState::VISIBLE:
+ mGlWrapper->showWindow(mDisplayProxy, mDisplayId);
+ break;
+ default:
+ break;
+ }
+ }
+
+ // Record the requested state
+ mRequestedState = state;
+
+ return EvsResult::OK;
+}
/**
* The HAL implementation should report the actual current state, which might
@@ -144,14 +157,13 @@
* the device layer, making it undesirable for the HAL implementation to
* spontaneously change display states.
*/
-Return<DisplayState> EvsDisplay::getDisplayState() {
+Return<DisplayState> EvsDisplay::getDisplayState() {
ALOGD("getDisplayState");
std::lock_guard<std::mutex> lock(mAccessLock);
return mRequestedState;
}
-
/**
* This call returns a handle to a frame buffer associated with the display.
* This buffer may be locked and written to by software and/or GL. This buffer
@@ -159,43 +171,55 @@
* display is no longer visible.
*/
// TODO: We need to know if/when our client dies so we can get the buffer back! (blocked b/31632518)
-Return<void> EvsDisplay::getTargetBuffer(getTargetBuffer_cb _hidl_cb) {
+Return<void> EvsDisplay::getTargetBuffer(getTargetBuffer_cb _hidl_cb) {
ALOGD("getTargetBuffer");
std::lock_guard<std::mutex> lock(mAccessLock);
if (mRequestedState == DisplayState::DEAD) {
ALOGE("Rejecting buffer request from object that lost ownership of the display.");
- BufferDesc_1_0 nullBuff = {};
- _hidl_cb(nullBuff);
- return Void();
+ _hidl_cb({});
+ return {};
}
// If we don't already have a buffer, allocate one now
if (!mBuffer.memHandle) {
+ // Initialize our display window
+ // NOTE: This will cause the display to become "VISIBLE" before a frame is actually
+ // returned, which is contrary to the spec and will likely result in a black frame being
+ // (briefly) shown.
+ if (mGlWrapper->initialize(mDisplayProxy, mDisplayId)) {
+ // Assemble the buffer description we'll use for our render target
+ mBuffer.width = mGlWrapper->getWidth();
+ mBuffer.height = mGlWrapper->getHeight();
+ mBuffer.format = HAL_PIXEL_FORMAT_RGBA_8888;
+ mBuffer.usage = GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER;
+ mBuffer.bufferId = kDefaultDisplayBufferId;
+ mBuffer.pixelSize = 4;
+ } else {
+ // If we failed to initialize a EGL, then we're not going to display
+ // any.
+ mGlWrapper = nullptr;
+ }
+
// Allocate the buffer that will hold our displayable image
buffer_handle_t handle = nullptr;
GraphicBufferAllocator& alloc(GraphicBufferAllocator::get());
- status_t result = alloc.allocate(
- mBuffer.width, mBuffer.height, mBuffer.format, 1, mBuffer.usage,
- &handle, &mBuffer.stride, 0, "EvsDisplay");
- if (result != NO_ERROR) {
- ALOGE("Error %d allocating %d x %d graphics buffer",
- result, mBuffer.width, mBuffer.height);
- BufferDesc_1_0 nullBuff = {};
- _hidl_cb(nullBuff);
- return Void();
- }
- if (!handle) {
- ALOGE("We didn't get a buffer handle back from the allocator");
- BufferDesc_1_0 nullBuff = {};
- _hidl_cb(nullBuff);
- return Void();
+ status_t result = alloc.allocate(mBuffer.width, mBuffer.height, mBuffer.format, 1,
+ mBuffer.usage, &handle, &mBuffer.stride, 0, "EvsDisplay");
+ if (result != NO_ERROR || !handle) {
+ ALOGE("Error %d allocating %d x %d graphics buffer", result, mBuffer.width,
+ mBuffer.height);
+ if (mGlWrapper) {
+ mGlWrapper->shutdown();
+ }
+ _hidl_cb({});
+ return {};
}
mBuffer.memHandle = handle;
mFrameBusy = false;
- ALOGD("Allocated new buffer %p with stride %u",
- mBuffer.memHandle.getNativeHandle(), mBuffer.stride);
+ ALOGD("Allocated new buffer %p with stride %u", mBuffer.memHandle.getNativeHandle(),
+ mBuffer.stride);
}
// Do we have a frame available?
@@ -205,41 +229,40 @@
// a previously issued buffer yet (they're behaving badly).
// NOTE: We have to make the callback even if we have nothing to provide
ALOGE("getTargetBuffer called while no buffers available.");
- BufferDesc_1_0 nullBuff = {};
- _hidl_cb(nullBuff);
- return Void();
+ _hidl_cb({});
+ return {};
} else {
// Mark our buffer as busy
mFrameBusy = true;
// Send the buffer to the client
- ALOGD("Providing display buffer handle %p as id %d",
- mBuffer.memHandle.getNativeHandle(), mBuffer.bufferId);
+ ALOGD("Providing display buffer handle %p as id %d", mBuffer.memHandle.getNativeHandle(),
+ mBuffer.bufferId);
_hidl_cb(mBuffer);
- return Void();
+ return {};
}
}
-
/**
* This call tells the display that the buffer is ready for display.
* The buffer is no longer valid for use by the client after this call.
*/
-Return<EvsResult> EvsDisplay::returnTargetBufferForDisplayImpl(const uint32_t bufferId, const buffer_handle_t memHandle) {
+Return<EvsResult> EvsDisplay::returnTargetBufferForDisplayImpl(const uint32_t bufferId,
+ const buffer_handle_t memHandle) {
ALOGD("returnTargetBufferForDisplay %p", memHandle);
std::lock_guard<std::mutex> lock(mAccessLock);
// Nobody should call us with a null handle
if (!memHandle) {
- ALOGE ("returnTargetBufferForDisplay called without a valid buffer handle.\n");
+ ALOGE("returnTargetBufferForDisplay called without a valid buffer handle.\n");
return EvsResult::INVALID_ARG;
}
if (bufferId != mBuffer.bufferId) {
- ALOGE ("Got an unrecognized frame returned.\n");
+ ALOGE("Got an unrecognized frame returned.\n");
return EvsResult::INVALID_ARG;
}
if (!mFrameBusy) {
- ALOGE ("A frame was returned with no outstanding frames.\n");
+ ALOGE("A frame was returned with no outstanding frames.\n");
return EvsResult::BUFFER_NOT_AVAILABLE;
}
@@ -253,23 +276,32 @@
// If we were waiting for a new frame, this is it!
if (mRequestedState == DisplayState::VISIBLE_ON_NEXT_FRAME) {
mRequestedState = DisplayState::VISIBLE;
+ if (mGlWrapper) {
+ mGlWrapper->showWindow(mDisplayProxy, mDisplayId);
+ }
}
// Validate we're in an expected state
if (mRequestedState != DisplayState::VISIBLE) {
// We shouldn't get frames back when we're not visible.
- ALOGE ("Got an unexpected frame returned while not visible - ignoring.\n");
- } else {
+ ALOGE("Got an unexpected frame returned while not visible - ignoring.\n");
+ } else if (mGlWrapper) {
// This is where the buffer would be made visible.
- // For now we simply validate it has the data we expect in it by reading it back
+ if (!mGlWrapper->updateImageTexture(mBuffer)) {
+ return EvsResult::UNDERLYING_SERVICE_ERROR;
+ }
+ // Put the image on the screen
+ mGlWrapper->renderImageToScreen();
+ } else {
+ // TODO: Move below validation logic to somewhere else
+#if 0
+ // For now we simply validate it has the data we expect in it by reading it back
// Lock our display buffer for reading
uint32_t* pixels = nullptr;
- GraphicBufferMapper &mapper = GraphicBufferMapper::get();
- mapper.lock(mBuffer.memHandle,
- GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_NEVER,
- android::Rect(mBuffer.width, mBuffer.height),
- (void **)&pixels);
+ GraphicBufferMapper& mapper = GraphicBufferMapper::get();
+ mapper.lock(mBuffer.memHandle, GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_NEVER,
+ android::Rect(mBuffer.width, mBuffer.height), (void**)&pixels);
// If we failed to lock the pixel buffer, we're about to crash, but log it first
if (!pixels) {
@@ -286,8 +318,8 @@
// 0xFF in the MSB.
// The exception is the very first 32 bits which is used for the
// time varying frame signature to avoid getting fooled by a static image.
- uint32_t expectedPixel = 0xFF0000FF | // MSB and LSB
- ((row & 0xFF) << 8) | // vertical gradient
+ uint32_t expectedPixel = 0xFF0000FF | // MSB and LSB
+ ((row & 0xFF) << 8) | // vertical gradient
((col & 0xFF) << 16); // horizontal gradient
if ((row | col) == 0) {
// we'll check the "uniqueness" of the frame signature below
@@ -318,39 +350,31 @@
ALOGE("Duplicate, likely stale frame buffer detected");
}
-
// Release our output buffer
mapper.unlock(mBuffer.memHandle);
if (!frameLooksGood) {
return EvsResult::UNDERLYING_SERVICE_ERROR;
}
+#endif
}
return EvsResult::OK;
}
-
-Return<EvsResult> EvsDisplay::returnTargetBufferForDisplay(const BufferDesc_1_0& buffer) {
+Return<EvsResult> EvsDisplay::returnTargetBufferForDisplay(const V1_0::BufferDesc& buffer) {
return returnTargetBufferForDisplayImpl(buffer.bufferId, buffer.memHandle);
}
-
Return<void> EvsDisplay::getDisplayInfo_1_1(getDisplayInfo_1_1_cb _info_cb) {
if (mDisplayProxy != nullptr) {
return mDisplayProxy->getDisplayInfo(mDisplayId, _info_cb);
} else {
HwDisplayConfig nullConfig;
- HwDisplayState nullState;
+ HwDisplayState nullState;
_info_cb(nullConfig, nullState);
- return Void();
+ return {};
}
}
-
-} // namespace implementation
-} // namespace V1_1
-} // namespace evs
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::evs::V1_1::implementation
diff --git a/automotive/evs/1.1/default/EvsDisplay.h b/automotive/evs/1.1/default/EvsDisplay.h
index 9b2ed90..b2ec3e8 100644
--- a/automotive/evs/1.1/default/EvsDisplay.h
+++ b/automotive/evs/1.1/default/EvsDisplay.h
@@ -17,64 +17,48 @@
#ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSDISPLAY_H
#define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSDISPLAY_H
-#include <android/hardware/automotive/evs/1.1/IEvsDisplay.h>
+#include "GlWrapper.h"
+
#include <android/frameworks/automotive/display/1.0/IAutomotiveDisplayProxyService.h>
+#include <android/hardware/automotive/evs/1.1/IEvsDisplay.h>
#include <ui/GraphicBuffer.h>
-using ::android::hardware::automotive::evs::V1_1::IEvsDisplay;
-using ::android::hardware::automotive::evs::V1_0::DisplayDesc;
-using ::android::hardware::automotive::evs::V1_0::DisplayState;
-using ::android::hardware::automotive::evs::V1_0::EvsResult;
-using BufferDesc_1_0 = ::android::hardware::automotive::evs::V1_0::BufferDesc;
-using android::frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService;
-
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace evs {
-namespace V1_1 {
-namespace implementation {
-
+namespace android::hardware::automotive::evs::V1_1::implementation {
class EvsDisplay : public IEvsDisplay {
-public:
+ public:
// Methods from ::android::hardware::automotive::evs::V1_0::IEvsDisplay follow.
- Return<void> getDisplayInfo(getDisplayInfo_cb _hidl_cb) override;
- Return<EvsResult> setDisplayState(DisplayState state) override;
- Return<DisplayState> getDisplayState() override;
- Return<void> getTargetBuffer(getTargetBuffer_cb _hidl_cb) override;
- Return<EvsResult> returnTargetBufferForDisplay(const BufferDesc_1_0& buffer) override;
+ Return<void> getDisplayInfo(getDisplayInfo_cb _hidl_cb) override;
+ Return<V1_0::EvsResult> setDisplayState(V1_0::DisplayState state) override;
+ Return<V1_0::DisplayState> getDisplayState() override;
+ Return<void> getTargetBuffer(getTargetBuffer_cb _hidl_cb) override;
+ Return<V1_0::EvsResult> returnTargetBufferForDisplay(const V1_0::BufferDesc& buffer) override;
// Methods from ::android::hardware::automotive::evs::V1_1::IEvsDisplay follow.
- Return<void> getDisplayInfo_1_1(getDisplayInfo_1_1_cb _info_cb) override;
+ Return<void> getDisplayInfo_1_1(getDisplayInfo_1_1_cb _info_cb) override;
// Implementation details
EvsDisplay();
- EvsDisplay(sp<IAutomotiveDisplayProxyService> pDisplayProxy, uint64_t displayId);
+ EvsDisplay(
+ sp<frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService> pDisplayProxy,
+ uint64_t displayId);
virtual ~EvsDisplay() override;
- void forceShutdown(); // This gets called if another caller "steals" ownership of the display
- Return<EvsResult> returnTargetBufferForDisplayImpl(const uint32_t bufferId,
- const buffer_handle_t memHandle);
+ void forceShutdown(); // This gets called if another caller "steals" ownership of the display
+ Return<V1_0::EvsResult> returnTargetBufferForDisplayImpl(const uint32_t bufferId,
+ const buffer_handle_t memHandle);
-private:
- DisplayDesc mInfo = {};
- BufferDesc_1_0 mBuffer = {}; // A graphics buffer into which we'll store images
-
- bool mFrameBusy = false; // A flag telling us our buffer is in use
- DisplayState mRequestedState = DisplayState::NOT_VISIBLE;
-
- std::mutex mAccessLock;
-
- sp<IAutomotiveDisplayProxyService> mDisplayProxy;
- uint64_t mDisplayId;
+ private:
+ V1_0::DisplayDesc mInfo = {};
+ V1_0::BufferDesc mBuffer = {}; // A graphics buffer into which we'll store images
+ V1_0::DisplayState mRequestedState = V1_0::DisplayState::NOT_VISIBLE;
+ bool mFrameBusy = false; // A flag telling us our buffer is in use
+ std::mutex mAccessLock;
+ sp<frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService> mDisplayProxy;
+ uint64_t mDisplayId;
+ std::unique_ptr<GlWrapper> mGlWrapper;
};
-} // namespace implementation
-} // namespace V1_1
-} // namespace evs
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::evs::V1_1::implementation
#endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSDISPLAY_H
diff --git a/automotive/evs/1.1/default/EvsEnumerator.cpp b/automotive/evs/1.1/default/EvsEnumerator.cpp
index d066471..b84268a 100644
--- a/automotive/evs/1.1/default/EvsEnumerator.cpp
+++ b/automotive/evs/1.1/default/EvsEnumerator.cpp
@@ -14,184 +14,171 @@
* limitations under the License.
*/
-#define LOG_TAG "android.hardware.automotive.evs@1.1-service"
-
#include "EvsEnumerator.h"
#include "EvsCamera.h"
#include "EvsDisplay.h"
#include "EvsUltrasonicsArray.h"
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace evs {
-namespace V1_1 {
-namespace implementation {
+using android::frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService;
+using android::hardware::automotive::evs::V1_0::EvsResult;
+namespace android::hardware::automotive::evs::V1_1::implementation {
+
+namespace evs_v1_0 = ::android::hardware::automotive::evs::V1_0;
// NOTE: All members values are static so that all clients operate on the same state
// That is to say, this is effectively a singleton despite the fact that HIDL
// constructs a new instance for each client.
-std::list<EvsEnumerator::CameraRecord> EvsEnumerator::sCameraList;
-wp<EvsDisplay> EvsEnumerator::sActiveDisplay;
-unique_ptr<ConfigManager> EvsEnumerator::sConfigManager;
-sp<IAutomotiveDisplayProxyService> EvsEnumerator::sDisplayProxyService;
-std::unordered_map<uint8_t, uint64_t> EvsEnumerator::sDisplayPortList;
-std::list<EvsEnumerator::UltrasonicsArrayRecord> EvsEnumerator::sUltrasonicsArrayRecordList;
+std::list<EvsEnumerator::CameraRecord> EvsEnumerator::sCameraList;
+wp<EvsDisplay> EvsEnumerator::sActiveDisplay;
+std::unique_ptr<ConfigManager> EvsEnumerator::sConfigManager;
+sp<IAutomotiveDisplayProxyService> EvsEnumerator::sDisplayProxyService;
+std::unordered_map<uint8_t, uint64_t> EvsEnumerator::sDisplayPortList;
+std::list<EvsEnumerator::UltrasonicsArrayRecord> EvsEnumerator::sUltrasonicsArrayRecordList;
+uint64_t EvsEnumerator::sInternalDisplayId;
-EvsEnumerator::EvsEnumerator(sp<IAutomotiveDisplayProxyService> windowService) {
- ALOGD("EvsEnumerator created");
+EvsEnumerator::EvsEnumerator(sp<IAutomotiveDisplayProxyService>& windowService) {
+ ALOGD("%s", __FUNCTION__);
// Add sample camera data to our list of cameras
// In a real driver, this would be expected to can the available hardware
sConfigManager =
- ConfigManager::Create("/vendor/etc/automotive/evs/evs_default_configuration.xml");
+ ConfigManager::Create("/vendor/etc/automotive/evs/evs_default_configuration.xml");
// Add available cameras
for (auto v : sConfigManager->getCameraList()) {
- sCameraList.emplace_back(v.c_str());
+ CameraRecord rec(v.data());
+ std::unique_ptr<ConfigManager::CameraInfo>& pInfo = sConfigManager->getCameraInfo(v);
+ if (pInfo) {
+ rec.desc.metadata.setToExternal(reinterpret_cast<uint8_t*>(pInfo->characteristics),
+ get_camera_metadata_size(pInfo->characteristics));
+ }
+ sCameraList.push_back(std::move(rec));
}
- if (sDisplayProxyService == nullptr) {
+ if (!sDisplayProxyService) {
/* sets a car-window service handle */
sDisplayProxyService = windowService;
}
// Add available displays
- if (sDisplayProxyService != nullptr) {
+ if (sDisplayProxyService) {
// Get a display ID list.
- sDisplayProxyService->getDisplayIdList([](const auto& displayIds) {
- for (const auto& id : displayIds) {
- const auto port = id & 0xF;
- sDisplayPortList.insert_or_assign(port, id);
+ auto status = sDisplayProxyService->getDisplayIdList([](const auto& displayIds) {
+ if (displayIds.size() > 0) {
+ sInternalDisplayId = displayIds[0];
+ for (const auto& id : displayIds) {
+ const auto port = id & 0xF;
+ sDisplayPortList.insert_or_assign(port, id);
+ }
}
});
+
+ if (!status.isOk()) {
+ ALOGE("Failed to read a display list");
+ }
}
// Add ultrasonics array desc.
- sUltrasonicsArrayRecordList.emplace_back(
- EvsUltrasonicsArray::GetMockArrayDesc("front_array"));
+ sUltrasonicsArrayRecordList.emplace_back(EvsUltrasonicsArray::GetMockArrayDesc("front_array"));
}
-
// Methods from ::android::hardware::automotive::evs::V1_0::IEvsEnumerator follow.
-Return<void> EvsEnumerator::getCameraList(getCameraList_cb _hidl_cb) {
- ALOGD("getCameraList");
+Return<void> EvsEnumerator::getCameraList(getCameraList_cb _hidl_cb) {
+ ALOGD("%s", __FUNCTION__);
- const unsigned numCameras = sCameraList.size();
+ const auto numCameras = sCameraList.size();
// Build up a packed array of CameraDesc for return
// NOTE: Only has to live until the callback returns
- std::vector<CameraDesc_1_0> descriptions;
+ std::vector<evs_v1_0::CameraDesc> descriptions;
descriptions.reserve(numCameras);
for (const auto& cam : sCameraList) {
- descriptions.push_back( cam.desc.v1 );
+ descriptions.push_back(cam.desc.v1);
}
// Encapsulate our camera descriptions in the HIDL vec type
- hidl_vec<CameraDesc_1_0> hidlCameras(descriptions);
+ hidl_vec<evs_v1_0::CameraDesc> hidlCameras(descriptions);
// Send back the results
ALOGD("reporting %zu cameras available", hidlCameras.size());
_hidl_cb(hidlCameras);
-
- // HIDL convention says we return Void if we sent our result back via callback
- return Void();
+ return {};
}
-
-Return<sp<IEvsCamera_1_0>> EvsEnumerator::openCamera(const hidl_string& cameraId) {
- ALOGD("openCamera");
+Return<sp<evs_v1_0::IEvsCamera>> EvsEnumerator::openCamera(const hidl_string& cameraId) {
+ ALOGD("%s", __FUNCTION__);
// Find the named camera
- CameraRecord *pRecord = nullptr;
- for (auto &&cam : sCameraList) {
- if (cam.desc.v1.cameraId == cameraId) {
- // Found a match!
- pRecord = &cam;
- break;
- }
- }
-
- // Is this a recognized camera id?
- if (!pRecord) {
+ auto it = std::find_if(sCameraList.begin(), sCameraList.end(), [&cameraId](const auto& cam) {
+ return cameraId == cam.desc.v1.cameraId;
+ });
+ if (it == sCameraList.end()) {
ALOGE("Requested camera %s not found", cameraId.c_str());
return nullptr;
}
// Has this camera already been instantiated by another caller?
- sp<EvsCamera> pActiveCamera = pRecord->activeInstance.promote();
+ sp<EvsCamera> pActiveCamera = it->activeInstance.promote();
if (pActiveCamera != nullptr) {
ALOGW("Killing previous camera because of new caller");
closeCamera(pActiveCamera);
}
// Construct a camera instance for the caller
- if (sConfigManager == nullptr) {
+ if (!sConfigManager) {
pActiveCamera = EvsCamera::Create(cameraId.c_str());
} else {
- pActiveCamera = EvsCamera::Create(cameraId.c_str(),
- sConfigManager->getCameraInfo(cameraId));
+ pActiveCamera =
+ EvsCamera::Create(cameraId.c_str(), sConfigManager->getCameraInfo(cameraId));
}
- pRecord->activeInstance = pActiveCamera;
- if (pActiveCamera == nullptr) {
+ it->activeInstance = pActiveCamera;
+ if (!pActiveCamera) {
ALOGE("Failed to allocate new EvsCamera object for %s\n", cameraId.c_str());
}
return pActiveCamera;
}
+Return<void> EvsEnumerator::closeCamera(const ::android::sp<evs_v1_0::IEvsCamera>& pCamera) {
+ ALOGD("%s", __FUNCTION__);
-Return<void> EvsEnumerator::closeCamera(const ::android::sp<IEvsCamera_1_0>& pCamera) {
- ALOGD("closeCamera");
-
- auto pCamera_1_1 = IEvsCamera_1_1::castFrom(pCamera).withDefault(nullptr);
- if (pCamera_1_1 == nullptr) {
+ auto pCamera_1_1 = IEvsCamera::castFrom(pCamera).withDefault(nullptr);
+ if (!pCamera_1_1) {
ALOGE("Ignoring call to closeCamera with null camera ptr");
- return Void();
+ return {};
}
// Get the camera id so we can find it in our list
std::string cameraId;
- pCamera_1_1->getCameraInfo_1_1([&cameraId](CameraDesc desc) {
- cameraId = desc.v1.cameraId;
- }
- );
+ pCamera_1_1->getCameraInfo_1_1([&cameraId](CameraDesc desc) { cameraId = desc.v1.cameraId; });
// Find the named camera
- CameraRecord *pRecord = nullptr;
- for (auto &&cam : sCameraList) {
- if (cam.desc.v1.cameraId == cameraId) {
- // Found a match!
- pRecord = &cam;
- break;
- }
+ auto it = std::find_if(sCameraList.begin(), sCameraList.end(), [&cameraId](const auto& cam) {
+ return cameraId == cam.desc.v1.cameraId;
+ });
+ if (it == sCameraList.end()) {
+ ALOGE("Ignores a request to close unknown camera, %s", cameraId.data());
+ return {};
}
- // Is the display being destroyed actually the one we think is active?
- if (!pRecord) {
- ALOGE("Asked to close a camera who's name isn't recognized");
+ sp<EvsCamera> pActiveCamera = it->activeInstance.promote();
+ if (!pActiveCamera) {
+ ALOGE("Somehow a camera is being destroyed when the enumerator didn't know one existed");
+ } else if (pActiveCamera != pCamera_1_1) {
+ // This can happen if the camera was aggressively reopened, orphaning this previous instance
+ ALOGW("Ignoring close of previously orphaned camera - why did a client steal?");
} else {
- sp<EvsCamera> pActiveCamera = pRecord->activeInstance.promote();
-
- if (pActiveCamera == nullptr) {
- ALOGE("Somehow a camera is being destroyed when the enumerator didn't know one existed");
- } else if (pActiveCamera != pCamera_1_1) {
- // This can happen if the camera was aggressively reopened, orphaning this previous instance
- ALOGW("Ignoring close of previously orphaned camera - why did a client steal?");
- } else {
- // Drop the active camera
- pActiveCamera->forceShutdown();
- pRecord->activeInstance = nullptr;
- }
+ // Drop the active camera
+ pActiveCamera->forceShutdown();
+ it->activeInstance = nullptr;
}
- return Void();
+ return {};
}
-
-Return<sp<IEvsDisplay_1_0>> EvsEnumerator::openDisplay() {
- ALOGD("openDisplay");
+Return<sp<V1_0::IEvsDisplay>> EvsEnumerator::openDisplay() {
+ ALOGD("%s", __FUNCTION__);
// If we already have a display active, then we need to shut it down so we can
// give exclusive access to the new caller.
@@ -202,28 +189,25 @@
}
// Create a new display interface and return it
- pActiveDisplay = new EvsDisplay();
+ pActiveDisplay = new EvsDisplay(sDisplayProxyService, sInternalDisplayId);
sActiveDisplay = pActiveDisplay;
ALOGD("Returning new EvsDisplay object %p", pActiveDisplay.get());
return pActiveDisplay;
}
-
Return<void> EvsEnumerator::getDisplayIdList(getDisplayIdList_cb _list_cb) {
hidl_vec<uint8_t> ids;
-
ids.resize(sDisplayPortList.size());
+
unsigned i = 0;
- for (const auto& [port, id] : sDisplayPortList) {
- ids[i++] = port;
- }
+ std::for_each(sDisplayPortList.begin(), sDisplayPortList.end(),
+ [&](const auto& element) { ids[i++] = element.first; });
_list_cb(ids);
- return Void();
+ return {};
}
-
Return<sp<IEvsDisplay>> EvsEnumerator::openDisplay_1_1(uint8_t port) {
ALOGD("%s", __FUNCTION__);
@@ -243,10 +227,8 @@
return pActiveDisplay;
}
-
-
-Return<void> EvsEnumerator::closeDisplay(const ::android::sp<IEvsDisplay_1_0>& pDisplay) {
- ALOGD("closeDisplay");
+Return<void> EvsEnumerator::closeDisplay(const ::android::sp<V1_0::IEvsDisplay>& pDisplay) {
+ ALOGD("%s", __FUNCTION__);
// Do we still have a display object we think should be active?
sp<EvsDisplay> pActiveDisplay = sActiveDisplay.promote();
@@ -260,123 +242,111 @@
sActiveDisplay = nullptr;
}
- return Void();
+ return {};
}
-
-Return<DisplayState> EvsEnumerator::getDisplayState() {
- ALOGD("getDisplayState");
+Return<V1_0::DisplayState> EvsEnumerator::getDisplayState() {
+ ALOGD("%s", __FUNCTION__);
// Do we still have a display object we think should be active?
sp<IEvsDisplay> pActiveDisplay = sActiveDisplay.promote();
if (pActiveDisplay != nullptr) {
return pActiveDisplay->getDisplayState();
} else {
- return DisplayState::NOT_OPEN;
+ return V1_0::DisplayState::NOT_OPEN;
}
}
-
// Methods from ::android::hardware::automotive::evs::V1_1::IEvsEnumerator follow.
-Return<void> EvsEnumerator::getCameraList_1_1(getCameraList_1_1_cb _hidl_cb) {
- ALOGD("getCameraList");
+Return<void> EvsEnumerator::getCameraList_1_1(getCameraList_1_1_cb _hidl_cb) {
+ ALOGD("%s", __FUNCTION__);
- const unsigned numCameras = sCameraList.size();
+ const auto numCameras = sCameraList.size();
// Build up a packed array of CameraDesc for return
// NOTE: Only has to live until the callback returns
- std::vector<CameraDesc_1_1> descriptions;
+ std::vector<CameraDesc> descriptions;
descriptions.reserve(numCameras);
- for (const auto& cam : sCameraList) {
- descriptions.push_back( cam.desc );
- }
+ std::for_each(sCameraList.begin(), sCameraList.end(),
+ [&](const auto& cam) { descriptions.push_back(cam.desc); });
// Encapsulate our camera descriptions in the HIDL vec type
- hidl_vec<CameraDesc_1_1> hidlCameras(descriptions);
+ hidl_vec<CameraDesc> hidlCameras(descriptions);
// Send back the results
ALOGD("reporting %zu cameras available", hidlCameras.size());
_hidl_cb(hidlCameras);
-
- // HIDL convention says we return Void if we sent our result back via callback
- return Void();
+ return {};
}
-Return<sp<IEvsCamera_1_1>>
-EvsEnumerator::openCamera_1_1(const hidl_string& cameraId,
- const Stream& streamCfg) {
- // Find the named camera
- CameraRecord *pRecord = nullptr;
- for (auto &&cam : sCameraList) {
- if (cam.desc.v1.cameraId == cameraId) {
- // Found a match!
- pRecord = &cam;
- break;
- }
- }
+Return<sp<IEvsCamera>> EvsEnumerator::openCamera_1_1(const hidl_string& cameraId,
+ const Stream& streamCfg) {
+ ALOGD("%s", __FUNCTION__);
- // Is this a recognized camera id?
- if (!pRecord) {
+ // Find the named camera
+ auto it = std::find_if(sCameraList.begin(), sCameraList.end(), [&cameraId](const auto& cam) {
+ return cameraId == cam.desc.v1.cameraId;
+ });
+ if (it == sCameraList.end()) {
ALOGE("Requested camera %s not found", cameraId.c_str());
return nullptr;
}
// Has this camera already been instantiated by another caller?
- sp<EvsCamera> pActiveCamera = pRecord->activeInstance.promote();
+ sp<EvsCamera> pActiveCamera = it->activeInstance.promote();
if (pActiveCamera != nullptr) {
ALOGW("Killing previous camera because of new caller");
closeCamera(pActiveCamera);
}
// Construct a camera instance for the caller
- if (sConfigManager == nullptr) {
+ if (!sConfigManager) {
pActiveCamera = EvsCamera::Create(cameraId.c_str());
} else {
- pActiveCamera = EvsCamera::Create(cameraId.c_str(),
- sConfigManager->getCameraInfo(cameraId),
+ pActiveCamera = EvsCamera::Create(cameraId.c_str(), sConfigManager->getCameraInfo(cameraId),
&streamCfg);
}
- pRecord->activeInstance = pActiveCamera;
- if (pActiveCamera == nullptr) {
+ it->activeInstance = pActiveCamera;
+ if (!pActiveCamera) {
ALOGE("Failed to allocate new EvsCamera object for %s\n", cameraId.c_str());
}
return pActiveCamera;
}
-
EvsEnumerator::CameraRecord* EvsEnumerator::findCameraById(const std::string& cameraId) {
- // Find the named camera
- CameraRecord *pRecord = nullptr;
- for (auto &&cam : sCameraList) {
- if (cam.desc.v1.cameraId == cameraId) {
- // Found a match!
- pRecord = &cam;
- break;
- }
- }
+ ALOGD("%s", __FUNCTION__);
- return pRecord;
+ // Find the named camera
+ auto it = std::find_if(sCameraList.begin(), sCameraList.end(), [&cameraId](const auto& cam) {
+ return cameraId == cam.desc.v1.cameraId;
+ });
+ return (it != sCameraList.end()) ? &*it : nullptr;
}
EvsEnumerator::UltrasonicsArrayRecord* EvsEnumerator::findUltrasonicsArrayById(
const std::string& ultrasonicsArrayId) {
- auto recordIt = std::find_if(
- sUltrasonicsArrayRecordList.begin(), sUltrasonicsArrayRecordList.end(),
- [&ultrasonicsArrayId](const UltrasonicsArrayRecord& record) {
- return ultrasonicsArrayId == record.desc.ultrasonicsArrayId;});
+ ALOGD("%s", __FUNCTION__);
+
+ auto recordIt =
+ std::find_if(sUltrasonicsArrayRecordList.begin(), sUltrasonicsArrayRecordList.end(),
+ [&ultrasonicsArrayId](const UltrasonicsArrayRecord& record) {
+ return ultrasonicsArrayId == record.desc.ultrasonicsArrayId;
+ });
return (recordIt != sUltrasonicsArrayRecordList.end()) ? &*recordIt : nullptr;
}
Return<void> EvsEnumerator::getUltrasonicsArrayList(getUltrasonicsArrayList_cb _hidl_cb) {
+ ALOGD("%s", __FUNCTION__);
+
hidl_vec<UltrasonicsArrayDesc> desc;
desc.resize(sUltrasonicsArrayRecordList.size());
// Copy over desc from sUltrasonicsArrayRecordList.
for (auto p = std::make_pair(sUltrasonicsArrayRecordList.begin(), desc.begin());
- p.first != sUltrasonicsArrayRecordList.end(); p.first++, p.second++) {
+ p.first != sUltrasonicsArrayRecordList.end(); p.first++, p.second++) {
*p.second = p.first->desc;
}
@@ -385,11 +355,13 @@
_hidl_cb(desc);
// HIDL convention says we return Void if we sent our result back via callback
- return Void();
+ return {};
}
Return<sp<IEvsUltrasonicsArray>> EvsEnumerator::openUltrasonicsArray(
const hidl_string& ultrasonicsArrayId) {
+ ALOGD("%s", __FUNCTION__);
+
// Find the named ultrasonic array.
UltrasonicsArrayRecord* pRecord = findUltrasonicsArrayById(ultrasonicsArrayId);
@@ -419,10 +391,11 @@
Return<void> EvsEnumerator::closeUltrasonicsArray(
const sp<IEvsUltrasonicsArray>& pEvsUltrasonicsArray) {
+ ALOGD("%s", __FUNCTION__);
if (pEvsUltrasonicsArray.get() == nullptr) {
ALOGE("Ignoring call to closeUltrasonicsArray with null ultrasonics array");
- return Void();
+ return {};
}
// Get the ultrasonics array id so we can find it in our list.
@@ -435,7 +408,7 @@
UltrasonicsArrayRecord* pRecord = findUltrasonicsArrayById(ultrasonicsArrayId);
if (!pRecord) {
ALOGE("Asked to close a ultrasonics array whose name isnt not found");
- return Void();
+ return {};
}
sp<EvsUltrasonicsArray> pActiveUltrasonicsArray = pRecord->activeInstance.promote();
@@ -453,12 +426,7 @@
pRecord->activeInstance = nullptr;
}
- return Void();
+ return {};
}
-} // namespace implementation
-} // namespace V1_1
-} // namespace evs
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::evs::V1_1::implementation
diff --git a/automotive/evs/1.1/default/EvsEnumerator.h b/automotive/evs/1.1/default/EvsEnumerator.h
index d80124b..513fc8d 100644
--- a/automotive/evs/1.1/default/EvsEnumerator.h
+++ b/automotive/evs/1.1/default/EvsEnumerator.h
@@ -17,56 +17,41 @@
#ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSCAMERAENUMERATOR_H
#define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSCAMERAENUMERATOR_H
-#include <android/hardware/automotive/evs/1.1/IEvsEnumerator.h>
+#include "ConfigManager.h"
+
+#include <android/frameworks/automotive/display/1.0/IAutomotiveDisplayProxyService.h>
#include <android/hardware/automotive/evs/1.1/IEvsCamera.h>
#include <android/hardware/automotive/evs/1.1/IEvsDisplay.h>
-#include <android/frameworks/automotive/display/1.0/IAutomotiveDisplayProxyService.h>
+#include <android/hardware/automotive/evs/1.1/IEvsEnumerator.h>
#include <android/hardware/automotive/evs/1.1/IEvsUltrasonicsArray.h>
#include <list>
-#include "ConfigManager.h"
+namespace android::hardware::automotive::evs::V1_1::implementation {
-using ::android::hardware::automotive::evs::V1_0::EvsResult;
-using ::android::hardware::automotive::evs::V1_0::DisplayState;
-using IEvsCamera_1_0 = ::android::hardware::automotive::evs::V1_0::IEvsCamera;
-using IEvsCamera_1_1 = ::android::hardware::automotive::evs::V1_1::IEvsCamera;
-using CameraDesc_1_0 = ::android::hardware::automotive::evs::V1_0::CameraDesc;
-using CameraDesc_1_1 = ::android::hardware::automotive::evs::V1_1::CameraDesc;
-using IEvsDisplay_1_0 = ::android::hardware::automotive::evs::V1_0::IEvsDisplay;
-using IEvsDisplay_1_1 = ::android::hardware::automotive::evs::V1_1::IEvsDisplay;
-using android::frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService;
+namespace evs_v1_0 = ::android::hardware::automotive::evs::V1_0;
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace evs {
-namespace V1_1 {
-namespace implementation {
-
-
-class EvsCamera; // from EvsCamera.h
-class EvsDisplay; // from EvsDisplay.h
+class EvsCamera; // from EvsCamera.h
+class EvsDisplay; // from EvsDisplay.h
class EvsUltrasonicsArray; // from EvsUltrasonicsArray.h
-
class EvsEnumerator : public IEvsEnumerator {
-public:
+ public:
// Methods from ::android::hardware::automotive::evs::V1_0::IEvsEnumerator follow.
- Return<void> getCameraList(getCameraList_cb _hidl_cb) override;
- Return<sp<IEvsCamera_1_0>> openCamera(const hidl_string& cameraId) override;
- Return<void> closeCamera(const ::android::sp<IEvsCamera_1_0>& carCamera) override;
- Return<sp<IEvsDisplay_1_0>> openDisplay() override;
- Return<void> closeDisplay(const ::android::sp<IEvsDisplay_1_0>& display) override;
- Return<DisplayState> getDisplayState() override;
+ Return<void> getCameraList(getCameraList_cb _hidl_cb) override;
+ Return<sp<evs_v1_0::IEvsCamera>> openCamera(const hidl_string& cameraId) override;
+ Return<void> closeCamera(const ::android::sp<evs_v1_0::IEvsCamera>& carCamera) override;
+ Return<sp<evs_v1_0::IEvsDisplay>> openDisplay() override;
+ Return<void> closeDisplay(const ::android::sp<evs_v1_0::IEvsDisplay>& display) override;
+ Return<V1_0::DisplayState> getDisplayState() override;
// Methods from ::android::hardware::automotive::evs::V1_1::IEvsEnumerator follow.
- Return<void> getCameraList_1_1(getCameraList_1_1_cb _hidl_cb) override;
- Return<sp<IEvsCamera_1_1>> openCamera_1_1(const hidl_string& cameraId,
- const Stream& streamCfg) override;
+ Return<void> getCameraList_1_1(getCameraList_1_1_cb _hidl_cb) override;
+ Return<sp<IEvsCamera>> openCamera_1_1(const hidl_string& cameraId,
+ const Stream& streamCfg) override;
Return<bool> isHardware() override { return true; }
- Return<void> getDisplayIdList(getDisplayIdList_cb _list_cb) override;
- Return<sp<IEvsDisplay_1_1>> openDisplay_1_1(uint8_t port) override;
+ Return<void> getDisplayIdList(getDisplayIdList_cb _list_cb) override;
+ Return<sp<IEvsDisplay>> openDisplay_1_1(uint8_t port) override;
Return<void> getUltrasonicsArrayList(getUltrasonicsArrayList_cb _hidl_cb) override;
Return<sp<IEvsUltrasonicsArray>> openUltrasonicsArray(
const hidl_string& ultrasonicsArrayId) override;
@@ -74,49 +59,40 @@
const ::android::sp<IEvsUltrasonicsArray>& evsUltrasonicsArray) override;
// Implementation details
- EvsEnumerator(sp<IAutomotiveDisplayProxyService> windowService = nullptr);
+ EvsEnumerator(sp<frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService>&
+ windowService);
-private:
+ private:
// NOTE: All members values are static so that all clients operate on the same state
// That is to say, this is effectively a singleton despite the fact that HIDL
// constructs a new instance for each client.
struct CameraRecord {
- CameraDesc_1_1 desc;
- wp<EvsCamera> activeInstance;
+ CameraDesc desc;
+ wp<EvsCamera> activeInstance;
- CameraRecord(const char *cameraId) : desc() { desc.v1.cameraId = cameraId; }
+ CameraRecord(const char* cameraId) : desc() { desc.v1.cameraId = cameraId; }
};
struct UltrasonicsArrayRecord {
UltrasonicsArrayDesc desc;
wp<EvsUltrasonicsArray> activeInstance;
- UltrasonicsArrayRecord(const UltrasonicsArrayDesc& arrayDesc) : desc(arrayDesc) {};
+ UltrasonicsArrayRecord(const UltrasonicsArrayDesc& arrayDesc) : desc(arrayDesc){};
};
static CameraRecord* findCameraById(const std::string& cameraId);
-
- static std::list<CameraRecord> sCameraList;
-
+ static std::list<CameraRecord> sCameraList;
static UltrasonicsArrayRecord* findUltrasonicsArrayById(const std::string& ultrasonicsArrayId);
-
static std::list<UltrasonicsArrayRecord> sUltrasonicsArrayRecordList;
- // Weak pointer. Object destructs if client dies.
- static wp<EvsDisplay> sActiveDisplay;
-
- static unique_ptr<ConfigManager> sConfigManager;
-
- static sp<IAutomotiveDisplayProxyService> sDisplayProxyService;
- static std::unordered_map<uint8_t,
- uint64_t> sDisplayPortList;
+ static wp<EvsDisplay> sActiveDisplay; // Weak pointer. Object destructs if client dies.
+ static uint64_t sInternalDisplayId;
+ static sp<frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService>
+ sDisplayProxyService;
+ static std::unordered_map<uint8_t, uint64_t> sDisplayPortList;
+ static std::unique_ptr<ConfigManager> sConfigManager;
};
-} // namespace implementation
-} // namespace V1_1
-} // namespace evs
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::evs::V1_1::implementation
#endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSCAMERAENUMERATOR_H
diff --git a/automotive/evs/1.1/default/EvsUltrasonicsArray.cpp b/automotive/evs/1.1/default/EvsUltrasonicsArray.cpp
index ebd47c6..951937a 100644
--- a/automotive/evs/1.1/default/EvsUltrasonicsArray.cpp
+++ b/automotive/evs/1.1/default/EvsUltrasonicsArray.cpp
@@ -113,10 +113,9 @@
dataFrameDesc.receiversReadingsCountList = receiversReadingsCountList;
const std::vector<WaveformData> waveformDataList = {
- {recvIdList[0], { {1000, 0.1f}, {2000, 0.8f} }},
- {recvIdList[1], { {1000, 0.1f}, {2000, 1.0f} }},
- {recvIdList[2], { {1000, 0.1f}, {2000, 0.2f}, {4000, 0.2f}, {5000, 0.1f} }}
- };
+ {recvIdList[0], {{1000, 0.1f}, {2000, 0.8f}}},
+ {recvIdList[1], {{1000, 0.1f}, {2000, 1.0f}}},
+ {recvIdList[2], {{1000, 0.1f}, {2000, 0.2f}, {4000, 0.2f}, {5000, 0.1f}}}};
if (pIMemory.get() == nullptr) {
return false;
diff --git a/automotive/evs/1.1/default/EvsUltrasonicsArray.h b/automotive/evs/1.1/default/EvsUltrasonicsArray.h
index 88aa600..681f68f 100644
--- a/automotive/evs/1.1/default/EvsUltrasonicsArray.h
+++ b/automotive/evs/1.1/default/EvsUltrasonicsArray.h
@@ -119,7 +119,7 @@
std::mutex mAccessLock;
std::vector<DataFrameRecord> mDataFrames GUARDED_BY(mAccessLock); // Shared memory buffers.
unsigned mFramesAllowed GUARDED_BY(mAccessLock); // How many buffers are we currently using.
- unsigned mFramesInUse GUARDED_BY(mAccessLock); // How many buffers are currently outstanding.
+ unsigned mFramesInUse GUARDED_BY(mAccessLock); // How many buffers are currently outstanding.
StreamStateValues mStreamState GUARDED_BY(mAccessLock);
};
diff --git a/automotive/evs/1.1/default/GlWrapper.cpp b/automotive/evs/1.1/default/GlWrapper.cpp
new file mode 100644
index 0000000..357b67c
--- /dev/null
+++ b/automotive/evs/1.1/default/GlWrapper.cpp
@@ -0,0 +1,450 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "GlWrapper.h"
+
+#include <ui/DisplayMode.h>
+#include <ui/DisplayState.h>
+#include <ui/GraphicBuffer.h>
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+#include <utility>
+
+using android::GraphicBuffer;
+using android::sp;
+
+namespace {
+
+// Defines a default color to clear the screen in RGBA format
+constexpr float kDefaultColorInRgba[] = {0.1f, 0.5f, 0.1f, 1.0f};
+
+// Defines the size of the preview area relative to the entire display
+constexpr float kDisplayAreaRatio = 0.8f;
+
+constexpr const char vertexShaderSource[] =
+ ""
+ "#version 300 es \n"
+ "layout(location = 0) in vec4 pos; \n"
+ "layout(location = 1) in vec2 tex; \n"
+ "out vec2 uv; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_Position = pos; \n"
+ " uv = tex; \n"
+ "} \n";
+
+constexpr const char pixelShaderSource[] =
+ "#version 300 es \n"
+ "precision mediump float; \n"
+ "uniform sampler2D tex; \n"
+ "in vec2 uv; \n"
+ "out vec4 color; \n"
+ "void main() \n"
+ "{ \n"
+ " vec4 texel = texture(tex, uv); \n"
+ " color = texel; \n"
+ "} \n";
+
+const char* getEGLError(void) {
+ switch (eglGetError()) {
+ case EGL_SUCCESS:
+ return "EGL_SUCCESS";
+ case EGL_NOT_INITIALIZED:
+ return "EGL_NOT_INITIALIZED";
+ case EGL_BAD_ACCESS:
+ return "EGL_BAD_ACCESS";
+ case EGL_BAD_ALLOC:
+ return "EGL_BAD_ALLOC";
+ case EGL_BAD_ATTRIBUTE:
+ return "EGL_BAD_ATTRIBUTE";
+ case EGL_BAD_CONTEXT:
+ return "EGL_BAD_CONTEXT";
+ case EGL_BAD_CONFIG:
+ return "EGL_BAD_CONFIG";
+ case EGL_BAD_CURRENT_SURFACE:
+ return "EGL_BAD_CURRENT_SURFACE";
+ case EGL_BAD_DISPLAY:
+ return "EGL_BAD_DISPLAY";
+ case EGL_BAD_SURFACE:
+ return "EGL_BAD_SURFACE";
+ case EGL_BAD_MATCH:
+ return "EGL_BAD_MATCH";
+ case EGL_BAD_PARAMETER:
+ return "EGL_BAD_PARAMETER";
+ case EGL_BAD_NATIVE_PIXMAP:
+ return "EGL_BAD_NATIVE_PIXMAP";
+ case EGL_BAD_NATIVE_WINDOW:
+ return "EGL_BAD_NATIVE_WINDOW";
+ case EGL_CONTEXT_LOST:
+ return "EGL_CONTEXT_LOST";
+ default:
+ return "Unknown error";
+ }
+}
+
+// Given shader source, load and compile it
+GLuint loadShader(GLenum type, const char* shaderSrc) {
+ // Create the shader object
+ GLuint shader = glCreateShader(type);
+ if (shader == 0) {
+ LOG(ERROR) << "glCreateSharder() failed with error = " << glGetError();
+ return 0;
+ }
+
+ // Load and compile the shader
+ glShaderSource(shader, 1, &shaderSrc, nullptr);
+ glCompileShader(shader);
+
+ // Verify the compilation worked as expected
+ GLint compiled = 0;
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
+ if (!compiled) {
+ LOG(ERROR) << "Error compiling shader";
+
+ GLint size = 0;
+ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &size);
+ if (size > 0) {
+ // Get and report the error message
+ char infoLog[size];
+ glGetShaderInfoLog(shader, size, nullptr, infoLog);
+ LOG(ERROR) << " msg:" << std::endl << infoLog;
+ }
+
+ glDeleteShader(shader);
+ return 0;
+ }
+
+ return shader;
+}
+
+// Create a program object given vertex and pixels shader source
+GLuint buildShaderProgram(const char* vtxSrc, const char* pxlSrc) {
+ GLuint program = glCreateProgram();
+ if (program == 0) {
+ LOG(ERROR) << "Failed to allocate program object";
+ return 0;
+ }
+
+ // Compile the shaders and bind them to this program
+ GLuint vertexShader = loadShader(GL_VERTEX_SHADER, vtxSrc);
+ if (vertexShader == 0) {
+ LOG(ERROR) << "Failed to load vertex shader";
+ glDeleteProgram(program);
+ return 0;
+ }
+ GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pxlSrc);
+ if (pixelShader == 0) {
+ LOG(ERROR) << "Failed to load pixel shader";
+ glDeleteProgram(program);
+ glDeleteShader(vertexShader);
+ return 0;
+ }
+ glAttachShader(program, vertexShader);
+ glAttachShader(program, pixelShader);
+
+ // Link the program
+ glLinkProgram(program);
+ GLint linked = 0;
+ glGetProgramiv(program, GL_LINK_STATUS, &linked);
+ if (!linked) {
+ LOG(ERROR) << "Error linking program";
+ GLint size = 0;
+ glGetProgramiv(program, GL_INFO_LOG_LENGTH, &size);
+ if (size > 0) {
+ // Get and report the error message
+ char* infoLog = (char*)malloc(size);
+ glGetProgramInfoLog(program, size, nullptr, infoLog);
+ LOG(ERROR) << " msg: " << infoLog;
+ free(infoLog);
+ }
+
+ glDeleteProgram(program);
+ glDeleteShader(vertexShader);
+ glDeleteShader(pixelShader);
+ return 0;
+ }
+
+ return program;
+}
+
+} // namespace
+
+namespace android::hardware::automotive::evs::V1_1::implementation {
+
+// Main entry point
+bool GlWrapper::initialize(const sp<IAutomotiveDisplayProxyService>& service, uint64_t displayId) {
+ LOG(DEBUG) << __FUNCTION__;
+
+ if (!service) {
+ LOG(WARNING) << "IAutomotiveDisplayProxyService is invalid.";
+ return false;
+ }
+
+ // We will use the first display in the list as the primary.
+ service->getDisplayInfo(displayId, [this](auto dpyConfig, auto dpyState) {
+ ui::DisplayMode* pConfig = reinterpret_cast<ui::DisplayMode*>(dpyConfig.data());
+ mWidth = pConfig->resolution.getWidth();
+ mHeight = pConfig->resolution.getHeight();
+
+ ui::DisplayState* pState = reinterpret_cast<ui::DisplayState*>(dpyState.data());
+ if (pState->orientation != ui::ROTATION_0 && pState->orientation != ui::ROTATION_180) {
+ // rotate
+ std::swap(mWidth, mHeight);
+ }
+
+ LOG(DEBUG) << "Display resolution is " << mWidth << " x " << mHeight;
+ });
+
+ mGfxBufferProducer = service->getIGraphicBufferProducer(displayId);
+ if (mGfxBufferProducer == nullptr) {
+ LOG(ERROR) << "Failed to get IGraphicBufferProducer from IAutomotiveDisplayProxyService.";
+ return false;
+ }
+
+ mSurfaceHolder = getSurfaceFromHGBP(mGfxBufferProducer);
+ if (mSurfaceHolder == nullptr) {
+ LOG(ERROR) << "Failed to get a Surface from HGBP.";
+ return false;
+ }
+
+ mWindow = getNativeWindow(mSurfaceHolder.get());
+ if (mWindow == nullptr) {
+ LOG(ERROR) << "Failed to get a native window from Surface.";
+ return false;
+ }
+
+ // Set up our OpenGL ES context associated with the default display
+ mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ if (mDisplay == EGL_NO_DISPLAY) {
+ LOG(ERROR) << "Failed to get egl display";
+ return false;
+ }
+
+ EGLint major = 3;
+ EGLint minor = 0;
+ if (!eglInitialize(mDisplay, &major, &minor)) {
+ LOG(ERROR) << "Failed to initialize EGL: " << getEGLError();
+ return false;
+ }
+
+ const EGLint config_attribs[] = {
+ // Tag Value
+ EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_DEPTH_SIZE, 0, EGL_NONE};
+
+ // Pick the default configuration without constraints (is this good enough?)
+ EGLConfig egl_config = {0};
+ EGLint numConfigs = -1;
+ eglChooseConfig(mDisplay, config_attribs, &egl_config, 1, &numConfigs);
+ if (numConfigs != 1) {
+ LOG(ERROR) << "Didn't find a suitable format for our display window";
+ return false;
+ }
+
+ // Create the EGL render target surface
+ mSurface = eglCreateWindowSurface(mDisplay, egl_config, mWindow, nullptr);
+ if (mSurface == EGL_NO_SURFACE) {
+ LOG(ERROR) << "eglCreateWindowSurface failed: " << getEGLError();
+ ;
+ return false;
+ }
+
+ // Create the EGL context
+ // NOTE: Our shader is (currently at least) written to require version 3, so this
+ // is required.
+ const EGLint context_attribs[] = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE};
+ mContext = eglCreateContext(mDisplay, egl_config, EGL_NO_CONTEXT, context_attribs);
+ if (mContext == EGL_NO_CONTEXT) {
+ LOG(ERROR) << "Failed to create OpenGL ES Context: " << getEGLError();
+ return false;
+ }
+
+ // Activate our render target for drawing
+ if (!eglMakeCurrent(mDisplay, mSurface, mSurface, mContext)) {
+ LOG(ERROR) << "Failed to make the OpenGL ES Context current: " << getEGLError();
+ return false;
+ }
+
+ // Create the shader program for our simple pipeline
+ mShaderProgram = buildShaderProgram(vertexShaderSource, pixelShaderSource);
+ if (!mShaderProgram) {
+ LOG(ERROR) << "Failed to build shader program: " << getEGLError();
+ return false;
+ }
+
+ // Create a GL texture that will eventually wrap our externally created texture surface(s)
+ glGenTextures(1, &mTextureMap);
+ if (mTextureMap <= 0) {
+ LOG(ERROR) << "Didn't get a texture handle allocated: " << getEGLError();
+ return false;
+ }
+
+ // Turn off mip-mapping for the created texture surface
+ // (the inbound camera imagery doesn't have MIPs)
+ glBindTexture(GL_TEXTURE_2D, mTextureMap);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ return true;
+}
+
+void GlWrapper::shutdown() {
+ // Drop our device textures
+ if (mKHRimage != EGL_NO_IMAGE_KHR) {
+ eglDestroyImageKHR(mDisplay, mKHRimage);
+ mKHRimage = EGL_NO_IMAGE_KHR;
+ }
+
+ // Release all GL resources
+ eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ eglDestroySurface(mDisplay, mSurface);
+ eglDestroyContext(mDisplay, mContext);
+ eglTerminate(mDisplay);
+ mSurface = EGL_NO_SURFACE;
+ mContext = EGL_NO_CONTEXT;
+ mDisplay = EGL_NO_DISPLAY;
+
+ // Release the window
+ mSurfaceHolder = nullptr;
+}
+
+void GlWrapper::showWindow(sp<IAutomotiveDisplayProxyService>& service, uint64_t id) {
+ if (service != nullptr) {
+ service->showWindow(id);
+ } else {
+ LOG(ERROR) << "IAutomotiveDisplayProxyService is not available.";
+ }
+}
+
+void GlWrapper::hideWindow(sp<IAutomotiveDisplayProxyService>& service, uint64_t id) {
+ if (service != nullptr) {
+ service->hideWindow(id);
+ } else {
+ LOG(ERROR) << "IAutomotiveDisplayProxyService is not available.";
+ }
+}
+
+bool GlWrapper::updateImageTexture(const V1_0::BufferDesc& buffer) {
+ BufferDesc newBuffer = {
+ .buffer =
+ {
+ .nativeHandle = buffer.memHandle,
+ },
+ .pixelSize = buffer.pixelSize,
+ .bufferId = buffer.bufferId,
+ };
+ AHardwareBuffer_Desc* pDesc =
+ reinterpret_cast<AHardwareBuffer_Desc*>(&newBuffer.buffer.description);
+ *pDesc = {
+ .width = buffer.width,
+ .height = buffer.height,
+ .layers = 1,
+ .format = buffer.format,
+ .usage = buffer.usage,
+ };
+ return updateImageTexture(newBuffer);
+}
+
+bool GlWrapper::updateImageTexture(const BufferDesc& aFrame) {
+ // If we haven't done it yet, create an "image" object to wrap the gralloc buffer
+ if (mKHRimage == EGL_NO_IMAGE_KHR) {
+ // create a temporary GraphicBuffer to wrap the provided handle
+ const AHardwareBuffer_Desc* pDesc =
+ reinterpret_cast<const AHardwareBuffer_Desc*>(&aFrame.buffer.description);
+ sp<GraphicBuffer> pGfxBuffer = new GraphicBuffer(
+ pDesc->width, pDesc->height, pDesc->format, pDesc->layers, pDesc->usage,
+ pDesc->stride,
+ const_cast<native_handle_t*>(aFrame.buffer.nativeHandle.getNativeHandle()),
+ false /* keep ownership */
+ );
+ if (pGfxBuffer.get() == nullptr) {
+ LOG(ERROR) << "Failed to allocate GraphicBuffer to wrap our native handle";
+ return false;
+ }
+
+ // Get a GL compatible reference to the graphics buffer we've been given
+ EGLint eglImageAttributes[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE};
+ EGLClientBuffer cbuf = static_cast<EGLClientBuffer>(pGfxBuffer->getNativeBuffer());
+ mKHRimage = eglCreateImageKHR(mDisplay, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, cbuf,
+ eglImageAttributes);
+ if (mKHRimage == EGL_NO_IMAGE_KHR) {
+ LOG(ERROR) << "Error creating EGLImage: " << getEGLError();
+ return false;
+ }
+
+ // Update the texture handle we already created to refer to this gralloc buffer
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, mTextureMap);
+ glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast<GLeglImageOES>(mKHRimage));
+ }
+
+ return true;
+}
+
+void GlWrapper::renderImageToScreen() {
+ // Set the viewport
+ glViewport(0, 0, mWidth, mHeight);
+
+ // Clear the color buffer
+ glClearColor(kDefaultColorInRgba[0], kDefaultColorInRgba[1],
+ kDefaultColorInRgba[2], kDefaultColorInRgba[3]);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ // Select our screen space simple texture shader
+ glUseProgram(mShaderProgram);
+
+ // Bind the texture and assign it to the shader's sampler
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, mTextureMap);
+ GLint sampler = glGetUniformLocation(mShaderProgram, "tex");
+ glUniform1i(sampler, 0);
+
+ // We want our image to show up opaque regardless of alpha values
+ glDisable(GL_BLEND);
+
+ // Draw a rectangle on the screen
+ GLfloat vertsCarPos[] = {
+ -kDisplayAreaRatio, kDisplayAreaRatio, 0.0f, // left top in window space
+ kDisplayAreaRatio, kDisplayAreaRatio, 0.0f, // right top
+ -kDisplayAreaRatio, -kDisplayAreaRatio, 0.0f, // left bottom
+ kDisplayAreaRatio, -kDisplayAreaRatio, 0.0f // right bottom
+ };
+
+ // NOTE: We didn't flip the image in the texture, so V=0 is actually the top of the image
+ GLfloat vertsCarTex[] = {
+ 0.0f, 0.0f, // left top
+ 1.0f, 0.0f, // right top
+ 0.0f, 1.0f, // left bottom
+ 1.0f, 1.0f // right bottom
+ };
+ glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, vertsCarPos);
+ glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, vertsCarTex);
+ glEnableVertexAttribArray(0);
+ glEnableVertexAttribArray(1);
+
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+ // Clean up and flip the rendered result to the front so it is visible
+ glDisableVertexAttribArray(0);
+ glDisableVertexAttribArray(1);
+
+ glFinish();
+
+ eglSwapBuffers(mDisplay, mSurface);
+}
+
+} // namespace android::hardware::automotive::evs::V1_1::implementation
diff --git a/automotive/evs/1.1/default/GlWrapper.h b/automotive/evs/1.1/default/GlWrapper.h
new file mode 100644
index 0000000..44c206f
--- /dev/null
+++ b/automotive/evs/1.1/default/GlWrapper.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_DISPLAY_GLWRAPPER_H
+#define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_DISPLAY_GLWRAPPER_H
+
+#include <android-base/logging.h>
+#include <android/frameworks/automotive/display/1.0/IAutomotiveDisplayProxyService.h>
+#include <android/hardware/automotive/evs/1.1/types.h>
+#include <bufferqueueconverter/BufferQueueConverter.h>
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include <GLES3/gl3.h>
+#include <GLES3/gl3ext.h>
+
+namespace android::hardware::automotive::evs::V1_1::implementation {
+
+using frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService;
+using hardware::graphics::bufferqueue::V2_0::IGraphicBufferProducer;
+
+class GlWrapper {
+ public:
+ GlWrapper() : mSurfaceHolder(android::SurfaceHolderUniquePtr(nullptr, nullptr)) {}
+ bool initialize(const sp<IAutomotiveDisplayProxyService>& service, uint64_t displayId);
+ void shutdown();
+
+ bool updateImageTexture(const V1_0::BufferDesc& buffer);
+ bool updateImageTexture(const BufferDesc& buffer);
+ void renderImageToScreen();
+
+ void showWindow(sp<IAutomotiveDisplayProxyService>& service, uint64_t id);
+ void hideWindow(sp<IAutomotiveDisplayProxyService>& service, uint64_t id);
+
+ unsigned getWidth() { return mWidth; };
+ unsigned getHeight() { return mHeight; };
+
+ private:
+ sp<IGraphicBufferProducer> mGfxBufferProducer;
+
+ EGLDisplay mDisplay;
+ EGLSurface mSurface;
+ EGLContext mContext;
+
+ unsigned mWidth = 0;
+ unsigned mHeight = 0;
+
+ EGLImageKHR mKHRimage = EGL_NO_IMAGE_KHR;
+
+ GLuint mTextureMap = 0;
+ GLuint mShaderProgram = 0;
+
+ // Opaque handle for a native hardware buffer defined in
+ // frameworks/native/opengl/include/EGL/eglplatform.h
+ ANativeWindow* mWindow;
+
+ // Pointer to a Surface wrapper.
+ android::SurfaceHolderUniquePtr mSurfaceHolder;
+};
+
+} // namespace android::hardware::automotive::evs::V1_1::implementation
+
+#endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_DISPLAY_GLWRAPPER_H
diff --git a/automotive/evs/1.1/default/android.hardware.automotive.evs@1.1-service.rc b/automotive/evs/1.1/default/android.hardware.automotive.evs@1.1-service.rc
index 284b3fd..5d4daf9 100644
--- a/automotive/evs/1.1/default/android.hardware.automotive.evs@1.1-service.rc
+++ b/automotive/evs/1.1/default/android.hardware.automotive.evs@1.1-service.rc
@@ -1,5 +1,8 @@
service vendor.evs-hal-mock /vendor/bin/hw/android.hardware.automotive.evs@1.1-service
class hal
- user automotive_evs
- group automotive_evs
- disabled
+ priority -20
+ user graphics
+ group automotive_evs camera
+ onrestart restart automotive_display
+ onrestart restart evs_manager
+ disabled # will not automatically start with its class; must be explicitly started.
diff --git a/automotive/evs/1.1/default/manifest_android.hardware.automotive.evs@1.1-service.xml b/automotive/evs/1.1/default/manifest_android.hardware.automotive.evs@1.1-service.xml
index d4d9b17..d975701 100644
--- a/automotive/evs/1.1/default/manifest_android.hardware.automotive.evs@1.1-service.xml
+++ b/automotive/evs/1.1/default/manifest_android.hardware.automotive.evs@1.1-service.xml
@@ -15,12 +15,8 @@
-->
<manifest version="1.0" type="device" >
<hal format="hidl">
- <name>android.hardware.automotive.evs</name>
<transport>hwbinder</transport>
- <version>1.1</version>
- <interface>
- <name>IEvsEnumerator</name>
- <instance>hw/0</instance>
- </interface>
+ <name>android.hardware.automotive.evs</name>
+ <fqname>@1.1::IEvsEnumerator/hw/0</fqname>
</hal>
</manifest>
diff --git a/automotive/evs/1.1/default/resources/evs_default_configuration.xml b/automotive/evs/1.1/default/resources/evs_default_configuration.xml
index a79e7c2..6cbc18e 100644
--- a/automotive/evs/1.1/default/resources/evs_default_configuration.xml
+++ b/automotive/evs/1.1/default/resources/evs_default_configuration.xml
@@ -30,31 +30,8 @@
<!-- camera information -->
<camera>
- <!-- camera group starts -->
- <group id='group1' synchronized='APPROXIMATE'>
- <caps>
- <stream id='0' width='640' height='360' format='RGBA_8888' framerate='30'/>
- </caps>
-
- <!-- list of parameters -->
- <characteristics>
- <parameter
- name='REQUEST_AVAILABLE_CAPABILITIES'
- type='enum'
- size='1'
- value='LOGICAL_MULTI_CAMERA'
- />
- <parameter
- name='LOGICAL_MULTI_CAMERA_PHYSICAL_IDS'
- type='byte[]'
- size='1'
- value='/dev/video1'
- />
- </characteristics>
- </group>
-
<!-- camera device starts -->
- <device id='/dev/video1' position='rear'>
+ <device id='/dev/video10' position='rear'>
<caps>
<!-- list of supported controls -->
<supported_controls>
diff --git a/automotive/evs/1.1/default/service.cpp b/automotive/evs/1.1/default/service.cpp
index 374b646..2764a26 100644
--- a/automotive/evs/1.1/default/service.cpp
+++ b/automotive/evs/1.1/default/service.cpp
@@ -14,42 +14,42 @@
* limitations under the License.
*/
-#define LOG_TAG "android.hardware.automotive.evs@1.1-service"
-
-#include <unistd.h>
+#include "EvsDisplay.h"
+#include "EvsEnumerator.h"
+#include "ServiceNames.h"
#include <hidl/HidlTransportSupport.h>
#include <log/log.h>
#include <utils/Errors.h>
#include <utils/StrongPointer.h>
-#include "ServiceNames.h"
-#include "EvsEnumerator.h"
-#include "EvsDisplay.h"
+#include <unistd.h>
-
-// libhidl:
+using android::frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService;
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
-
-// Generated HIDL files
+using android::hardware::automotive::evs::V1_0::DisplayState;
using android::hardware::automotive::evs::V1_1::IEvsEnumerator;
-
-// The namespace in which all our implementation code lives
-using namespace android::hardware::automotive::evs::V1_1::implementation;
-using namespace android;
-
+using android::hardware::automotive::evs::V1_1::implementation::EvsEnumerator;
int main() {
ALOGI("EVS Hardware Enumerator service is starting");
- android::sp<IEvsEnumerator> service = new EvsEnumerator();
+
+ android::sp<IAutomotiveDisplayProxyService> carWindowService =
+ IAutomotiveDisplayProxyService::getService("default");
+ if (carWindowService == nullptr) {
+ ALOGE("Cannot use AutomotiveDisplayProxyService. Exiting.");
+ return EXIT_FAILURE;
+ }
+
+ android::sp<IEvsEnumerator> service = new EvsEnumerator(carWindowService);
configureRpcThreadpool(1, true /* callerWillJoin */);
// Register our service -- if somebody is already registered by our name,
// they will be killed (their thread pool will throw an exception).
- status_t status = service->registerAsService(kEnumeratorServiceName);
- if (status == OK) {
+ auto status = service->registerAsService(kEnumeratorServiceName);
+ if (status == android::OK) {
ALOGD("%s is ready.", kEnumeratorServiceName);
joinRpcThreadpool();
} else {
@@ -58,5 +58,5 @@
// In normal operation, we don't expect the thread pool to exit
ALOGE("EVS Hardware Enumerator is shutting down");
- return 1;
+ return EXIT_SUCCESS;
}
diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsEnumerator.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsEnumerator.aidl
index a79c68d..225b504 100644
--- a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsEnumerator.aidl
+++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsEnumerator.aidl
@@ -44,7 +44,7 @@
android.hardware.automotive.evs.UltrasonicsArrayDesc[] getUltrasonicsArrayList();
boolean isHardware();
android.hardware.automotive.evs.IEvsCamera openCamera(in String cameraId, in android.hardware.automotive.evs.Stream streamCfg);
- android.hardware.automotive.evs.IEvsDisplay openDisplay(in byte id);
+ android.hardware.automotive.evs.IEvsDisplay openDisplay(in int id);
android.hardware.automotive.evs.IEvsUltrasonicsArray openUltrasonicsArray(in String ultrasonicsArrayId);
void registerStatusCallback(in android.hardware.automotive.evs.IEvsEnumeratorStatusCallback callback);
}
diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/IEvsEnumerator.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsEnumerator.aidl
index 8e380e0..8698700 100644
--- a/automotive/evs/aidl/android/hardware/automotive/evs/IEvsEnumerator.aidl
+++ b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsEnumerator.aidl
@@ -146,7 +146,7 @@
* @return EvsDisplay object to be used.
* @throws EvsResult::INVALID_ARG if no display with a given id exists
*/
- IEvsDisplay openDisplay(in byte id);
+ IEvsDisplay openDisplay(in int id);
/**
* Gets the IEvsUltrasonicsArray associated with a ultrasonicsArrayId from a
diff --git a/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h b/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h
index 8bcd867..03a578d 100644
--- a/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h
+++ b/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h
@@ -37,7 +37,7 @@
const ::aidl::android::hardware::automotive::evs::CameraDesc& desc,
std::vector<::aidl::android::hardware::automotive::evs::Stream>* _aidl_return) override;
::ndk::ScopedAStatus openDisplay(
- int8_t displayId,
+ int32_t displayId,
std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay>* obj) override;
::ndk::ScopedAStatus closeDisplay(
const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay>& obj)
diff --git a/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp b/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp
index 2ff6d59..5a81d05 100644
--- a/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp
+++ b/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp
@@ -51,7 +51,7 @@
return ScopedAStatus::ok();
}
-ScopedAStatus DefaultEvsEnumerator::openDisplay(int8_t displayId,
+ScopedAStatus DefaultEvsEnumerator::openDisplay(int32_t displayId,
std::shared_ptr<IEvsDisplay>* obj) {
return ScopedAStatus::ok();
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/UssdModeType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvChargeState.aidl
similarity index 90%
copy from radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/UssdModeType.aidl
copy to automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvChargeState.aidl
index 5395b11..fe1c240 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/UssdModeType.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvChargeState.aidl
@@ -31,13 +31,12 @@
// 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.radio.messaging;
+package android.hardware.automotive.vehicle;
@Backing(type="int") @VintfStability
-enum UssdModeType {
- NOTIFY = 0,
- REQUEST = 1,
- NW_RELEASE = 2,
- LOCAL_CLIENT = 3,
- NOT_SUPPORTED = 4,
- NW_TIMEOUT = 5,
+enum EvChargeState {
+ UNKNOWN = 0,
+ CHARGING = 1,
+ FULLY_CHARGED = 2,
+ NOT_CHARGING = 3,
+ ERROR = 4,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/UssdModeType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl
similarity index 90%
copy from radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/UssdModeType.aidl
copy to automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl
index 5395b11..b869562 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/UssdModeType.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl
@@ -31,13 +31,11 @@
// 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.radio.messaging;
+package android.hardware.automotive.vehicle;
@Backing(type="int") @VintfStability
-enum UssdModeType {
- NOTIFY = 0,
- REQUEST = 1,
- NW_RELEASE = 2,
- LOCAL_CLIENT = 3,
- NOT_SUPPORTED = 4,
- NW_TIMEOUT = 5,
+enum EvRegenerativeBrakingState {
+ UNKNOWN = 0,
+ DISABLED = 1,
+ PARTIALLY_ENABLED = 2,
+ FULLY_ENABLED = 3,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/TrailerState.aidl
similarity index 90%
rename from radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
rename to automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/TrailerState.aidl
index 4f29c0b..2491340 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/TrailerState.aidl
@@ -31,9 +31,11 @@
// 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.radio.network;
-@VintfStability
-parcelable NeighboringCell {
- String cid;
- int rssi;
+package android.hardware.automotive.vehicle;
+@Backing(type="int") @VintfStability
+enum TrailerState {
+ UNKNOWN = 0,
+ NOT_PRESENT = 1,
+ PRESENT = 2,
+ ERROR = 3,
}
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
index bcb63b6..5cd814c 100644
--- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -198,4 +198,11 @@
FRONT_FOG_LIGHTS_SWITCH = 289410876,
REAR_FOG_LIGHTS_STATE = 289410877,
REAR_FOG_LIGHTS_SWITCH = 289410878,
+ EV_CHARGE_CURRENT_DRAW_LIMIT = 291508031,
+ EV_CHARGE_PERCENT_LIMIT = 291508032,
+ EV_CHARGE_STATE = 289410881,
+ EV_CHARGE_SWITCH = 287313730,
+ EV_CHARGE_TIME_REMAINING = 289410883,
+ EV_REGENERATIVE_BRAKING_STATE = 289410884,
+ TRAILER_PRESENT = 289410885,
}
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleUnit.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleUnit.aidl
index 034dec5..c80fdbb 100644
--- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleUnit.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleUnit.aidl
@@ -60,6 +60,7 @@
MILLIWATTS = 99,
AMPERE_HOURS = 100,
KILOWATT_HOUR = 101,
+ AMPERE = 102,
KILOPASCAL = 112,
PSI = 113,
BAR = 114,
diff --git a/automotive/vehicle/aidl/aidl_test/Android.bp b/automotive/vehicle/aidl/aidl_test/Android.bp
index 5284a0a..cb92c6b 100644
--- a/automotive/vehicle/aidl/aidl_test/Android.bp
+++ b/automotive/vehicle/aidl/aidl_test/Android.bp
@@ -26,7 +26,7 @@
"libhidlbase",
],
static_libs: [
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
"android.hardware.automotive.vehicle@2.0",
"libgtest",
"libgmock",
diff --git a/radio/aidl/android/hardware/radio/network/NeighboringCell.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvChargeState.aidl
similarity index 65%
rename from radio/aidl/android/hardware/radio/network/NeighboringCell.aidl
rename to automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvChargeState.aidl
index 270bdee..e095fc4 100644
--- a/radio/aidl/android/hardware/radio/network/NeighboringCell.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvChargeState.aidl
@@ -14,17 +14,20 @@
* limitations under the License.
*/
-package android.hardware.radio.network;
+package android.hardware.automotive.vehicle;
+/**
+ * Used by EV charging properties to enumerate the current state of the battery charging.
+ */
@VintfStability
-parcelable NeighboringCell {
+@Backing(type="int")
+enum EvChargeState {
+ UNKNOWN = 0,
+ CHARGING = 1,
+ FULLY_CHARGED = 2,
+ NOT_CHARGING = 3,
/**
- * Combination of LAC and cell ID in 32 bits in GSM. Upper 16 bits is LAC and lower 16 bits is
- * CID (as described in TS 27.005).
+ * Vehicle not charging due to an error
*/
- String cid;
- /**
- * Received RSSI in GSM, level index of CPICH Received Signal Code Power in UMTS
- */
- int rssi;
+ ERROR = 4,
}
diff --git a/radio/aidl/android/hardware/radio/network/NeighboringCell.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl
similarity index 63%
copy from radio/aidl/android/hardware/radio/network/NeighboringCell.aidl
copy to automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl
index 270bdee..4382287 100644
--- a/radio/aidl/android/hardware/radio/network/NeighboringCell.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-package android.hardware.radio.network;
+package android.hardware.automotive.vehicle;
+/**
+ * Used by the regenerative braking property to enumerate the current state
+ * of the regenerative braking.
+ */
@VintfStability
-parcelable NeighboringCell {
- /**
- * Combination of LAC and cell ID in 32 bits in GSM. Upper 16 bits is LAC and lower 16 bits is
- * CID (as described in TS 27.005).
- */
- String cid;
- /**
- * Received RSSI in GSM, level index of CPICH Received Signal Code Power in UMTS
- */
- int rssi;
+@Backing(type="int")
+enum EvRegenerativeBrakingState {
+ UNKNOWN = 0,
+ DISABLED = 1,
+ PARTIALLY_ENABLED = 2,
+ FULLY_ENABLED = 3,
}
diff --git a/radio/aidl/android/hardware/radio/network/NeighboringCell.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/TrailerState.aidl
similarity index 63%
copy from radio/aidl/android/hardware/radio/network/NeighboringCell.aidl
copy to automotive/vehicle/aidl/android/hardware/automotive/vehicle/TrailerState.aidl
index 270bdee..fd42062 100644
--- a/radio/aidl/android/hardware/radio/network/NeighboringCell.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/TrailerState.aidl
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-package android.hardware.radio.network;
+package android.hardware.automotive.vehicle;
+/**
+ * Used by the trailer present property to enumerate the current state
+ * of the trailer.
+ */
@VintfStability
-parcelable NeighboringCell {
- /**
- * Combination of LAC and cell ID in 32 bits in GSM. Upper 16 bits is LAC and lower 16 bits is
- * CID (as described in TS 27.005).
- */
- String cid;
- /**
- * Received RSSI in GSM, level index of CPICH Received Signal Code Power in UMTS
- */
- int rssi;
+@Backing(type="int")
+enum TrailerState {
+ UNKNOWN = 0,
+ NOT_PRESENT = 1,
+ PRESENT = 2,
+ ERROR = 3,
}
diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl
index 533c7a2..9dbeae2 100644
--- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -2724,4 +2724,95 @@
*/
REAR_FOG_LIGHTS_SWITCH = 0x0F3E + 0x10000000 + 0x01000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
+
+ /**
+ * Indicates the maximum current draw threshold for charging set by the user
+ *
+ * configArray[0] is used to specify the max current draw allowed by
+ * the vehicle in Amperes.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ * @unit VehicleUnit:AMPERE
+ */
+ EV_CHARGE_CURRENT_DRAW_LIMIT = 0x0F3F + 0x10000000 + 0x01000000
+ + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT
+
+ /**
+ * Indicates the maximum charge percent threshold set by the user
+ *
+ * Returns a float value from 0 to 100.
+ *
+ * configArray is used to specify the valid values.
+ * For example, if the vehicle supports the following charge percent limit values:
+ * [20, 40, 60, 80, 100]
+ * then the configArray should be {20, 40, 60, 80, 100}
+ * If the configArray is empty then all values from 0 to 100 must be valid.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ EV_CHARGE_PERCENT_LIMIT = 0x0F40 + 0x10000000 + 0x01000000
+ + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT
+
+ /**
+ * Charging state of the car
+ *
+ * Returns the current charging state of the car.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
+ * @data_enum EvChargeState
+ */
+ EV_CHARGE_STATE = 0x0F41 + 0x10000000 + 0x01000000
+ + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
+
+ /**
+ * Start or stop charging the EV battery
+ *
+ * The setting that the user wants. Setting this property to true starts the battery charging
+ * and setting to false stops charging.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ EV_CHARGE_SWITCH = 0x0F42 + 0x10000000 + 0x01000000
+ + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN
+
+ /**
+ * Estimated charge time remaining in seconds
+ *
+ * Returns 0 if the vehicle is not charging.
+ *
+ * @change_mode VehiclePropertyChangeMode:CONTINUOUS
+ * @access VehiclePropertyAccess:READ
+ * @unit VehicleUnit:SECS
+ */
+ EV_CHARGE_TIME_REMAINING = 0x0F43 + 0x10000000 + 0x01000000
+ + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
+
+ /**
+ * Regenerative braking or one-pedal drive state of the car
+ *
+ * Returns the current state associated with the regenerative braking
+ * setting in the car
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
+ * @data_enum EvRegenerativeBrakingState
+ */
+ EV_REGENERATIVE_BRAKING_STATE = 0x0F44 + 0x10000000 + 0x01000000
+ + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
+
+ /**
+ * Indicates if there is a trailer present or not.
+ *
+ * Returns the trailer state of the car.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
+ * @data_enum TrailerState
+ */
+ TRAILER_PRESENT = 0x0F45 + 0x10000000 + 0x01000000
+ + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
}
diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleUnit.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleUnit.aidl
index 9c3f8f9..3817b74 100644
--- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleUnit.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleUnit.aidl
@@ -51,6 +51,7 @@
MILLIWATTS = 0x63,
AMPERE_HOURS = 0x64,
KILOWATT_HOUR = 0x65,
+ AMPERE = 0x66,
KILOPASCAL = 0x70,
PSI = 0x71,
BAR = 0x72,
diff --git a/automotive/vehicle/aidl/impl/default_config/Android.bp b/automotive/vehicle/aidl/impl/default_config/Android.bp
index 0feaf23..7a98b64 100644
--- a/automotive/vehicle/aidl/impl/default_config/Android.bp
+++ b/automotive/vehicle/aidl/impl/default_config/Android.bp
@@ -24,8 +24,8 @@
local_include_dirs: ["include"],
export_include_dirs: ["include"],
defaults: ["VehicleHalDefaults"],
- static_libs: ["VehicleHalUtils"],
+ static_libs: ["VehicleHalUtilsVendor"],
header_libs: ["VehicleHalTestUtilHeaders"],
- export_static_lib_headers: ["VehicleHalUtils"],
+ export_static_lib_headers: ["VehicleHalUtilsVendor"],
export_header_lib_headers: ["VehicleHalTestUtilHeaders"],
}
diff --git a/automotive/vehicle/aidl/impl/default_config/test/Android.bp b/automotive/vehicle/aidl/impl/default_config/test/Android.bp
index 771472c..0c4a3a4 100644
--- a/automotive/vehicle/aidl/impl/default_config/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/default_config/test/Android.bp
@@ -24,7 +24,7 @@
defaults: ["VehicleHalDefaults"],
srcs: ["*.cpp"],
static_libs: [
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
"libgtest",
],
header_libs: [
diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp
index ab223d3..e6c4ee9 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp
@@ -26,7 +26,7 @@
export_include_dirs: ["include"],
defaults: ["VehicleHalDefaults"],
static_libs: [
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
"FakeObd2Frame",
],
shared_libs: [
diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp
index ac8db44..58f0e98 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp
@@ -24,7 +24,7 @@
srcs: ["*.cpp"],
defaults: ["VehicleHalDefaults"],
static_libs: [
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
"FakeVehicleHalValueGenerators",
"FakeObd2Frame",
],
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp
index dcd9208..49f7671 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp
@@ -39,7 +39,7 @@
],
export_header_lib_headers: ["IVehicleHardware"],
static_libs: [
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
"FakeVehicleHalValueGenerators",
"FakeObd2Frame",
"FakeUserHal",
@@ -47,5 +47,5 @@
shared_libs: [
"libjsoncpp",
],
- export_static_lib_headers: ["VehicleHalUtils"],
+ export_static_lib_headers: ["VehicleHalUtilsVendor"],
}
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp
index 90d1516..9f679bc 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp
@@ -29,7 +29,7 @@
"VehicleHalTestUtilHeaders",
],
static_libs: [
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
"FakeVehicleHardware",
"FakeVehicleHalValueGenerators",
"FakeObd2Frame",
diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp
index c1cee84..c21ad53 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp
@@ -26,7 +26,7 @@
export_include_dirs: ["include"],
defaults: ["VehicleHalDefaults"],
static_libs: [
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
],
- export_static_lib_headers: ["VehicleHalUtils"],
+ export_static_lib_headers: ["VehicleHalUtilsVendor"],
}
diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Android.bp
index 55b8c93..a16185b 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Android.bp
@@ -25,7 +25,7 @@
defaults: ["VehicleHalDefaults"],
static_libs: [
"FakeObd2Frame",
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
],
test_suites: ["device-tests"],
}
diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/userhal/Android.bp
index 2e95531..1689102 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/userhal/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/Android.bp
@@ -26,7 +26,7 @@
export_include_dirs: ["include"],
defaults: ["VehicleHalDefaults"],
static_libs: [
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
],
- export_static_lib_headers: ["VehicleHalUtils"],
+ export_static_lib_headers: ["VehicleHalUtilsVendor"],
}
diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/userhal/test/Android.bp
index 7d0a534..1471ea6 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/userhal/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/test/Android.bp
@@ -25,7 +25,7 @@
defaults: ["VehicleHalDefaults"],
static_libs: [
"FakeUserHal",
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
"libgtest",
"libgmock",
],
diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp
index 7670c25..6209880 100644
--- a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp
+++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp
@@ -34,10 +34,10 @@
shared_libs: ["libprotobuf-cpp-full"],
static_libs: [
"VehicleHalProtos",
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
],
defaults: ["VehicleHalDefaults"],
- export_static_lib_headers: ["VehicleHalUtils"],
+ export_static_lib_headers: ["VehicleHalUtilsVendor"],
}
cc_test {
@@ -51,7 +51,7 @@
static_libs: [
"VehicleHalProtoMessageConverter",
"VehicleHalProtos",
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
"libgtest",
],
header_libs: ["VehicleHalDefaultConfig"],
diff --git a/automotive/vehicle/aidl/impl/utils/common/Android.bp b/automotive/vehicle/aidl/impl/utils/common/Android.bp
index ace505d..88713f1 100644
--- a/automotive/vehicle/aidl/impl/utils/common/Android.bp
+++ b/automotive/vehicle/aidl/impl/utils/common/Android.bp
@@ -19,7 +19,7 @@
}
cc_library {
- name: "VehicleHalUtils",
+ name: "VehicleHalUtilsVendor",
srcs: ["src/*.cpp"],
vendor: true,
local_include_dirs: ["include"],
@@ -27,6 +27,33 @@
defaults: ["VehicleHalDefaults"],
}
+// This is a non-vendor version for VehicleHalUtilsVendor.
+cc_library {
+ name: "VehicleHalUtils",
+ srcs: ["src/*.cpp"],
+ local_include_dirs: ["include"],
+ export_include_dirs: ["include"],
+ static_libs: [
+ "android-automotive-large-parcelable-lib",
+ "android.hardware.automotive.vehicle-V1-ndk",
+ "libmath",
+ ],
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libutils",
+ ],
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ "-Wthread-safety",
+ ],
+ defaults: [
+ "android-automotive-large-parcelable-defaults",
+ ],
+}
+
cc_library_headers {
name: "VehicleHalUtilHeaders",
export_include_dirs: ["include"],
diff --git a/automotive/vehicle/aidl/impl/utils/common/test/Android.bp b/automotive/vehicle/aidl/impl/utils/common/test/Android.bp
index 250b331..bcb3c8d 100644
--- a/automotive/vehicle/aidl/impl/utils/common/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/utils/common/test/Android.bp
@@ -19,11 +19,11 @@
}
cc_test {
- name: "VehicleHalVehicleUtilsTest",
+ name: "VehicleHalVehicleUtilsVendorTest",
srcs: ["*.cpp"],
vendor: true,
static_libs: [
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
"libgtest",
"libgmock",
],
diff --git a/automotive/vehicle/aidl/impl/vhal/Android.bp b/automotive/vehicle/aidl/impl/vhal/Android.bp
index 49f48f7..295cbb7 100644
--- a/automotive/vehicle/aidl/impl/vhal/Android.bp
+++ b/automotive/vehicle/aidl/impl/vhal/Android.bp
@@ -33,7 +33,7 @@
static_libs: [
"DefaultVehicleHal",
"FakeVehicleHardware",
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
],
header_libs: [
"IVehicleHardware",
@@ -58,7 +58,7 @@
"src/SubscriptionManager.cpp",
],
static_libs: [
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
],
header_libs: [
"IVehicleHardware",
diff --git a/automotive/vehicle/aidl/impl/vhal/test/Android.bp b/automotive/vehicle/aidl/impl/vhal/test/Android.bp
index 7122aa5..d89f2c1 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/vhal/test/Android.bp
@@ -24,7 +24,7 @@
srcs: ["*.cpp"],
static_libs: [
"DefaultVehicleHal",
- "VehicleHalUtils",
+ "VehicleHalUtilsVendor",
"libgtest",
"libgmock",
],
diff --git a/biometrics/face/aidl/Android.bp b/biometrics/face/aidl/Android.bp
index fff2c1d..174f1da 100644
--- a/biometrics/face/aidl/Android.bp
+++ b/biometrics/face/aidl/Android.bp
@@ -22,7 +22,6 @@
backend: {
java: {
platform_apis: true,
- srcs_available: true,
},
cpp: {
enabled: false,
diff --git a/bluetooth/audio/2.2/IBluetoothAudioProvider.hal b/bluetooth/audio/2.2/IBluetoothAudioProvider.hal
index f577537..7c91805 100644
--- a/bluetooth/audio/2.2/IBluetoothAudioProvider.hal
+++ b/bluetooth/audio/2.2/IBluetoothAudioProvider.hal
@@ -69,4 +69,12 @@
* encoding.
*/
updateAudioConfiguration(AudioConfiguration audioConfig);
+
+ /**
+ * Called when the supported latency mode is updated.
+ *
+ * @param allowed If the peripheral devices can't keep up with low latency
+ * mode, the API will be called with supported is false.
+ */
+ setLowLatencyModeAllowed(bool allowed);
};
diff --git a/bluetooth/audio/2.2/default/BluetoothAudioProvider.cpp b/bluetooth/audio/2.2/default/BluetoothAudioProvider.cpp
index 202cfb9..62511e9 100644
--- a/bluetooth/audio/2.2/default/BluetoothAudioProvider.cpp
+++ b/bluetooth/audio/2.2/default/BluetoothAudioProvider.cpp
@@ -209,6 +209,18 @@
return Void();
}
+Return<void> BluetoothAudioProvider::setLowLatencyModeAllowed(bool allowed) {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_);
+
+ if (stack_iface_ == nullptr) {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
+ << " has NO session";
+ return Void();
+ }
+ LOG(INFO) << __func__ << " allowed: " << allowed;
+ 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 425ea3b..90c158e 100644
--- a/bluetooth/audio/2.2/default/BluetoothAudioProvider.h
+++ b/bluetooth/audio/2.2/default/BluetoothAudioProvider.h
@@ -56,6 +56,8 @@
Return<void> updateAudioConfiguration(
const AudioConfiguration& audioConfig) override;
+ Return<void> setLowLatencyModeAllowed(bool allowed) override;
+
protected:
sp<BluetoothAudioDeathRecipient> death_recipient_;
diff --git a/bluetooth/audio/aidl/Android.bp b/bluetooth/audio/aidl/Android.bp
index 5107240..52671b8 100644
--- a/bluetooth/audio/aidl/Android.bp
+++ b/bluetooth/audio/aidl/Android.bp
@@ -47,6 +47,7 @@
"//apex_available:platform",
"com.android.bluetooth",
],
+ min_sdk_version: "31",
},
},
}
diff --git a/cas/1.0/Android.bp b/cas/1.0/Android.bp
index 368156a..e27695c 100644
--- a/cas/1.0/Android.bp
+++ b/cas/1.0/Android.bp
@@ -23,4 +23,8 @@
"android.hidl.base@1.0",
],
gen_java: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media",
+ ],
}
diff --git a/cas/1.1/Android.bp b/cas/1.1/Android.bp
index f5b1cc9..1bf9c5f 100644
--- a/cas/1.1/Android.bp
+++ b/cas/1.1/Android.bp
@@ -22,4 +22,8 @@
"android.hidl.base@1.0",
],
gen_java: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media",
+ ],
}
diff --git a/cas/1.2/Android.bp b/cas/1.2/Android.bp
index 6c94020..5468ed0 100644
--- a/cas/1.2/Android.bp
+++ b/cas/1.2/Android.bp
@@ -24,4 +24,8 @@
"android.hidl.base@1.0",
],
gen_java: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media",
+ ],
}
diff --git a/cas/native/1.0/Android.bp b/cas/native/1.0/Android.bp
index 3bb74c1..ef77ab4 100644
--- a/cas/native/1.0/Android.bp
+++ b/cas/native/1.0/Android.bp
@@ -21,4 +21,8 @@
"android.hidl.base@1.0",
],
gen_java: false,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media",
+ ],
}
diff --git a/common/aidl/Android.bp b/common/aidl/Android.bp
index 028c923..549d970 100644
--- a/common/aidl/Android.bp
+++ b/common/aidl/Android.bp
@@ -30,6 +30,7 @@
ndk: {
apex_available: [
"//apex_available:platform",
+ "com.android.bluetooth",
"com.android.media.swcodec",
"com.android.neuralnetworks",
],
diff --git a/common/fmq/aidl/Android.bp b/common/fmq/aidl/Android.bp
index 842a75f..6fd4200 100644
--- a/common/fmq/aidl/Android.bp
+++ b/common/fmq/aidl/Android.bp
@@ -29,6 +29,13 @@
cpp: {
enabled: false,
},
+ ndk: {
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.bluetooth",
+ ],
+ min_sdk_version: "29",
+ },
},
versions: ["1"],
}
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 0cc63a6..f728174 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -382,6 +382,14 @@
<instance>default</instance>
</interface>
</hal>
+ <hal format="aidl" optional="true">
+ <name>android.hardware.input.processor</name>
+ <version>1</version>
+ <interface>
+ <name>IInputProcessor</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
<hal format="hidl" optional="true">
<name>android.hardware.keymaster</name>
<version>3.0</version>
@@ -503,7 +511,7 @@
</hal>
<hal format="aidl" optional="false">
<name>android.hardware.power</name>
- <version>1-3</version>
+ <version>2-3</version>
<interface>
<name>IPower</name>
<instance>default</instance>
diff --git a/contexthub/aidl/Android.bp b/contexthub/aidl/Android.bp
index e9143b5..5926b77 100644
--- a/contexthub/aidl/Android.bp
+++ b/contexthub/aidl/Android.bp
@@ -24,6 +24,7 @@
aidl_interface {
name: "android.hardware.contexthub",
vendor_available: true,
+ host_supported: true,
srcs: ["android/hardware/contexthub/*.aidl"],
stability: "vintf",
backend: {
diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl
index 2135041..16666ef 100644
--- a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl
+++ b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl
@@ -189,9 +189,8 @@
* called, the HAL is expected to clean up any resources attached to the messaging channel
* associated with this host endpoint ID.
*
- * @param hostEndPointId The ID of the host that has disconnected.
- *
- * @throws EX_ILLEGAL_ARGUMENT if hostEndpointId is not associated with a connected host.
+ * @param hostEndPointId The ID of the host that has disconnected. Any invalid values for this
+ * parameter should be ignored (no-op).
*/
void onHostEndpointDisconnected(char hostEndpointId);
diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
index f0583be..3c01c6b 100644
--- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
+++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
@@ -338,8 +338,7 @@
TEST_P(ContextHubAidl, TestInvalidHostConnection) {
constexpr char16_t kHostEndpointId = 1;
- Status status = contextHub->onHostEndpointDisconnected(kHostEndpointId);
- ASSERT_EQ(status.exceptionCode(), android::binder::Status::EX_ILLEGAL_ARGUMENT);
+ ASSERT_TRUE(contextHub->onHostEndpointDisconnected(kHostEndpointId).isOk());
}
std::string PrintGeneratedTest(const testing::TestParamInfo<ContextHubAidl::ParamType>& info) {
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl
index aa514da..01a3b3a 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl
@@ -37,7 +37,7 @@
android.hardware.gnss.GnssMeasurement[] measurements;
android.hardware.gnss.GnssClock clock;
android.hardware.gnss.ElapsedRealtime elapsedRealtime;
- @nullable android.hardware.gnss.GnssData.GnssAgc[] gnssAgcs;
+ android.hardware.gnss.GnssData.GnssAgc[] gnssAgcs = {};
@VintfStability
parcelable GnssAgc {
double agcLevelDb;
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl
index 73df195..69fa32b 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl
@@ -36,7 +36,7 @@
interface IAGnssRil {
void setCallback(in android.hardware.gnss.IAGnssRilCallback callback);
void setRefLocation(in android.hardware.gnss.IAGnssRil.AGnssRefLocation agnssReflocation);
- void setSetId(in android.hardware.gnss.IAGnssRil.SetIDType type, in @utf8InCpp String setid);
+ void setSetId(in android.hardware.gnss.IAGnssRil.SetIdType type, in @utf8InCpp String setid);
void updateNetworkState(in android.hardware.gnss.IAGnssRil.NetworkAttributes attributes);
const int NETWORK_CAPABILITY_NOT_METERED = 1;
const int NETWORK_CAPABILITY_NOT_ROAMING = 2;
@@ -48,7 +48,7 @@
NR_CELLID = 8,
}
@Backing(type="int") @VintfStability
- enum SetIDType {
+ enum SetIdType {
NONE = 0,
IMSI = 1,
MSISDM = 2,
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 a16d27b..5657434 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
@@ -53,9 +53,13 @@
void injectLocation(in android.hardware.gnss.GnssLocation location);
void injectBestLocation(in android.hardware.gnss.GnssLocation location);
void deleteAidingData(in android.hardware.gnss.IGnss.GnssAidingData aidingDataFlags);
- void setPositionMode(in android.hardware.gnss.IGnss.GnssPositionMode mode, in android.hardware.gnss.IGnss.GnssPositionRecurrence recurrence, in int minIntervalMs, in int preferredAccuracyMeters, in int preferredTimeMs, in boolean lowPowerMode);
+ void setPositionMode(in android.hardware.gnss.IGnss.PositionModeOptions options);
android.hardware.gnss.IGnssAntennaInfo getExtensionGnssAntennaInfo();
@nullable android.hardware.gnss.measurement_corrections.IMeasurementCorrectionsInterface getExtensionMeasurementCorrections();
+ void startSvStatus();
+ void stopSvStatus();
+ void startNmea();
+ void stopNmea();
const int ERROR_INVALID_ARGUMENT = 1;
const int ERROR_ALREADY_INIT = 2;
const int ERROR_GENERIC = 3;
@@ -72,18 +76,27 @@
}
@Backing(type="int") @VintfStability
enum GnssAidingData {
- DELETE_EPHEMERIS = 1,
- DELETE_ALMANAC = 2,
- DELETE_POSITION = 4,
- DELETE_TIME = 8,
- DELETE_IONO = 16,
- DELETE_UTC = 32,
- DELETE_HEALTH = 64,
- DELETE_SVDIR = 128,
- DELETE_SVSTEER = 256,
- DELETE_SADATA = 512,
- DELETE_RTI = 1024,
- DELETE_CELLDB_INFO = 32768,
- DELETE_ALL = 65535,
+ EPHEMERIS = 1,
+ ALMANAC = 2,
+ POSITION = 4,
+ TIME = 8,
+ IONO = 16,
+ UTC = 32,
+ HEALTH = 64,
+ SVDIR = 128,
+ SVSTEER = 256,
+ SADATA = 512,
+ RTI = 1024,
+ CELLDB_INFO = 32768,
+ ALL = 65535,
+ }
+ @VintfStability
+ parcelable PositionModeOptions {
+ android.hardware.gnss.IGnss.GnssPositionMode mode;
+ android.hardware.gnss.IGnss.GnssPositionRecurrence recurrence;
+ int minIntervalMs;
+ int preferredAccuracyMeters;
+ int preferredTimeMs;
+ boolean lowPowerMode;
}
}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssDebug.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssDebug.aidl
index 27d9887..8e4b5f2 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssDebug.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssDebug.aidl
@@ -42,13 +42,6 @@
NOT_AVAILABLE = 2,
}
@Backing(type="int") @VintfStability
- enum SatelliteEphemerisSource {
- DEMODULATED = 0,
- SUPL_PROVIDED = 1,
- OTHER_SERVER_PROVIDED = 2,
- OTHER = 3,
- }
- @Backing(type="int") @VintfStability
enum SatelliteEphemerisHealth {
GOOD = 0,
BAD = 1,
@@ -79,7 +72,7 @@
int svid;
android.hardware.gnss.GnssConstellationType constellation;
android.hardware.gnss.IGnssDebug.SatelliteEphemerisType ephemerisType;
- android.hardware.gnss.IGnssDebug.SatelliteEphemerisSource ephemerisSource;
+ android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource ephemerisSource;
android.hardware.gnss.IGnssDebug.SatelliteEphemerisHealth ephemerisHealth;
float ephemerisAgeSeconds;
boolean serverPredictionIsAvailable;
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl
index 8c17841..21a2520 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl
@@ -40,7 +40,19 @@
android.hardware.gnss.SatelliteClockInfo satClockInfo;
double ionoDelayMeters;
double tropoDelayMeters;
+ int TOC;
+ int IODC;
+ int TOE;
+ int IODE;
+ android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource ephemerisSource = android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource.OTHER;
const int HAS_POSITION_VELOCITY_CLOCK_INFO = 1;
const int HAS_IONO = 2;
const int HAS_TROPO = 4;
+ @Backing(type="int") @VintfStability
+ enum SatelliteEphemerisSource {
+ DEMODULATED = 0,
+ SERVER_NORMAL = 1,
+ SERVER_LONG_TERM = 2,
+ OTHER = 3,
+ }
}
diff --git a/gnss/aidl/android/hardware/gnss/GnssData.aidl b/gnss/aidl/android/hardware/gnss/GnssData.aidl
index 204eb65..6b2068e 100644
--- a/gnss/aidl/android/hardware/gnss/GnssData.aidl
+++ b/gnss/aidl/android/hardware/gnss/GnssData.aidl
@@ -76,6 +76,10 @@
* is the primary common use central frequency, e.g. L1 = 1575.45 MHz
* for GPS.
*
+ * If all the GLO frequencies have a common AGC, the FC0 (frequency
+ * channel number 0) of the individual GLO bands is used to represent
+ * all the GLO frequencies.
+ *
* For an L1, L5 receiver tracking a satellite on L1 and L5 at the same
* time, two raw measurement structs must be reported for this same
* satellite, in one of the measurement structs, all the values related
@@ -92,5 +96,5 @@
* GnssMeasurement or GnssClock fields are not reported yet. E.g., when a GNSS signal is too
* weak to be acquired, the AGC value must still be reported.
*/
- @nullable GnssAgc[] gnssAgcs;
+ GnssAgc[] gnssAgcs = {};
}
diff --git a/gnss/aidl/android/hardware/gnss/IAGnssCallback.aidl b/gnss/aidl/android/hardware/gnss/IAGnssCallback.aidl
index 7c25937..8f881b7 100644
--- a/gnss/aidl/android/hardware/gnss/IAGnssCallback.aidl
+++ b/gnss/aidl/android/hardware/gnss/IAGnssCallback.aidl
@@ -23,9 +23,13 @@
@VintfStability
@Backing(type="int")
enum AGnssType {
+ // Secure User Plane Location
SUPL = 1,
+ // CDMA2000
C2K = 2,
+ // SUPL, Emergency call over IP Multimedia Subsystem
SUPL_EIMS = 3,
+ // SUPL, IP Multimedia Subsystem
SUPL_IMS = 4,
}
diff --git a/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl b/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl
index c506b04..b505d81 100644
--- a/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl
+++ b/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl
@@ -17,7 +17,6 @@
package android.hardware.gnss;
import android.hardware.gnss.IAGnssRilCallback;
-import android.hardware.gnss.IAGnssRilCallback.SetIDType;
/**
* Extended interface for AGNSS RIL support. An Assisted GNSS Radio Interface
@@ -46,7 +45,7 @@
/** SET ID type*/
@VintfStability
@Backing(type="int")
- enum SetIDType {
+ enum SetIdType {
NONE = 0,
IMSI = 1,
MSISDM = 2,
@@ -100,7 +99,7 @@
/** Represents network connection status and capabilities. */
@VintfStability
parcelable NetworkAttributes {
- /** Network handle of the network for use with the NDK API. */
+ /** A handle representing this Network. */
long networkHandle;
/**
@@ -151,7 +150,7 @@
* If the type is NONE, then the string must be empty.
*
*/
- void setSetId(in SetIDType type, in @utf8InCpp String setid);
+ void setSetId(in SetIdType type, in @utf8InCpp String setid);
/**
* Notifies GNSS of network status changes.
diff --git a/gnss/aidl/android/hardware/gnss/IAGnssRilCallback.aidl b/gnss/aidl/android/hardware/gnss/IAGnssRilCallback.aidl
index 6fb093e..485626d 100644
--- a/gnss/aidl/android/hardware/gnss/IAGnssRilCallback.aidl
+++ b/gnss/aidl/android/hardware/gnss/IAGnssRilCallback.aidl
@@ -25,7 +25,7 @@
/**
* The Hal uses this API to request a SET ID.
*
- * @param setIdflag A bitfield of IAGnssRil.SetIDType that is required by
+ * @param setIdflag A bitfield of IAGnssRil.SetIdType that is required by
* the HAL. The framework will inject an empty SET ID if the flag is NONE.
*
*/
diff --git a/gnss/aidl/android/hardware/gnss/IGnss.aidl b/gnss/aidl/android/hardware/gnss/IGnss.aidl
index 99f2ee4..12fdbb4 100644
--- a/gnss/aidl/android/hardware/gnss/IGnss.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnss.aidl
@@ -81,19 +81,19 @@
@VintfStability
@Backing(type="int")
enum GnssAidingData {
- DELETE_EPHEMERIS = 0x0001,
- DELETE_ALMANAC = 0x0002,
- DELETE_POSITION = 0x0004,
- DELETE_TIME = 0x0008,
- DELETE_IONO = 0x0010,
- DELETE_UTC = 0x0020,
- DELETE_HEALTH = 0x0040,
- DELETE_SVDIR = 0x0080,
- DELETE_SVSTEER = 0x0100,
- DELETE_SADATA = 0x0200,
- DELETE_RTI = 0x0400,
- DELETE_CELLDB_INFO = 0x8000,
- DELETE_ALL = 0xFFFF
+ EPHEMERIS = 0x0001,
+ ALMANAC = 0x0002,
+ POSITION = 0x0004,
+ TIME = 0x0008,
+ IONO = 0x0010,
+ UTC = 0x0020,
+ HEALTH = 0x0040,
+ SVDIR = 0x0080,
+ SVSTEER = 0x0100,
+ SADATA = 0x0200,
+ RTI = 0x0400,
+ CELLDB_INFO = 0x8000,
+ ALL = 0xFFFF
}
/**
@@ -256,37 +256,56 @@
/**
* Specifies that the next call to start will not use the information defined in the flags.
- * GnssAidingData value of DELETE_ALL is passed for a cold start.
+ * GnssAidingData value of GnssAidingData::ALL is passed for a cold start.
*
* @param aidingDataFlags Flags specifying the aiding data to be deleted.
*/
void deleteAidingData(in GnssAidingData aidingDataFlags);
/**
+ * Options used in the setPositionMode() call for specifying the GNSS engine behavior.
+ */
+ @VintfStability
+ parcelable PositionModeOptions {
+ /**
+ * Must be one of MS_BASED or STANDALONE. It is allowed by the platform (and it is
+ * recommended) to fallback to MS_BASED if MS_ASSISTED is passed in, and MS_BASED is
+ * supported.
+ */
+ GnssPositionMode mode;
+
+ /* Recurrence GNSS position recurrence value, either periodic or single. */
+ GnssPositionRecurrence recurrence;
+
+ /* Represents the time between fixes in milliseconds. */
+ int minIntervalMs;
+
+ /* Represents the requested fix accuracy in meters. */
+ int preferredAccuracyMeters;
+
+ /* Represents the requested time to first fix in milliseconds. */
+ int preferredTimeMs;
+
+ /**
+ * When true, and IGnss is the only client to the GNSS hardware, the GNSS hardware must make
+ * strong tradeoffs to substantially restrict power use. Specifically, in the case of a
+ * several second long minIntervalMs, the GNSS hardware must not, on average, run power
+ * hungry operations like RF and signal searches for more than one second per interval, and
+ * must make exactly one call to gnssSvStatusCb(), and either zero or one call to
+ * GnssLocationCb() at each interval. When false, HAL must operate in the nominal mode and
+ * is expected to make power and performance tradoffs such as duty-cycling when signal
+ * conditions are good and more active searches to reacquire GNSS signals when no signals
+ * are present. When there are additional clients using the GNSS hardware other than IGnss,
+ * the GNSS hardware may operate in a higher power mode, on behalf of those clients.
+ */
+ boolean lowPowerMode;
+ }
+
+ /**
* Sets the GnssPositionMode parameter, its associated recurrence value, the time between fixes,
* requested fix accuracy, time to first fix.
- *
- * @param mode Parameter must be one of MS_BASED or STANDALONE. It is allowed by the platform
- * (and it is recommended) to fallback to MS_BASED if MS_ASSISTED is passed in, and MS_BASED
- * is supported.
- * @param recurrence GNSS position recurrence value, either periodic or single.
- * @param minIntervalMs Represents the time between fixes in milliseconds.
- * @param preferredAccuracyMeters Represents the requested fix accuracy in meters.
- * @param preferredTimeMs Represents the requested time to first fix in milliseconds.
- * @param lowPowerMode When true, and IGnss is the only client to the GNSS hardware, the GNSS
- * hardware must make strong tradeoffs to substantially restrict power use. Specifically, in
- * the case of a several second long minIntervalMs, the GNSS hardware must not, on average,
- * run power hungry operations like RF and signal searches for more than one second per
- * interval, and must make exactly one call to gnssSvStatusCb(), and either zero or one call
- * to GnssLocationCb() at each interval. When false, HAL must operate in the nominal mode
- * and is expected to make power and performance tradoffs such as duty-cycling when signal
- * conditions are good and more active searches to reacquire GNSS signals when no signals
- * are present. When there are additional clients using the GNSS hardware other than IGnss,
- * the GNSS hardware may operate in a higher power mode, on behalf of those clients.
*/
- void setPositionMode(in GnssPositionMode mode, in GnssPositionRecurrence recurrence,
- in int minIntervalMs, in int preferredAccuracyMeters, in int preferredTimeMs,
- in boolean lowPowerMode);
+ void setPositionMode(in PositionModeOptions options);
/*
* This method returns the IGnssAntennaInfo.
@@ -301,4 +320,25 @@
* @return Handle to the IMeasurementCorrectionsInterface.
*/
@nullable IMeasurementCorrectionsInterface getExtensionMeasurementCorrections();
+
+ /**
+ * Starts a SvStatus output stream using the IGnssCallback gnssSvStatusCb().
+ */
+ void startSvStatus();
+
+ /**
+ * Stops the SvStatus output stream.
+ */
+ void stopSvStatus();
+
+ /**
+ * Starts an NMEA (National Marine Electronics Association) output stream using the
+ * IGnssCallback gnssNmeaCb().
+ */
+ void startNmea();
+
+ /**
+ * Stops the NMEA output stream.
+ */
+ void stopNmea();
}
diff --git a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl
index a74d097..866606f 100644
--- a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl
@@ -202,6 +202,10 @@
/**
* Callback for the HAL to pass a vector of GnssSvInfo back to the client.
*
+ * If GnssMeasurement is registered, the SvStatus report interval is the same as the measurement
+ * interval, i.e., the interval the measurement engine runs at. If GnssMeasurement is not
+ * registered, the SvStatus interval is the same as the location interval.
+ *
* @param svInfo SV status information from HAL.
*/
void gnssSvStatusCb(in GnssSvInfo[] svInfoList);
diff --git a/gnss/aidl/android/hardware/gnss/IGnssDebug.aidl b/gnss/aidl/android/hardware/gnss/IGnssDebug.aidl
index 475a4a3..3071dce5 100644
--- a/gnss/aidl/android/hardware/gnss/IGnssDebug.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnssDebug.aidl
@@ -17,6 +17,7 @@
package android.hardware.gnss;
import android.hardware.gnss.GnssConstellationType;
+import android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource;
/**
* Extended interface for GNSS Debug support
@@ -35,16 +36,6 @@
NOT_AVAILABLE = 2,
}
- /** Satellite's ephemeris source */
- @VintfStability
- @Backing(type="int")
- enum SatelliteEphemerisSource {
- DEMODULATED = 0,
- SUPL_PROVIDED = 1,
- OTHER_SERVER_PROVIDED = 2,
- OTHER = 3,
- }
-
/** Satellite's ephemeris health */
@VintfStability
@Backing(type="int")
diff --git a/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl b/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl
index a238e3f..e79249d 100644
--- a/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl
+++ b/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl
@@ -74,4 +74,62 @@
/** Tropospheric delay in meters. */
double tropoDelayMeters;
+
+ /**
+ * Time of Clock.
+ *
+ * This is defined in GPS ICD200 documentation
+ * (e.g., https://www.gps.gov/technical/icwg/IS-GPS-200H.pdf).
+ */
+ int TOC;
+
+ /**
+ * Issue of Data, Clock.
+ *
+ * This is defined in GPS ICD200 documentation
+ * (e.g., https://www.gps.gov/technical/icwg/IS-GPS-200H.pdf).
+ *
+ * The field must be set to 0 if it is not supported.
+ */
+ int IODC;
+
+ /**
+ * Time of Ephemeris.
+ *
+ * This is defined in GPS ICD200 documentation
+ * (e.g., https://www.gps.gov/technical/icwg/IS-GPS-200H.pdf).
+ */
+ int TOE;
+
+ /**
+ * Issue of Data, Ephemeris.
+ *
+ * This is defined in GPS ICD200 documentation
+ * (e.g., https://www.gps.gov/technical/icwg/IS-GPS-200H.pdf).
+ *
+ * The field must be set to 0 if it is not supported.
+ */
+ int IODE;
+
+ /** Satellite's ephemeris source */
+ @VintfStability
+ @Backing(type="int")
+ enum SatelliteEphemerisSource {
+ // Demodulated from broadcast signals
+ DEMODULATED = 0,
+ // Server provided Normal type ephemeris data, which is similar to broadcast ephemeris in
+ // longevity (e.g. SUPL) - lasting for few hours and providing satellite orbit and clock
+ // with accuracy of 1 - 2 meters.
+ SERVER_NORMAL = 1,
+ // Server provided Long-Term type ephemeris data, which lasts for many hours to several days
+ // and often provides satellite orbit and clock accuracy of 2 - 20 meters.
+ SERVER_LONG_TERM = 2,
+ // Other source
+ OTHER = 3,
+ }
+
+ /**
+ * Source of the ephemeris.
+ */
+ SatelliteEphemerisSource ephemerisSource = SatelliteEphemerisSource.OTHER;
}
diff --git a/gnss/aidl/default/AGnssRil.cpp b/gnss/aidl/default/AGnssRil.cpp
index afe0039..2aa1abc 100644
--- a/gnss/aidl/default/AGnssRil.cpp
+++ b/gnss/aidl/default/AGnssRil.cpp
@@ -41,7 +41,7 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus AGnssRil::setSetId(SetIDType type, const std::string& setid) {
+ndk::ScopedAStatus AGnssRil::setSetId(SetIdType type, const std::string& setid) {
ALOGD("AGnssRil::setSetId: type:%s, setid: %s", toString(type).c_str(), setid.c_str());
return ndk::ScopedAStatus::ok();
}
diff --git a/gnss/aidl/default/AGnssRil.h b/gnss/aidl/default/AGnssRil.h
index 7e429ee..e205b69 100644
--- a/gnss/aidl/default/AGnssRil.h
+++ b/gnss/aidl/default/AGnssRil.h
@@ -24,7 +24,7 @@
public:
ndk::ScopedAStatus setCallback(const std::shared_ptr<IAGnssRilCallback>& callback) override;
ndk::ScopedAStatus setRefLocation(const AGnssRefLocation& agnssReflocation) override;
- ndk::ScopedAStatus setSetId(SetIDType type, const std::string& setid) override;
+ ndk::ScopedAStatus setSetId(SetIdType type, const std::string& setid) override;
ndk::ScopedAStatus updateNetworkState(const NetworkAttributes& attributes) override;
private:
diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp
index 73f4085..af1dd5c 100644
--- a/gnss/aidl/default/Gnss.cpp
+++ b/gnss/aidl/default/Gnss.cpp
@@ -87,15 +87,13 @@
mIsActive = true;
this->reportGnssStatusValue(IGnssCallback::GnssStatusValue::SESSION_BEGIN);
mThread = std::thread([this]() {
- auto svStatus = filterBlocklistedSatellites(Utils::getMockSvInfoList());
- this->reportSvStatus(svStatus);
+ this->reportSvStatus();
if (!mFirstFixReceived) {
std::this_thread::sleep_for(std::chrono::milliseconds(TTFF_MILLIS));
mFirstFixReceived = true;
}
while (mIsActive == true) {
- auto svStatus = filterBlocklistedSatellites(Utils::getMockSvInfoList());
- this->reportSvStatus(svStatus);
+ this->reportSvStatus();
auto currentLocation = getLocationFromHW();
mGnssPowerIndication->notePowerConsumption();
@@ -124,6 +122,13 @@
return;
}
+void Gnss::reportSvStatus() const {
+ if (mIsSvStatusActive) {
+ auto svStatus = filterBlocklistedSatellites(Utils::getMockSvInfoList());
+ reportSvStatus(svStatus);
+ }
+}
+
void Gnss::reportSvStatus(const std::vector<GnssSvInfo>& svInfoList) const {
std::unique_lock<std::mutex> lock(mMutex);
if (sGnssCallback == nullptr) {
@@ -136,7 +141,8 @@
}
}
-std::vector<GnssSvInfo> Gnss::filterBlocklistedSatellites(std::vector<GnssSvInfo> gnssSvInfoList) {
+std::vector<GnssSvInfo> Gnss::filterBlocklistedSatellites(
+ std::vector<GnssSvInfo> gnssSvInfoList) const {
ALOGD("filterBlocklistedSatellites");
for (uint32_t i = 0; i < gnssSvInfoList.size(); i++) {
if (mGnssConfiguration->isBlocklisted(gnssSvInfoList[i])) {
@@ -168,6 +174,26 @@
return ScopedAStatus::ok();
}
+ScopedAStatus Gnss::startSvStatus() {
+ ALOGD("startSvStatus");
+ mIsSvStatusActive = true;
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus Gnss::stopSvStatus() {
+ ALOGD("stopSvStatus");
+ mIsSvStatusActive = false;
+ return ScopedAStatus::ok();
+}
+ScopedAStatus Gnss::startNmea() {
+ ALOGD("startNmea");
+ return ScopedAStatus::ok();
+}
+ScopedAStatus Gnss::stopNmea() {
+ ALOGD("stopNmea");
+ return ScopedAStatus::ok();
+}
+
ScopedAStatus Gnss::close() {
ALOGD("close");
sGnssCallback = nullptr;
@@ -210,11 +236,10 @@
return ScopedAStatus::ok();
}
-ScopedAStatus Gnss::setPositionMode(GnssPositionMode, GnssPositionRecurrence, int minIntervalMs,
- int /* preferredAccuracyMeters */, int /* preferredTimeMs */,
- bool lowPowerMode) {
- ALOGD("setPositionMode. minIntervalMs:%d, lowPowerMode:%d", minIntervalMs, (int)lowPowerMode);
- mMinIntervalMs = minIntervalMs;
+ScopedAStatus Gnss::setPositionMode(const PositionModeOptions& options) {
+ ALOGD("setPositionMode. minIntervalMs:%d, lowPowerMode:%d", options.minIntervalMs,
+ (int)options.lowPowerMode);
+ mMinIntervalMs = options.minIntervalMs;
return ScopedAStatus::ok();
}
diff --git a/gnss/aidl/default/Gnss.h b/gnss/aidl/default/Gnss.h
index 36874b8..1489b4b 100644
--- a/gnss/aidl/default/Gnss.h
+++ b/gnss/aidl/default/Gnss.h
@@ -50,9 +50,11 @@
ndk::ScopedAStatus injectLocation(const GnssLocation& location) override;
ndk::ScopedAStatus injectBestLocation(const GnssLocation& location) override;
ndk::ScopedAStatus deleteAidingData(GnssAidingData aidingDataFlags) override;
- ndk::ScopedAStatus setPositionMode(GnssPositionMode mode, GnssPositionRecurrence recurrence,
- int minIntervalMs, int preferredAccuracyMeters,
- int preferredTimeMs, bool lowPowerMode) override;
+ ndk::ScopedAStatus setPositionMode(const PositionModeOptions& options) override;
+ ndk::ScopedAStatus startSvStatus() override;
+ ndk::ScopedAStatus stopSvStatus() override;
+ ndk::ScopedAStatus startNmea() override;
+ ndk::ScopedAStatus stopNmea() override;
ndk::ScopedAStatus getExtensionPsds(std::shared_ptr<IGnssPsds>* iGnssPsds) override;
ndk::ScopedAStatus getExtensionGnssConfiguration(
@@ -85,9 +87,10 @@
private:
void reportLocation(const GnssLocation&) const;
+ void reportSvStatus() const;
void reportSvStatus(const std::vector<IGnssCallback::GnssSvInfo>& svInfoList) const;
std::vector<IGnssCallback::GnssSvInfo> filterBlocklistedSatellites(
- std::vector<IGnssCallback::GnssSvInfo> gnssSvInfoList);
+ std::vector<IGnssCallback::GnssSvInfo> gnssSvInfoList) const;
void reportGnssStatusValue(const IGnssCallback::GnssStatusValue gnssStatusValue) const;
std::unique_ptr<GnssLocation> getLocationFromHW();
@@ -95,6 +98,7 @@
std::atomic<long> mMinIntervalMs;
std::atomic<bool> mIsActive;
+ std::atomic<bool> mIsSvStatusActive;
std::atomic<bool> mFirstFixReceived;
std::thread mThread;
diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp
index 13c32ee..c1128ba 100644
--- a/gnss/aidl/vts/gnss_hal_test.cpp
+++ b/gnss/aidl/vts/gnss_hal_test.cpp
@@ -79,9 +79,14 @@
const int kPreferredAccuracy = 0; // Ideally perfect (matches GnssLocationProvider)
const int kPreferredTimeMsec = 0; // Ideally immediate
- auto status = aidl_gnss_hal_->setPositionMode(
- IGnss::GnssPositionMode::MS_BASED, IGnss::GnssPositionRecurrence::RECURRENCE_PERIODIC,
- min_interval_msec, kPreferredAccuracy, kPreferredTimeMsec, low_power_mode);
+ IGnss::PositionModeOptions options;
+ options.mode = IGnss::GnssPositionMode::MS_BASED;
+ options.recurrence = IGnss::GnssPositionRecurrence::RECURRENCE_PERIODIC;
+ options.minIntervalMs = min_interval_msec;
+ options.preferredAccuracyMeters = kPreferredAccuracy;
+ options.preferredTimeMs = kPreferredTimeMsec;
+ options.lowPowerMode = low_power_mode;
+ auto status = aidl_gnss_hal_->setPositionMode(options);
ASSERT_TRUE(status.isOk());
}
@@ -95,9 +100,11 @@
}
SetPositionMode(min_interval_msec, low_power_mode);
- auto result = aidl_gnss_hal_->start();
+ auto status = aidl_gnss_hal_->start();
+ EXPECT_TRUE(status.isOk());
- EXPECT_TRUE(result.isOk());
+ status = aidl_gnss_hal_->startSvStatus();
+ EXPECT_TRUE(status.isOk());
/*
* GnssLocationProvider support of AGPS SUPL & XtraDownloader is not available in VTS,
@@ -124,8 +131,10 @@
// Invoke the super method.
return GnssHalTestTemplate<IGnss_V2_1>::StopAndClearLocations();
}
+ auto status = aidl_gnss_hal_->stopSvStatus();
+ EXPECT_TRUE(status.isOk());
- auto status = aidl_gnss_hal_->stop();
+ status = aidl_gnss_hal_->stop();
EXPECT_TRUE(status.isOk());
/*
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 1fa6825..8e51b44 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -102,7 +102,7 @@
}
}
-void CheckSatellitePvt(const SatellitePvt& satellitePvt) {
+void CheckSatellitePvt(const SatellitePvt& satellitePvt, const int interfaceVersion) {
const double kMaxOrbitRadiusMeters = 43000000.0;
const double kMaxVelocityMps = 4000.0;
// The below values are determined using GPS ICD Table 20-1
@@ -147,6 +147,14 @@
ALOGD("Found HAS_TROPO");
ASSERT_TRUE(satellitePvt.tropoDelayMeters > 0 && satellitePvt.tropoDelayMeters < 100);
}
+ if (interfaceVersion >= 2) {
+ ASSERT_TRUE(satellitePvt.TOC >= 0 && satellitePvt.TOC <= 604784);
+ ASSERT_TRUE(satellitePvt.TOE >= 0 && satellitePvt.TOE <= 604784);
+ // IODC has 10 bits
+ ASSERT_TRUE(satellitePvt.IODC >= 0 && satellitePvt.IODC <= 1023);
+ // IODE has 8 bits
+ ASSERT_TRUE(satellitePvt.IODE >= 0 && satellitePvt.IODE <= 255);
+ }
}
void CheckGnssMeasurementClockFields(const GnssData& measurement) {
@@ -226,7 +234,7 @@
kIsSatellitePvtSupported == true) {
ALOGD("Found a measurement with SatellitePvt");
satellitePvtFound = true;
- CheckSatellitePvt(measurement.satellitePvt);
+ CheckSatellitePvt(measurement.satellitePvt, aidl_gnss_hal_->getInterfaceVersion());
}
}
}
@@ -337,7 +345,7 @@
auto powerStats1 = gnssPowerIndicationCallback->last_gnss_power_stats_;
// Get a location and request another GnssPowerStats
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
gnss_cb_->location_cbq_.reset();
} else {
aidl_gnss_cb_->location_cbq_.reset();
@@ -416,18 +424,18 @@
const int kLocationsToAwait = 3;
const int kRetriesToUnBlocklist = 10;
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
gnss_cb_->location_cbq_.reset();
} else {
aidl_gnss_cb_->location_cbq_.reset();
}
StartAndCheckLocations(kLocationsToAwait);
- int location_called_count = (aidl_gnss_hal_->getInterfaceVersion() == 1)
+ int location_called_count = (aidl_gnss_hal_->getInterfaceVersion() <= 1)
? gnss_cb_->location_cbq_.calledCount()
: aidl_gnss_cb_->location_cbq_.calledCount();
// Tolerate 1 less sv status to handle edge cases in reporting.
- int sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() == 1)
+ int sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() <= 1)
? gnss_cb_->sv_info_list_cbq_.size()
: aidl_gnss_cb_->sv_info_list_cbq_.size();
EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait);
@@ -442,7 +450,7 @@
const int kGnssSvInfoListTimeout = 2;
BlocklistedSource source_to_blocklist;
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
std::list<hidl_vec<IGnssCallback_2_1::GnssSvInfo>> sv_info_vec_list;
int count = gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec_list, sv_info_list_cbq_size,
kGnssSvInfoListTimeout);
@@ -480,7 +488,7 @@
ASSERT_TRUE(status.isOk());
// retry and ensure satellite not used
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
gnss_cb_->sv_info_list_cbq_.reset();
gnss_cb_->location_cbq_.reset();
} else {
@@ -491,7 +499,7 @@
StartAndCheckLocations(kLocationsToAwait);
// early exit if test is being run with insufficient signal
- location_called_count = (aidl_gnss_hal_->getInterfaceVersion() == 1)
+ location_called_count = (aidl_gnss_hal_->getInterfaceVersion() <= 1)
? gnss_cb_->location_cbq_.calledCount()
: aidl_gnss_cb_->location_cbq_.calledCount();
if (location_called_count == 0) {
@@ -500,14 +508,14 @@
ASSERT_TRUE(location_called_count > 0);
// Tolerate 1 less sv status to handle edge cases in reporting.
- sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() == 1)
+ sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() <= 1)
? gnss_cb_->sv_info_list_cbq_.size()
: aidl_gnss_cb_->sv_info_list_cbq_.size();
EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait);
ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations (%d received)",
sv_info_list_cbq_size, kLocationsToAwait, location_called_count);
for (int i = 0; i < sv_info_list_cbq_size; ++i) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
hidl_vec<IGnssCallback_2_1::GnssSvInfo> sv_info_vec;
gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout);
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
@@ -542,7 +550,7 @@
while (!strongest_sv_is_reobserved && (unblocklist_loops_remaining-- > 0)) {
StopAndClearLocations();
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
gnss_cb_->sv_info_list_cbq_.reset();
gnss_cb_->location_cbq_.reset();
} else {
@@ -552,7 +560,7 @@
StartAndCheckLocations(kLocationsToAwait);
// early exit loop if test is being run with insufficient signal
- location_called_count = (aidl_gnss_hal_->getInterfaceVersion() == 1)
+ location_called_count = (aidl_gnss_hal_->getInterfaceVersion() <= 1)
? gnss_cb_->location_cbq_.calledCount()
: aidl_gnss_cb_->location_cbq_.calledCount();
if (location_called_count == 0) {
@@ -561,7 +569,7 @@
ASSERT_TRUE(location_called_count > 0);
// Tolerate 1 less sv status to handle edge cases in reporting.
- sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() == 1)
+ sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() <= 1)
? gnss_cb_->sv_info_list_cbq_.size()
: aidl_gnss_cb_->sv_info_list_cbq_.size();
EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait);
@@ -570,7 +578,7 @@
sv_info_list_cbq_size, kLocationsToAwait, unblocklist_loops_remaining);
for (int i = 0; i < sv_info_list_cbq_size; ++i) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
hidl_vec<IGnssCallback_2_1::GnssSvInfo> sv_info_vec;
gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout);
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
@@ -655,7 +663,7 @@
ASSERT_TRUE(status.isOk());
// retry and ensure constellation not used
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
gnss_cb_->sv_info_list_cbq_.reset();
gnss_cb_->location_cbq_.reset();
} else {
@@ -665,14 +673,14 @@
StartAndCheckLocations(kLocationsToAwait);
// Tolerate 1 less sv status to handle edge cases in reporting.
- int sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() == 1)
+ int sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() <= 1)
? gnss_cb_->sv_info_list_cbq_.size()
: aidl_gnss_cb_->sv_info_list_cbq_.size();
EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait);
ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations", sv_info_list_cbq_size,
kLocationsToAwait);
for (int i = 0; i < sv_info_list_cbq_size; ++i) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
hidl_vec<IGnssCallback_2_1::GnssSvInfo> sv_info_vec;
gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout);
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
@@ -758,7 +766,7 @@
StopAndClearLocations();
// retry and ensure constellation not used
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
gnss_cb_->sv_info_list_cbq_.reset();
gnss_cb_->location_cbq_.reset();
} else {
@@ -768,14 +776,14 @@
StartAndCheckLocations(kLocationsToAwait);
// Tolerate 1 less sv status to handle edge cases in reporting.
- int sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() == 1)
+ int sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() <= 1)
? gnss_cb_->sv_info_list_cbq_.size()
: aidl_gnss_cb_->sv_info_list_cbq_.size();
EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait);
ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations", sv_info_list_cbq_size,
kLocationsToAwait);
for (int i = 0; i < sv_info_list_cbq_size; ++i) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
hidl_vec<IGnssCallback_2_1::GnssSvInfo> sv_info_vec;
gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout);
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
@@ -813,7 +821,7 @@
* TestAllExtensions.
*/
TEST_P(GnssHalTest, TestAllExtensions) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
return;
}
@@ -855,7 +863,7 @@
* 3. Sets SUPL server host/port.
*/
TEST_P(GnssHalTest, TestAGnssExtension) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
return;
}
sp<IAGnss> iAGnss;
@@ -879,7 +887,7 @@
* 3. Sets reference location.
*/
TEST_P(GnssHalTest, TestAGnssRilExtension) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
return;
}
sp<IAGnssRil> iAGnssRil;
@@ -913,7 +921,7 @@
* Ensures that GnssDebug values make sense.
*/
TEST_P(GnssHalTest, GnssDebugValuesSanityTest) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
return;
}
sp<IGnssDebug> iGnssDebug;
@@ -962,7 +970,7 @@
* 3. Sets proxy apps
*/
TEST_P(GnssHalTest, TestGnssVisibilityControlExtension) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
return;
}
sp<IGnssVisibilityControl> iGnssVisibilityControl;
@@ -986,7 +994,7 @@
* and verifies mandatory fields are valid.
*/
TEST_P(GnssHalTest, TestGnssMeasurementSetCallbackWithOptions) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
return;
}
const int kFirstGnssMeasurementTimeoutSeconds = 10;
@@ -1024,7 +1032,7 @@
* 2. Sets a GnssMeasurementCallback, waits for a measurement.
*/
TEST_P(GnssHalTest, TestGnssAgcInGnssMeasurement) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
return;
}
const int kFirstGnssMeasurementTimeoutSeconds = 10;
@@ -1050,10 +1058,9 @@
// Validity check GnssData fields
CheckGnssMeasurementClockFields(lastMeasurement);
- ASSERT_TRUE(lastMeasurement.gnssAgcs.has_value());
- for (const auto& gnssAgc : lastMeasurement.gnssAgcs.value()) {
- ASSERT_TRUE(gnssAgc.has_value());
- ASSERT_TRUE(gnssAgc.value().carrierFrequencyHz >= 0);
+ ASSERT_TRUE(lastMeasurement.gnssAgcs.size() > 0);
+ for (const auto& gnssAgc : lastMeasurement.gnssAgcs) {
+ ASSERT_TRUE(gnssAgc.carrierFrequencyHz >= 0);
}
}
@@ -1071,7 +1078,7 @@
TEST_P(GnssHalTest, TestGnssAntennaInfo) {
const int kAntennaInfoTimeoutSeconds = 2;
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
return;
}
@@ -1149,7 +1156,7 @@
* capability flag is set.
*/
TEST_P(GnssHalTest, TestGnssMeasurementCorrections) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
return;
}
if (!(aidl_gnss_cb_->last_capabilities_ &
diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp
index 1ff84eb..4e6a718 100644
--- a/gnss/common/utils/default/Utils.cpp
+++ b/gnss/common/utils/default/Utils.cpp
@@ -32,6 +32,7 @@
using aidl::android::hardware::gnss::GnssLocation;
using aidl::android::hardware::gnss::GnssMeasurement;
using aidl::android::hardware::gnss::IGnss;
+using aidl::android::hardware::gnss::IGnssDebug;
using aidl::android::hardware::gnss::IGnssMeasurementCallback;
using aidl::android::hardware::gnss::SatellitePvt;
using GnssSvInfo = aidl::android::hardware::gnss::IGnssCallback::GnssSvInfo;
@@ -181,21 +182,30 @@
.fullInterSignalBiasUncertaintyNs = 792.0,
.satelliteInterSignalBiasNs = 233.9,
.satelliteInterSignalBiasUncertaintyNs = 921.2,
- .satellitePvt = {.flags = SatellitePvt::HAS_POSITION_VELOCITY_CLOCK_INFO |
- SatellitePvt::HAS_IONO | SatellitePvt::HAS_TROPO,
- .satPosEcef = {.posXMeters = 10442993.1153328,
- .posYMeters = -19926932.8051666,
- .posZMeters = -12034295.0216203,
- .ureMeters = 1000.2345678},
- .satVelEcef = {.velXMps = -478.667183715732,
- .velYMps = 1580.68371984114,
- .velZMps = -3030.52994449997,
- .ureRateMps = 10.2345678},
- .satClockInfo = {.satHardwareCodeBiasMeters = 1.396983861923e-09,
- .satTimeCorrectionMeters = -7113.08964331,
- .satClkDriftMps = 0},
- .ionoDelayMeters = 3.069949602639317e-08,
- .tropoDelayMeters = 3.882265204404031},
+ .satellitePvt =
+ {
+ .flags = SatellitePvt::HAS_POSITION_VELOCITY_CLOCK_INFO |
+ SatellitePvt::HAS_IONO | SatellitePvt::HAS_TROPO,
+ .satPosEcef = {.posXMeters = 10442993.1153328,
+ .posYMeters = -19926932.8051666,
+ .posZMeters = -12034295.0216203,
+ .ureMeters = 1000.2345678},
+ .satVelEcef = {.velXMps = -478.667183715732,
+ .velYMps = 1580.68371984114,
+ .velZMps = -3030.52994449997,
+ .ureRateMps = 10.2345678},
+ .satClockInfo = {.satHardwareCodeBiasMeters = 1.396983861923e-09,
+ .satTimeCorrectionMeters = -7113.08964331,
+ .satClkDriftMps = 0},
+ .ionoDelayMeters = 3.069949602639317e-08,
+ .tropoDelayMeters = 3.882265204404031,
+ .ephemerisSource =
+ SatellitePvt::SatelliteEphemerisSource::SERVER_LONG_TERM,
+ .TOC = 12345,
+ .IODC = 143,
+ .TOE = 9876,
+ .IODE = 48,
+ },
.correlationVectors = {}};
GnssClock clock = {.gnssClockFlags = GnssClock::HAS_FULL_BIAS | GnssClock::HAS_BIAS |
@@ -247,8 +257,7 @@
GnssData gnssData = {.measurements = {measurement},
.clock = clock,
.elapsedRealtime = timestamp,
- .gnssAgcs = std::make_optional(std::vector(
- {std::make_optional(gnssAgc1), std::make_optional(gnssAgc2)}))};
+ .gnssAgcs = std::vector({gnssAgc1, gnssAgc2})};
return gnssData;
}
diff --git a/graphics/bufferqueue/1.0/Android.bp b/graphics/bufferqueue/1.0/Android.bp
index eda80d7..c3d38d0 100644
--- a/graphics/bufferqueue/1.0/Android.bp
+++ b/graphics/bufferqueue/1.0/Android.bp
@@ -25,4 +25,9 @@
"android.hidl.base@1.0",
],
gen_java: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media",
+ "com.android.media.swcodec",
+ ],
}
diff --git a/graphics/bufferqueue/2.0/Android.bp b/graphics/bufferqueue/2.0/Android.bp
index 13feeb1..33d9104 100644
--- a/graphics/bufferqueue/2.0/Android.bp
+++ b/graphics/bufferqueue/2.0/Android.bp
@@ -27,4 +27,9 @@
"android.hidl.base@1.0",
],
gen_java: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media",
+ "com.android.media.swcodec",
+ ],
}
diff --git a/identity/aidl/android/hardware/identity/IIdentityCredential.aidl b/identity/aidl/android/hardware/identity/IIdentityCredential.aidl
index 84d6ed0..82b0a83 100644
--- a/identity/aidl/android/hardware/identity/IIdentityCredential.aidl
+++ b/identity/aidl/android/hardware/identity/IIdentityCredential.aidl
@@ -438,8 +438,9 @@
* If the method is called on an instance obtained via IPresentationSession.getCredential(),
* STATUS_FAILED must be returned.
*
- * @param challenge a challenge set by the issuer to ensure freshness. Maximum size is 32 bytes
- * and it may be empty. Fails with STATUS_INVALID_DATA if bigger than 32 bytes.
+ * @param challenge a challenge set by the issuer to ensure freshness. Implementations must
+ * support challenges that are at least 32 bytes. Fails with STATUS_INVALID_DATA if bigger
+ * than 32 bytes.
* @return a COSE_Sign1 signature described above.
*/
byte[] deleteCredentialWithChallenge(in byte[] challenge);
@@ -463,8 +464,9 @@
* If the method is called on an instance obtained via IPresentationSession.getCredential(),
* STATUS_FAILED must be returned.
*
- * @param challenge a challenge set by the issuer to ensure freshness. Maximum size is 32 bytes
- * and it may be empty. Fails with STATUS_INVALID_DATA if bigger than 32 bytes.
+ * @param challenge a challenge set by the issuer to ensure freshness. Implementations must
+ * support challenges that are at least 32 bytes. Fails with STATUS_INVALID_DATA if bigger
+ * than 32 bytes.
* @return a COSE_Sign1 signature described above.
*/
byte[] proveOwnership(in byte[] challenge);
diff --git a/identity/aidl/android/hardware/identity/IWritableIdentityCredential.aidl b/identity/aidl/android/hardware/identity/IWritableIdentityCredential.aidl
index 756b008..1c80cbb 100644
--- a/identity/aidl/android/hardware/identity/IWritableIdentityCredential.aidl
+++ b/identity/aidl/android/hardware/identity/IWritableIdentityCredential.aidl
@@ -127,7 +127,8 @@
* https://developer.android.com/training/articles/security-key-attestation#certificate_schema_attestationid
*
* @param attestationChallenge a challenge set by the issuer to ensure freshness. If
- * this is empty, the call fails with STATUS_INVALID_DATA.
+ * this is empty, the call fails with STATUS_INVALID_DATA. Implementations must
+ * support challenges of at least 32 bytes.
*
* @return the X.509 certificate chain for the credentialKey
*/
diff --git a/identity/aidl/vts/Android.bp b/identity/aidl/vts/Android.bp
index c5b84a1..20faeee 100644
--- a/identity/aidl/vts/Android.bp
+++ b/identity/aidl/vts/Android.bp
@@ -58,3 +58,16 @@
"vts",
],
}
+
+java_test_host {
+ name: "IdentityCredentialImplementedTest",
+ libs: [
+ "tradefed",
+ "vts-core-tradefed-harness",
+ ],
+ srcs: ["src/**/*.java"],
+ test_suites: [
+ "vts",
+ ],
+ test_config: "IdentityCredentialImplementedTest.xml",
+}
diff --git a/identity/aidl/vts/DeleteCredentialTests.cpp b/identity/aidl/vts/DeleteCredentialTests.cpp
index 7627c9c..a126463 100644
--- a/identity/aidl/vts/DeleteCredentialTests.cpp
+++ b/identity/aidl/vts/DeleteCredentialTests.cpp
@@ -146,7 +146,9 @@
credentialData_, &credential)
.isOk());
- vector<uint8_t> challenge = {65, 66, 67};
+ // Implementations must support at least 32 bytes.
+ string challengeString = "0123456789abcdef0123456789abcdef";
+ vector<uint8_t> challenge(challengeString.begin(), challengeString.end());
vector<uint8_t> proofOfDeletionSignature;
ASSERT_TRUE(
credential->deleteCredentialWithChallenge(challenge, &proofOfDeletionSignature).isOk());
@@ -154,8 +156,13 @@
support::coseSignGetPayload(proofOfDeletionSignature);
ASSERT_TRUE(proofOfDeletion);
string cborPretty = cppbor::prettyPrint(proofOfDeletion.value(), 32, {});
- EXPECT_EQ("['ProofOfDeletion', 'org.iso.18013-5.2019.mdl', {0x41, 0x42, 0x43}, true, ]",
- cborPretty);
+ EXPECT_EQ(
+ "['ProofOfDeletion', 'org.iso.18013-5.2019.mdl', {"
+ "0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, "
+ "0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, "
+ "0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, "
+ "0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66}, true, ]",
+ cborPretty);
EXPECT_TRUE(support::coseCheckEcDsaSignature(proofOfDeletionSignature, {}, // Additional data
credentialPubKey_));
}
diff --git a/identity/aidl/vts/IdentityCredentialImplementedTest.xml b/identity/aidl/vts/IdentityCredentialImplementedTest.xml
new file mode 100644
index 0000000..1d76a74
--- /dev/null
+++ b/identity/aidl/vts/IdentityCredentialImplementedTest.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Runs IdentityCredentialImplementedTest">
+ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
+
+ <test class="com.android.tradefed.testtype.HostTest" >
+ <option name="jar" value="IdentityCredentialImplementedTest.jar" />
+ </test>
+</configuration>
diff --git a/identity/aidl/vts/ProveOwnershipTests.cpp b/identity/aidl/vts/ProveOwnershipTests.cpp
index c622193..f8ec670 100644
--- a/identity/aidl/vts/ProveOwnershipTests.cpp
+++ b/identity/aidl/vts/ProveOwnershipTests.cpp
@@ -125,14 +125,22 @@
credentialData_, &credential)
.isOk());
- vector<uint8_t> challenge = {17, 18};
+ // Implementations must support at least 32 bytes.
+ string challengeString = "0123456789abcdef0123456789abcdef";
+ vector<uint8_t> challenge(challengeString.begin(), challengeString.end());
vector<uint8_t> proofOfOwnershipSignature;
ASSERT_TRUE(credential->proveOwnership(challenge, &proofOfOwnershipSignature).isOk());
optional<vector<uint8_t>> proofOfOwnership =
support::coseSignGetPayload(proofOfOwnershipSignature);
ASSERT_TRUE(proofOfOwnership);
string cborPretty = cppbor::prettyPrint(proofOfOwnership.value(), 32, {});
- EXPECT_EQ("['ProofOfOwnership', 'org.iso.18013-5.2019.mdl', {0x11, 0x12}, true, ]", cborPretty);
+ EXPECT_EQ(
+ "['ProofOfOwnership', 'org.iso.18013-5.2019.mdl', {"
+ "0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, "
+ "0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, "
+ "0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, "
+ "0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66}, true, ]",
+ cborPretty);
EXPECT_TRUE(support::coseCheckEcDsaSignature(proofOfOwnershipSignature, {}, // Additional data
credentialPubKey_));
}
diff --git a/identity/aidl/vts/VtsAttestationTests.cpp b/identity/aidl/vts/VtsAttestationTests.cpp
index e12fe05..7caa259 100644
--- a/identity/aidl/vts/VtsAttestationTests.cpp
+++ b/identity/aidl/vts/VtsAttestationTests.cpp
@@ -66,7 +66,8 @@
ASSERT_TRUE(setupWritableCredential(writableCredential, credentialStore_,
false /* testCredential */));
- string challenge = "NotSoRandomChallenge1NotSoRandomChallenge1NotSoRandomChallenge1";
+ // Must support at least 32 bytes.
+ string challenge = "0123456789abcdef0123456789abcdef";
vector<uint8_t> attestationChallenge(challenge.begin(), challenge.end());
vector<Certificate> attestationCertificate;
string applicationId = "Attestation Verification";
diff --git a/identity/aidl/vts/src/com/android/tests/security/identity/IdentityCredentialImplementedTest.java b/identity/aidl/vts/src/com/android/tests/security/identity/IdentityCredentialImplementedTest.java
new file mode 100644
index 0000000..19568af
--- /dev/null
+++ b/identity/aidl/vts/src/com/android/tests/security/identity/IdentityCredentialImplementedTest.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2020 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 com.android.tests.security.identity;
+
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import android.platform.test.annotations.RequiresDevice;
+import com.android.tradefed.device.DeviceNotAvailableException;
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(DeviceJUnit4ClassRunner.class)
+public class IdentityCredentialImplementedTest extends BaseHostJUnit4Test {
+ // Returns the ro.vendor.api_level or 0 if not set.
+ //
+ // Throws NumberFormatException if ill-formatted.
+ //
+ // Throws DeviceNotAvailableException if device is not available.
+ //
+ private int getVendorApiLevel() throws NumberFormatException, DeviceNotAvailableException {
+ String vendorApiLevelString =
+ getDevice().executeShellCommand("getprop ro.vendor.api_level").trim();
+ if (vendorApiLevelString.isEmpty()) {
+ return 0;
+ }
+ return Integer.parseInt(vendorApiLevelString);
+ }
+
+ // As of Android 13 (API level 32), Identity Credential is required at feature version 202201
+ // or newer.
+ //
+ @RequiresDevice
+ @Test
+ public void testIdentityCredentialIsImplemented() throws Exception {
+ int vendorApiLevel = getVendorApiLevel();
+ assumeTrue(vendorApiLevel >= 32);
+
+ final String minimumFeatureVersionNeeded = "202201";
+
+ String result = getDevice().executeShellCommand(
+ "pm has-feature android.hardware.identity_credential "
+ + minimumFeatureVersionNeeded);
+ if (!result.trim().equals("true")) {
+ fail("Identity Credential feature version " + minimumFeatureVersionNeeded
+ + " required but not found");
+ }
+ }
+}
diff --git a/input/classifier/README.md b/input/classifier/README.md
new file mode 100644
index 0000000..a68d726
--- /dev/null
+++ b/input/classifier/README.md
@@ -0,0 +1 @@
+This HAL is deprecated. Do not use this HAL. Use IInputProcessor instead, located in `hardware/interfaces/input/processor`.
\ No newline at end of file
diff --git a/input/common/aidl/Android.bp b/input/common/aidl/Android.bp
index 6cf64a6..b96f4d0 100644
--- a/input/common/aidl/Android.bp
+++ b/input/common/aidl/Android.bp
@@ -9,6 +9,7 @@
aidl_interface {
name: "android.hardware.input.common",
+ vendor_available: true,
srcs: ["android/hardware/input/common/*.aidl"],
stability: "vintf",
backend: {
diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Source.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Source.aidl
index 24d02cd..396e06d 100644
--- a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Source.aidl
+++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Source.aidl
@@ -48,6 +48,7 @@
TOUCH_NAVIGATION = 2097152,
ROTARY_ENCODER = 4194304,
JOYSTICK = 16777232,
+ HDMI = 33554433,
SENSOR = 67108864,
ANY = -256,
}
diff --git a/input/common/aidl/android/hardware/input/common/Source.aidl b/input/common/aidl/android/hardware/input/common/Source.aidl
index 7eb6d66..c6a825a 100644
--- a/input/common/aidl/android/hardware/input/common/Source.aidl
+++ b/input/common/aidl/android/hardware/input/common/Source.aidl
@@ -38,6 +38,11 @@
TOUCH_NAVIGATION = (1 << 21) | SourceClass.NONE,
ROTARY_ENCODER = (1 << 22) | SourceClass.NONE,
JOYSTICK = (1 << 24) | SourceClass.JOYSTICK,
+ /**
+ * The input source is a device connected through HDMI-based bus.
+ * The keys come in through HDMI-CEC or MHL signal line.
+ */
+ HDMI = (1 << 25) | SourceClass.BUTTON,
SENSOR = (1 << 26) | SourceClass.NONE,
ANY = 0xFFFFFF00,
}
diff --git a/input/processor/aidl/Android.bp b/input/processor/aidl/Android.bp
new file mode 100644
index 0000000..f848a57
--- /dev/null
+++ b/input/processor/aidl/Android.bp
@@ -0,0 +1,26 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+aidl_interface {
+ name: "android.hardware.input.processor",
+ vendor_available: true,
+ srcs: ["android/hardware/input/processor/*.aidl"],
+ imports: [
+ "android.hardware.input.common",
+ ],
+ stability: "vintf",
+ backend: {
+ cpp: {
+ enabled: false,
+ },
+ java: {
+ enabled: false,
+ },
+ },
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl b/input/processor/aidl/aidl_api/android.hardware.input.processor/current/android/hardware/input/processor/IInputProcessor.aidl
similarity index 84%
copy from radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
copy to input/processor/aidl/aidl_api/android.hardware.input.processor/current/android/hardware/input/processor/IInputProcessor.aidl
index 4f29c0b..9d00c70 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
+++ b/input/processor/aidl/aidl_api/android.hardware.input.processor/current/android/hardware/input/processor/IInputProcessor.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,10 @@
// 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.radio.network;
+package android.hardware.input.processor;
@VintfStability
-parcelable NeighboringCell {
- String cid;
- int rssi;
+interface IInputProcessor {
+ android.hardware.input.common.Classification classify(in android.hardware.input.common.MotionEvent event);
+ void reset();
+ void resetDevice(in int deviceId);
}
diff --git a/input/processor/aidl/android/hardware/input/processor/IInputProcessor.aidl b/input/processor/aidl/android/hardware/input/processor/IInputProcessor.aidl
new file mode 100644
index 0000000..635ff0a
--- /dev/null
+++ b/input/processor/aidl/android/hardware/input/processor/IInputProcessor.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.input.processor;
+
+@VintfStability
+interface IInputProcessor {
+ /**
+ * Upon receiving the current motion event, return the classification based on the current
+ * sequence of motion events.
+ * Once the classification has been determined, it should not change until a new gesture is
+ * started.
+ */
+ android.hardware.input.common.Classification classify(
+ in android.hardware.input.common.MotionEvent event);
+
+ /**
+ * Reset the HAL internal state. The reset may be called to prevent an inconsistent
+ * stream of events to be sent to the HAL.
+ */
+ void reset();
+
+ /**
+ * Called when an input device has been reset.
+ */
+ void resetDevice(in int deviceId);
+}
diff --git a/input/processor/aidl/default/Android.bp b/input/processor/aidl/default/Android.bp
new file mode 100644
index 0000000..f485597
--- /dev/null
+++ b/input/processor/aidl/default/Android.bp
@@ -0,0 +1,54 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_library_static {
+ name: "libinputprocessorexampleimpl",
+ vendor: true,
+ shared_libs: [
+ "libbase",
+ "libbinder_ndk",
+ "liblog",
+ "libutils",
+ "android.hardware.input.common-V1-ndk",
+ "android.hardware.input.processor-V1-ndk",
+ ],
+ export_include_dirs: ["include"],
+ srcs: [
+ "InputProcessor.cpp",
+ ],
+ visibility: [
+ ":__subpackages__",
+ "//hardware/interfaces/tests/extension/input/processor:__subpackages__",
+ ],
+}
+
+filegroup {
+ name: "android.hardware.input.processor.xml",
+ srcs: ["android.hardware.input.processor.xml"],
+}
+
+cc_binary {
+ name: "android.hardware.input.processor-service.example",
+ relative_install_path: "hw",
+ init_rc: ["inputprocessor-default.rc"],
+ vintf_fragments: [":android.hardware.input.processor.xml"],
+ vendor: true,
+ shared_libs: [
+ "libbase",
+ "libbinder_ndk",
+ "liblog",
+ "libutils",
+ "android.hardware.input.common-V1-ndk",
+ "android.hardware.input.processor-V1-ndk",
+ ],
+ static_libs: [
+ "libinputprocessorexampleimpl",
+ ],
+ srcs: ["main.cpp"],
+}
diff --git a/input/processor/aidl/default/InputProcessor.cpp b/input/processor/aidl/default/InputProcessor.cpp
new file mode 100644
index 0000000..fb6bbd5
--- /dev/null
+++ b/input/processor/aidl/default/InputProcessor.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "inputprocessor-impl/InputProcessor.h"
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace input {
+namespace processor {
+
+using ::aidl::android::hardware::input::common::Classification;
+using aidl::android::hardware::input::common::MotionEvent;
+
+::ndk::ScopedAStatus InputProcessor::classify(const MotionEvent& /*in_event*/,
+ Classification* _aidl_return) {
+ *_aidl_return = Classification::NONE;
+ return ndk::ScopedAStatus::ok();
+}
+::ndk::ScopedAStatus InputProcessor::reset() {
+ return ndk::ScopedAStatus::ok();
+}
+::ndk::ScopedAStatus InputProcessor::resetDevice(int32_t /*in_deviceId*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+} // namespace processor
+} // namespace input
+} // namespace hardware
+} // namespace android
+} // namespace aidl
\ No newline at end of file
diff --git a/input/processor/aidl/default/android.hardware.input.processor.xml b/input/processor/aidl/default/android.hardware.input.processor.xml
new file mode 100644
index 0000000..5ecbd2a
--- /dev/null
+++ b/input/processor/aidl/default/android.hardware.input.processor.xml
@@ -0,0 +1,7 @@
+<manifest version="1.0" type="device">
+ <hal format="aidl">
+ <name>android.hardware.input.processor</name>
+ <version>1</version>
+ <fqname>IInputProcessor/default</fqname>
+ </hal>
+</manifest>
\ No newline at end of file
diff --git a/input/processor/aidl/default/include/inputprocessor-impl/InputProcessor.h b/input/processor/aidl/default/include/inputprocessor-impl/InputProcessor.h
new file mode 100644
index 0000000..0d6bc58
--- /dev/null
+++ b/input/processor/aidl/default/include/inputprocessor-impl/InputProcessor.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/input/processor/BnInputProcessor.h>
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace input {
+namespace processor {
+
+class InputProcessor : public ::aidl::android::hardware::input::processor::BnInputProcessor {
+ public:
+ ::ndk::ScopedAStatus classify(
+ const ::aidl::android::hardware::input::common::MotionEvent& in_event,
+ ::aidl::android::hardware::input::common::Classification* _aidl_return) override;
+ ::ndk::ScopedAStatus reset() override;
+ ::ndk::ScopedAStatus resetDevice(int32_t in_deviceId) override;
+};
+
+} // namespace processor
+} // namespace input
+} // namespace hardware
+} // namespace android
+} // namespace aidl
\ No newline at end of file
diff --git a/input/processor/aidl/default/inputprocessor-default.rc b/input/processor/aidl/default/inputprocessor-default.rc
new file mode 100644
index 0000000..bcc6c02
--- /dev/null
+++ b/input/processor/aidl/default/inputprocessor-default.rc
@@ -0,0 +1,4 @@
+service vendor.inputprocessor-default /vendor/bin/hw/android.hardware.input.processor-service.example
+ class hal
+ user nobody
+ group nobody
\ No newline at end of file
diff --git a/input/processor/aidl/default/main.cpp b/input/processor/aidl/default/main.cpp
new file mode 100644
index 0000000..7b519dd
--- /dev/null
+++ b/input/processor/aidl/default/main.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "inputprocessor-impl/InputProcessor.h"
+
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+
+using ::aidl::android::hardware::input::processor::IInputProcessor;
+using ::aidl::android::hardware::input::processor::InputProcessor;
+
+int main() {
+ ABinderProcess_setThreadPoolMaxThreadCount(0);
+
+ auto processor = ndk::SharedRefBase::make<InputProcessor>();
+ const std::string name = std::string() + InputProcessor::descriptor + "/default";
+ binder_status_t status = AServiceManager_addService(processor->asBinder().get(), name.c_str());
+ CHECK_EQ(status, STATUS_OK);
+
+ ABinderProcess_joinThreadPool();
+ return EXIT_FAILURE; // should not reach
+}
\ No newline at end of file
diff --git a/media/1.0/Android.bp b/media/1.0/Android.bp
index 6e823f6..22a6d59 100644
--- a/media/1.0/Android.bp
+++ b/media/1.0/Android.bp
@@ -22,4 +22,8 @@
"android.hardware.graphics.common@1.0",
],
gen_java: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ ],
}
diff --git a/media/bufferpool/2.0/Android.bp b/media/bufferpool/2.0/Android.bp
index 01273c1..56597db 100644
--- a/media/bufferpool/2.0/Android.bp
+++ b/media/bufferpool/2.0/Android.bp
@@ -26,4 +26,8 @@
"android.hidl.base@1.0",
],
gen_java: false,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ ],
}
diff --git a/media/c2/1.0/Android.bp b/media/c2/1.0/Android.bp
index dc56fef..a591dc7 100644
--- a/media/c2/1.0/Android.bp
+++ b/media/c2/1.0/Android.bp
@@ -36,4 +36,9 @@
"android.hidl.safe_union@1.0",
],
gen_java: false,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ "test_com.android.media.swcodec",
+ ],
}
diff --git a/media/c2/1.1/Android.bp b/media/c2/1.1/Android.bp
index 885a4c8..bec3a06 100644
--- a/media/c2/1.1/Android.bp
+++ b/media/c2/1.1/Android.bp
@@ -30,4 +30,9 @@
"android.hidl.safe_union@1.0",
],
gen_java: false,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ "test_com.android.media.swcodec",
+ ],
}
diff --git a/media/omx/1.0/Android.bp b/media/omx/1.0/Android.bp
index e33bab3..ea63467 100644
--- a/media/omx/1.0/Android.bp
+++ b/media/omx/1.0/Android.bp
@@ -31,4 +31,8 @@
"android.hidl.base@1.0",
],
gen_java: false,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ ],
}
diff --git a/neuralnetworks/aidl/utils/src/Conversions.cpp b/neuralnetworks/aidl/utils/src/Conversions.cpp
index eb28db7..9b897c4 100644
--- a/neuralnetworks/aidl/utils/src/Conversions.cpp
+++ b/neuralnetworks/aidl/utils/src/Conversions.cpp
@@ -967,6 +967,11 @@
}
nn::GeneralResult<Model> unvalidatedConvert(const nn::Model& model) {
+ if (!hal::utils::hasNoPointerData(model)) {
+ return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT)
+ << "Model cannot be unvalidatedConverted because it contains pointer-based memory";
+ }
+
return Model{
.main = NN_TRY(unvalidatedConvert(model.main)),
.referenced = NN_TRY(unvalidatedConvert(model.referenced)),
@@ -982,6 +987,11 @@
}
nn::GeneralResult<Request> unvalidatedConvert(const nn::Request& request) {
+ if (!hal::utils::hasNoPointerData(request)) {
+ return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT)
+ << "Request cannot be unvalidatedConverted because it contains pointer-based memory";
+ }
+
return Request{
.inputs = NN_TRY(unvalidatedConvert(request.inputs)),
.outputs = NN_TRY(unvalidatedConvert(request.outputs)),
diff --git a/neuralnetworks/utils/common/include/nnapi/hal/CommonUtils.h b/neuralnetworks/utils/common/include/nnapi/hal/CommonUtils.h
index ae0d092..c04294a 100644
--- a/neuralnetworks/utils/common/include/nnapi/hal/CommonUtils.h
+++ b/neuralnetworks/utils/common/include/nnapi/hal/CommonUtils.h
@@ -20,6 +20,7 @@
#include <nnapi/Result.h>
#include <nnapi/SharedMemory.h>
#include <nnapi/Types.h>
+
#include <functional>
#include <vector>
@@ -47,81 +48,10 @@
const nn::Capabilities::PerformanceInfo& float32Performance,
const nn::Capabilities::PerformanceInfo& quantized8Performance);
-// Indicates if the object contains no pointer-based data that could be relocated to shared memory.
-bool hasNoPointerData(const nn::Model& model);
-bool hasNoPointerData(const nn::Request& request);
-
-// Relocate pointer-based data to shared memory. If `model` has no Operand::LifeTime::POINTER data,
-// the function returns with a reference to `model`. If `model` has Operand::LifeTime::POINTER data,
-// the model is copied to `maybeModelInSharedOut` with the POINTER data relocated to a memory pool,
-// and the function returns with a reference to `*maybeModelInSharedOut`.
-nn::GeneralResult<std::reference_wrapper<const nn::Model>> flushDataFromPointerToShared(
- const nn::Model* model, std::optional<nn::Model>* maybeModelInSharedOut);
-
-// Record a relocation mapping between pointer-based data and shared memory.
-// Only two specializations of this template may exist:
-// - RelocationInfo<const void*> for request inputs
-// - RelocationInfo<void*> for request outputs
-template <typename PointerType>
-struct RelocationInfo {
- PointerType data;
- size_t length;
- size_t offset;
-};
-using InputRelocationInfo = RelocationInfo<const void*>;
-using OutputRelocationInfo = RelocationInfo<void*>;
-
-// Keep track of the relocation mapping between pointer-based data and shared memory pool,
-// and provide method to copy the data between pointers and the shared memory pool.
-// Only two specializations of this template may exist:
-// - RelocationTracker<InputRelocationInfo> for request inputs
-// - RelocationTracker<OutputRelocationInfo> for request outputs
-template <typename RelocationInfoType>
-class RelocationTracker {
- public:
- static nn::GeneralResult<std::unique_ptr<RelocationTracker>> create(
- std::vector<RelocationInfoType> relocationInfos, nn::SharedMemory memory) {
- auto mapping = NN_TRY(map(memory));
- return std::make_unique<RelocationTracker<RelocationInfoType>>(
- std::move(relocationInfos), std::move(memory), std::move(mapping));
- }
-
- RelocationTracker(std::vector<RelocationInfoType> relocationInfos, nn::SharedMemory memory,
- nn::Mapping mapping)
- : kRelocationInfos(std::move(relocationInfos)),
- kMemory(std::move(memory)),
- kMapping(std::move(mapping)) {}
-
- // Specializations defined in CommonUtils.cpp.
- // For InputRelocationTracker, this method will copy pointer data to the shared memory pool.
- // For OutputRelocationTracker, this method will copy shared memory data to the pointers.
- void flush() const;
-
- private:
- const std::vector<RelocationInfoType> kRelocationInfos;
- const nn::SharedMemory kMemory;
- const nn::Mapping kMapping;
-};
-using InputRelocationTracker = RelocationTracker<InputRelocationInfo>;
-using OutputRelocationTracker = RelocationTracker<OutputRelocationInfo>;
-
-struct RequestRelocation {
- std::unique_ptr<InputRelocationTracker> input;
- std::unique_ptr<OutputRelocationTracker> output;
-};
-
-// Relocate pointer-based data to shared memory. If `request` has no
-// Request::Argument::LifeTime::POINTER data, the function returns with a reference to `request`. If
-// `request` has Request::Argument::LifeTime::POINTER data, the request is copied to
-// `maybeRequestInSharedOut` with the POINTER data relocated to a memory pool, and the function
-// returns with a reference to `*maybeRequestInSharedOut`. The `relocationOut` will be set to track
-// the input and output relocations.
-//
-// Unlike `flushDataFromPointerToShared`, this method will not copy the input pointer data to the
-// shared memory pool. Use `relocationOut` to flush the input or output data after the call.
-nn::GeneralResult<std::reference_wrapper<const nn::Request>> convertRequestFromPointerToShared(
- const nn::Request* request, uint32_t alignment, uint32_t padding,
- std::optional<nn::Request>* maybeRequestInSharedOut, RequestRelocation* relocationOut);
+using nn::convertRequestFromPointerToShared;
+using nn::flushDataFromPointerToShared;
+using nn::hasNoPointerData;
+using nn::RequestRelocation;
} // namespace android::hardware::neuralnetworks::utils
diff --git a/neuralnetworks/utils/common/src/CommonUtils.cpp b/neuralnetworks/utils/common/src/CommonUtils.cpp
index b249881..dd55add 100644
--- a/neuralnetworks/utils/common/src/CommonUtils.cpp
+++ b/neuralnetworks/utils/common/src/CommonUtils.cpp
@@ -31,59 +31,6 @@
#include <vector>
namespace android::hardware::neuralnetworks::utils {
-namespace {
-
-bool hasNoPointerData(const nn::Operand& operand);
-bool hasNoPointerData(const nn::Model::Subgraph& subgraph);
-bool hasNoPointerData(const nn::Request::Argument& argument);
-
-template <typename Type>
-bool hasNoPointerData(const std::vector<Type>& objects) {
- return std::all_of(objects.begin(), objects.end(),
- [](const auto& object) { return hasNoPointerData(object); });
-}
-
-bool hasNoPointerData(const nn::DataLocation& location) {
- return std::visit([](auto ptr) { return ptr == nullptr; }, location.pointer);
-}
-
-bool hasNoPointerData(const nn::Operand& operand) {
- return hasNoPointerData(operand.location);
-}
-
-bool hasNoPointerData(const nn::Model::Subgraph& subgraph) {
- return hasNoPointerData(subgraph.operands);
-}
-
-bool hasNoPointerData(const nn::Request::Argument& argument) {
- return hasNoPointerData(argument.location);
-}
-
-void copyPointersToSharedMemory(nn::Operand* operand, nn::ConstantMemoryBuilder* memoryBuilder) {
- CHECK(operand != nullptr);
- CHECK(memoryBuilder != nullptr);
-
- if (operand->lifetime != nn::Operand::LifeTime::POINTER) {
- return;
- }
-
- const void* data = std::visit([](auto ptr) { return static_cast<const void*>(ptr); },
- operand->location.pointer);
- CHECK(data != nullptr);
- operand->lifetime = nn::Operand::LifeTime::CONSTANT_REFERENCE;
- operand->location = memoryBuilder->append(data, operand->location.length);
-}
-
-void copyPointersToSharedMemory(nn::Model::Subgraph* subgraph,
- nn::ConstantMemoryBuilder* memoryBuilder) {
- CHECK(subgraph != nullptr);
- std::for_each(subgraph->operands.begin(), subgraph->operands.end(),
- [memoryBuilder](auto& operand) {
- copyPointersToSharedMemory(&operand, memoryBuilder);
- });
-}
-
-} // anonymous namespace
nn::Capabilities::OperandPerformanceTable makeQuantized8PerformanceConsistentWithP(
const nn::Capabilities::PerformanceInfo& float32Performance,
@@ -104,131 +51,4 @@
.value();
}
-bool hasNoPointerData(const nn::Model& model) {
- return hasNoPointerData(model.main) && hasNoPointerData(model.referenced);
-}
-
-bool hasNoPointerData(const nn::Request& request) {
- return hasNoPointerData(request.inputs) && hasNoPointerData(request.outputs);
-}
-
-nn::GeneralResult<std::reference_wrapper<const nn::Model>> flushDataFromPointerToShared(
- const nn::Model* model, std::optional<nn::Model>* maybeModelInSharedOut) {
- CHECK(model != nullptr);
- CHECK(maybeModelInSharedOut != nullptr);
-
- if (hasNoPointerData(*model)) {
- return *model;
- }
-
- // Make a copy of the model in order to make modifications. The modified model is returned to
- // the caller through `maybeModelInSharedOut` if the function succeeds.
- nn::Model modelInShared = *model;
-
- nn::ConstantMemoryBuilder memoryBuilder(modelInShared.pools.size());
- copyPointersToSharedMemory(&modelInShared.main, &memoryBuilder);
- std::for_each(modelInShared.referenced.begin(), modelInShared.referenced.end(),
- [&memoryBuilder](auto& subgraph) {
- copyPointersToSharedMemory(&subgraph, &memoryBuilder);
- });
-
- if (!memoryBuilder.empty()) {
- auto memory = NN_TRY(memoryBuilder.finish());
- modelInShared.pools.push_back(std::move(memory));
- }
-
- *maybeModelInSharedOut = modelInShared;
- return **maybeModelInSharedOut;
-}
-
-template <>
-void InputRelocationTracker::flush() const {
- // Copy from pointers to shared memory.
- uint8_t* memoryPtr = static_cast<uint8_t*>(std::get<void*>(kMapping.pointer));
- for (const auto& [data, length, offset] : kRelocationInfos) {
- std::memcpy(memoryPtr + offset, data, length);
- }
-}
-
-template <>
-void OutputRelocationTracker::flush() const {
- // Copy from shared memory to pointers.
- const uint8_t* memoryPtr = static_cast<const uint8_t*>(
- std::visit([](auto ptr) { return static_cast<const void*>(ptr); }, kMapping.pointer));
- for (const auto& [data, length, offset] : kRelocationInfos) {
- std::memcpy(data, memoryPtr + offset, length);
- }
-}
-
-nn::GeneralResult<std::reference_wrapper<const nn::Request>> convertRequestFromPointerToShared(
- const nn::Request* request, uint32_t alignment, uint32_t padding,
- std::optional<nn::Request>* maybeRequestInSharedOut, RequestRelocation* relocationOut) {
- CHECK(request != nullptr);
- CHECK(maybeRequestInSharedOut != nullptr);
- CHECK(relocationOut != nullptr);
-
- if (hasNoPointerData(*request)) {
- return *request;
- }
-
- // Make a copy of the request in order to make modifications. The modified request is returned
- // to the caller through `maybeRequestInSharedOut` if the function succeeds.
- nn::Request requestInShared = *request;
-
- RequestRelocation relocation;
-
- // Change input pointers to shared memory.
- nn::MutableMemoryBuilder inputBuilder(requestInShared.pools.size());
- std::vector<InputRelocationInfo> inputRelocationInfos;
- for (auto& input : requestInShared.inputs) {
- const auto& location = input.location;
- if (input.lifetime != nn::Request::Argument::LifeTime::POINTER) {
- continue;
- }
-
- input.lifetime = nn::Request::Argument::LifeTime::POOL;
- const void* data = std::visit([](auto ptr) { return static_cast<const void*>(ptr); },
- location.pointer);
- CHECK(data != nullptr);
- input.location = inputBuilder.append(location.length, alignment, padding);
- inputRelocationInfos.push_back({data, input.location.length, input.location.offset});
- }
-
- // Allocate input memory.
- if (!inputBuilder.empty()) {
- auto memory = NN_TRY(inputBuilder.finish());
- requestInShared.pools.push_back(memory);
- relocation.input = NN_TRY(
- InputRelocationTracker::create(std::move(inputRelocationInfos), std::move(memory)));
- }
-
- // Change output pointers to shared memory.
- nn::MutableMemoryBuilder outputBuilder(requestInShared.pools.size());
- std::vector<OutputRelocationInfo> outputRelocationInfos;
- for (auto& output : requestInShared.outputs) {
- const auto& location = output.location;
- if (output.lifetime != nn::Request::Argument::LifeTime::POINTER) {
- continue;
- }
-
- output.lifetime = nn::Request::Argument::LifeTime::POOL;
- void* data = std::get<void*>(location.pointer);
- CHECK(data != nullptr);
- output.location = outputBuilder.append(location.length, alignment, padding);
- outputRelocationInfos.push_back({data, output.location.length, output.location.offset});
- }
-
- // Allocate output memory.
- if (!outputBuilder.empty()) {
- auto memory = NN_TRY(outputBuilder.finish());
- requestInShared.pools.push_back(memory);
- relocation.output = NN_TRY(OutputRelocationTracker::create(std::move(outputRelocationInfos),
- std::move(memory)));
- }
-
- *maybeRequestInSharedOut = requestInShared;
- *relocationOut = std::move(relocation);
- return **maybeRequestInSharedOut;
-}
-
} // namespace android::hardware::neuralnetworks::utils
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 c8efea0..02bbf21 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
@@ -53,7 +53,7 @@
boolean preferred;
boolean persistent;
boolean alwaysOn;
- @nullable android.hardware.radio.data.TrafficDescriptor trafficDescriptor;
+ android.hardware.radio.data.TrafficDescriptor trafficDescriptor;
const int ID_DEFAULT = 0;
const int ID_TETHERED = 1;
const int ID_IMS = 2;
@@ -62,6 +62,6 @@
const int ID_OEM_BASE = 1000;
const int ID_INVALID = -1;
const int TYPE_COMMON = 0;
- const int TYPE_THREE_GPP = 1;
- const int TYPE_THREE_GPP2 = 2;
+ const int TYPE_3GPP = 1;
+ const int TYPE_3GPP2 = 2;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioData.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioData.aidl
index dc6092a..7b572f1 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioData.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioData.aidl
@@ -44,7 +44,7 @@
oneway void setDataAllowed(in int serial, in boolean allow);
oneway void setDataProfile(in int serial, in android.hardware.radio.data.DataProfileInfo[] profiles);
oneway void setDataThrottling(in int serial, in android.hardware.radio.data.DataThrottlingAction dataThrottlingAction, in long completionDurationMillis);
- oneway void setInitialAttachApn(in int serial, in android.hardware.radio.data.DataProfileInfo dataProfileInfo);
+ oneway void setInitialAttachApn(in int serial, in @nullable android.hardware.radio.data.DataProfileInfo dataProfileInfo);
oneway void setResponseFunctions(in android.hardware.radio.data.IRadioDataResponse radioDataResponse, in android.hardware.radio.data.IRadioDataIndication radioDataIndication);
oneway void setupDataCall(in int serial, in android.hardware.radio.AccessNetwork accessNetwork, in android.hardware.radio.data.DataProfileInfo dataProfileInfo, in boolean roamingAllowed, in android.hardware.radio.data.DataRequestReason reason, in android.hardware.radio.data.LinkAddress[] addresses, in String[] dnses, in int pduSessionId, in @nullable android.hardware.radio.data.SliceInfo sliceInfo, in boolean matchAllRuleAllowed);
oneway void startHandover(in int serial, in int callId);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessaging.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessaging.aidl
index b0fc349..dfec59a 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessaging.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessaging.aidl
@@ -37,7 +37,6 @@
oneway void acknowledgeIncomingGsmSmsWithPdu(in int serial, in boolean success, in String ackPdu);
oneway void acknowledgeLastIncomingCdmaSms(in int serial, in android.hardware.radio.messaging.CdmaSmsAck smsAck);
oneway void acknowledgeLastIncomingGsmSms(in int serial, in boolean success, in android.hardware.radio.messaging.SmsAcknowledgeFailCause cause);
- oneway void cancelPendingUssd(in int serial);
oneway void deleteSmsOnRuim(in int serial, in int index);
oneway void deleteSmsOnSim(in int serial, in int index);
oneway void getCdmaBroadcastConfig(in int serial);
@@ -50,7 +49,6 @@
oneway void sendImsSms(in int serial, in android.hardware.radio.messaging.ImsSmsMessage message);
oneway void sendSms(in int serial, in android.hardware.radio.messaging.GsmSmsMessage message);
oneway void sendSmsExpectMore(in int serial, in android.hardware.radio.messaging.GsmSmsMessage message);
- oneway void sendUssd(in int serial, in String ussd);
oneway void setCdmaBroadcastActivation(in int serial, in boolean activate);
oneway void setCdmaBroadcastConfig(in int serial, in android.hardware.radio.messaging.CdmaBroadcastSmsConfigInfo[] configInfo);
oneway void setGsmBroadcastActivation(in int serial, in boolean activate);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingIndication.aidl
index 89a0f3b..8f7824f 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingIndication.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingIndication.aidl
@@ -40,6 +40,5 @@
oneway void newSms(in android.hardware.radio.RadioIndicationType type, in byte[] pdu);
oneway void newSmsOnSim(in android.hardware.radio.RadioIndicationType type, in int recordNumber);
oneway void newSmsStatusReport(in android.hardware.radio.RadioIndicationType type, in byte[] pdu);
- oneway void onUssd(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.messaging.UssdModeType modeType, in String msg);
oneway void simSmsStorageFull(in android.hardware.radio.RadioIndicationType type);
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingResponse.aidl
index 156f24b..c3af7a6 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingResponse.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/IRadioMessagingResponse.aidl
@@ -38,7 +38,6 @@
oneway void acknowledgeLastIncomingCdmaSmsResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void acknowledgeLastIncomingGsmSmsResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void acknowledgeRequest(in int serial);
- oneway void cancelPendingUssdResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void deleteSmsOnRuimResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void deleteSmsOnSimResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void getCdmaBroadcastConfigResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.CdmaBroadcastSmsConfigInfo[] configs);
@@ -50,7 +49,6 @@
oneway void sendImsSmsResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.SendSmsResult sms);
oneway void sendSmsExpectMoreResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.SendSmsResult sms);
oneway void sendSmsResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.SendSmsResult sms);
- oneway void sendUssdResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void setCdmaBroadcastActivationResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void setCdmaBroadcastConfigResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void setGsmBroadcastActivationResponse(in android.hardware.radio.RadioResponseInfo info);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl
index ef9c779..85cf86e 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl
@@ -36,6 +36,5 @@
parcelable CarrierRestrictions {
android.hardware.radio.sim.Carrier[] allowedCarriers;
android.hardware.radio.sim.Carrier[] excludedCarriers;
- boolean priority;
boolean allowedCarriersPrioritized;
}
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 34d155a..603b1d6 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
@@ -35,6 +35,7 @@
@VintfStability
interface IRadioVoice {
oneway void acceptCall(in int serial);
+ oneway void cancelPendingUssd(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 int categories, in String[] urns, in android.hardware.radio.voice.EmergencyCallRouting routing, in boolean hasKnownUserIntentEmergency, in boolean isTesting);
@@ -59,6 +60,7 @@
oneway void sendBurstDtmf(in int serial, in String dtmf, in int on, in int off);
oneway void sendCdmaFeatureCode(in int serial, in String featureCode);
oneway void sendDtmf(in int serial, in String s);
+ oneway void sendUssd(in int serial, in String ussd);
oneway void separateConnection(in int serial, in int gsmIndex);
oneway void setCallForward(in int serial, in android.hardware.radio.voice.CallForwardInfo callInfo);
oneway void setCallWaiting(in int serial, in boolean enable, in int serviceClass);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceIndication.aidl
index af3417d..189ed43 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceIndication.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceIndication.aidl
@@ -44,6 +44,7 @@
oneway void exitEmergencyCallbackMode(in android.hardware.radio.RadioIndicationType type);
oneway void indicateRingbackTone(in android.hardware.radio.RadioIndicationType type, in boolean start);
oneway void onSupplementaryServiceIndication(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.StkCcUnsolSsResult ss);
+ oneway void onUssd(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.UssdModeType modeType, in String msg);
oneway void resendIncallMute(in android.hardware.radio.RadioIndicationType type);
oneway void srvccStateNotify(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.SrvccState state);
oneway void stkCallControlAlphaNotify(in android.hardware.radio.RadioIndicationType type, in String alpha);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceResponse.aidl
index a3b5e58..7acc044 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceResponse.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceResponse.aidl
@@ -36,6 +36,7 @@
interface IRadioVoiceResponse {
oneway void acceptCallResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void acknowledgeRequest(in int serial);
+ oneway void cancelPendingUssdResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void conferenceResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void dialResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void emergencyDialResponse(in android.hardware.radio.RadioResponseInfo info);
@@ -59,6 +60,7 @@
oneway void sendBurstDtmfResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void sendCdmaFeatureCodeResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void sendDtmfResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void sendUssdResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void separateConnectionResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void setCallForwardResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void setCallWaitingResponse(in android.hardware.radio.RadioResponseInfo info);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/UssdModeType.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/UssdModeType.aidl
similarity index 97%
rename from radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/UssdModeType.aidl
rename to radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/UssdModeType.aidl
index 5395b11..9a9d723 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/UssdModeType.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/UssdModeType.aidl
@@ -31,7 +31,7 @@
// 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.radio.messaging;
+package android.hardware.radio.voice;
@Backing(type="int") @VintfStability
enum UssdModeType {
NOTIFY = 0,
diff --git a/radio/aidl/android/hardware/radio/data/DataProfileInfo.aidl b/radio/aidl/android/hardware/radio/data/DataProfileInfo.aidl
index 7360202..123b3ed 100644
--- a/radio/aidl/android/hardware/radio/data/DataProfileInfo.aidl
+++ b/radio/aidl/android/hardware/radio/data/DataProfileInfo.aidl
@@ -16,9 +16,7 @@
package android.hardware.radio.data;
-import android.hardware.radio.RadioAccessFamily;
import android.hardware.radio.data.ApnAuthType;
-import android.hardware.radio.data.ApnTypes;
import android.hardware.radio.data.PdpProtocolType;
import android.hardware.radio.data.TrafficDescriptor;
@@ -36,8 +34,8 @@
const int ID_INVALID = 0xFFFFFFFF;
const int TYPE_COMMON = 0;
- const int TYPE_THREE_GPP = 1;
- const int TYPE_THREE_GPP2 = 2;
+ const int TYPE_3GPP = 1;
+ const int TYPE_3GPP2 = 2;
/**
* ID of the data profile.
@@ -130,5 +128,5 @@
* it does not specify the end point to be used for the data call. The end point is specified by
* apn; apn must be used as the end point if one is not specified through URSP rules.
*/
- @nullable TrafficDescriptor trafficDescriptor;
+ TrafficDescriptor trafficDescriptor;
}
diff --git a/radio/aidl/android/hardware/radio/data/IRadioData.aidl b/radio/aidl/android/hardware/radio/data/IRadioData.aidl
index 54a045c..e1ba568 100644
--- a/radio/aidl/android/hardware/radio/data/IRadioData.aidl
+++ b/radio/aidl/android/hardware/radio/data/IRadioData.aidl
@@ -159,14 +159,15 @@
in long completionDurationMillis);
/**
- * Set an APN to initial attach network.
+ * Set an APN to initial attach network or clear the existing initial attach APN.
*
* @param serial Serial number of request.
- * @param dataProfileInfo data profile containing APN settings
+ * @param dataProfileInfo Data profile containing APN settings or null to clear the existing
+ * initial attach APN.
*
* Response function is IRadioDataResponse.setInitialAttachApnResponse()
*/
- void setInitialAttachApn(in int serial, in DataProfileInfo dataProfileInfo);
+ void setInitialAttachApn(in int serial, in @nullable DataProfileInfo dataProfileInfo);
/**
* Set response functions for data radio requests and indications.
diff --git a/radio/aidl/android/hardware/radio/messaging/IRadioMessaging.aidl b/radio/aidl/android/hardware/radio/messaging/IRadioMessaging.aidl
index 1dbaed3..8bd84a3 100644
--- a/radio/aidl/android/hardware/radio/messaging/IRadioMessaging.aidl
+++ b/radio/aidl/android/hardware/radio/messaging/IRadioMessaging.aidl
@@ -79,15 +79,6 @@
in int serial, in boolean success, in SmsAcknowledgeFailCause cause);
/**
- * Cancel the current USSD session if one exists.
- *
- * @param serial Serial number of request.
- *
- * Response function is IRadioMessagingResponse.cancelPendingUssdResponse()
- */
- void cancelPendingUssd(in int serial);
-
- /**
* Deletes a CDMA SMS message from RUIM memory.
*
* @param serial Serial number of request.
@@ -212,23 +203,6 @@
void sendSmsExpectMore(in int serial, in GsmSmsMessage message);
/**
- * Send a USSD message. If a USSD session already exists, the message must be sent in the
- * context of that session. Otherwise, a new session must be created. The network reply must be
- * reported via unsolOnUssd.
- *
- * Only one USSD session must exist at a time, and the session is assumed to exist until:
- * a) The android system invokes cancelUssd()
- * b) The implementation sends a unsolOnUssd() with a type code of
- * "0" (USSD-Notify/no further action) or "2" (session terminated)
- *
- * @param serial Serial number of request.
- * @param ussd string containing the USSD request in UTF-8 format
- *
- * Response function is IRadioMessagingResponse.sendUssdResponse()
- */
- void sendUssd(in int serial, in String ussd);
-
- /**
* Enable or disable the reception of CDMA Cell Broadcast SMS
*
* @param serial Serial number of request.
diff --git a/radio/aidl/android/hardware/radio/messaging/IRadioMessagingIndication.aidl b/radio/aidl/android/hardware/radio/messaging/IRadioMessagingIndication.aidl
index 4b40bfb..8834cd9 100644
--- a/radio/aidl/android/hardware/radio/messaging/IRadioMessagingIndication.aidl
+++ b/radio/aidl/android/hardware/radio/messaging/IRadioMessagingIndication.aidl
@@ -18,7 +18,6 @@
import android.hardware.radio.RadioIndicationType;
import android.hardware.radio.messaging.CdmaSmsMessage;
-import android.hardware.radio.messaging.UssdModeType;
/**
* Interface declaring unsolicited radio indications for messaging APIs.
@@ -86,16 +85,6 @@
void newSmsStatusReport(in RadioIndicationType type, in byte[] pdu);
/**
- * Indicates when a new USSD message is received. The USSD session is assumed to persist if the
- * type code is REQUEST, otherwise the current session (if any) is assumed to have terminated.
- *
- * @param type Type of radio indication
- * @param modeType USSD type code
- * @param msg Message string in UTF-8, if applicable
- */
- void onUssd(in RadioIndicationType type, in UssdModeType modeType, in String msg);
-
- /**
* Indicates that SMS storage on the SIM is full. Sent when the network attempts to deliver a
* new SMS message. Messages cannot be saved on the SIM until space is freed. In particular,
* incoming Class 2 messages must not be stored.
diff --git a/radio/aidl/android/hardware/radio/messaging/IRadioMessagingResponse.aidl b/radio/aidl/android/hardware/radio/messaging/IRadioMessagingResponse.aidl
index 75fa390..492755f 100644
--- a/radio/aidl/android/hardware/radio/messaging/IRadioMessagingResponse.aidl
+++ b/radio/aidl/android/hardware/radio/messaging/IRadioMessagingResponse.aidl
@@ -92,27 +92,6 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
- * RadioError:SIM_BUSY
- * RadioError:OPERATION_NOT_ALLOWED
- * RadioError:MODEM_ERR
- * RadioError:INTERNAL_ERR
- * RadioError:NO_MEMORY
- * RadioError:INVALID_STATE
- * RadioError:INVALID_ARGUMENTS
- * RadioError:SYSTEM_ERR
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:INVALID_MODEM_STATE
- * RadioError:NO_RESOURCES
- * RadioError:CANCELLED
- */
- void cancelPendingUssdResponse(in RadioResponseInfo info);
-
- /**
- * @param info Response info struct containing response type, serial no. and error
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:RADIO_NOT_AVAILABLE
* RadioError:INVALID_ARGUMENTS
* RadioError:NO_MEMORY
* RadioError:SYSTEM_ERR
@@ -407,32 +386,6 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
- * RadioError:FDN_CHECK_FAILURE
- * RadioError:USSD_MODIFIED_TO_DIAL
- * RadioError:USSD_MODIFIED_TO_SS
- * RadioError:USSD_MODIFIED_TO_USSD
- * RadioError:SIM_BUSY
- * RadioError:OPERATION_NOT_ALLOWED
- * RadioError:INVALID_ARGUMENTS
- * RadioError:NO_MEMORY
- * RadioError:MODEM_ERR
- * RadioError:INTERNAL_ERR
- * RadioError:ABORTED
- * RadioError:SYSTEM_ERR
- * RadioError:INVALID_STATE
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:INVALID_MODEM_STATE
- * RadioError:NO_RESOURCES
- * RadioError:CANCELLED
- */
- void sendUssdResponse(in RadioResponseInfo info);
-
- /**
- * @param info Response info struct containing response type, serial no. and error
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:RADIO_NOT_AVAILABLE
* RadioError:INVALID_ARGUMENTS
* RadioError:INVALID_STATE
* RadioError:NO_MEMORY
diff --git a/radio/aidl/android/hardware/radio/modem/RadioCapability.aidl b/radio/aidl/android/hardware/radio/modem/RadioCapability.aidl
index 9bd5f21..96b9d0d 100644
--- a/radio/aidl/android/hardware/radio/modem/RadioCapability.aidl
+++ b/radio/aidl/android/hardware/radio/modem/RadioCapability.aidl
@@ -16,8 +16,6 @@
package android.hardware.radio.modem;
-import android.hardware.radio.RadioAccessFamily;
-
@VintfStability
parcelable RadioCapability {
/**
diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl
index 7a22a9a..cce52ff 100644
--- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl
+++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl
@@ -17,7 +17,6 @@
package android.hardware.radio.network;
import android.hardware.radio.AccessNetwork;
-import android.hardware.radio.RadioAccessFamily;
import android.hardware.radio.network.CdmaRoamingType;
import android.hardware.radio.network.IRadioNetworkIndication;
import android.hardware.radio.network.IRadioNetworkResponse;
diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl
index 6863ac3..f471433 100644
--- a/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl
+++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl
@@ -21,7 +21,6 @@
import android.hardware.radio.network.BarringInfo;
import android.hardware.radio.network.CellIdentity;
import android.hardware.radio.network.CellInfo;
-import android.hardware.radio.network.Domain;
import android.hardware.radio.network.LinkCapacityEstimate;
import android.hardware.radio.network.NetworkScanResult;
import android.hardware.radio.network.PhoneRestrictedState;
diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl
index e650321..dcf0004 100644
--- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl
+++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl
@@ -16,7 +16,6 @@
package android.hardware.radio.network;
-import android.hardware.radio.RadioAccessFamily;
import android.hardware.radio.RadioResponseInfo;
import android.hardware.radio.RadioTechnology;
import android.hardware.radio.RadioTechnologyFamily;
@@ -24,8 +23,6 @@
import android.hardware.radio.network.CdmaRoamingType;
import android.hardware.radio.network.CellIdentity;
import android.hardware.radio.network.CellInfo;
-import android.hardware.radio.network.LceDataInfo;
-import android.hardware.radio.network.NeighboringCell;
import android.hardware.radio.network.OperatorInfo;
import android.hardware.radio.network.RadioAccessSpecifier;
import android.hardware.radio.network.RadioBandMode;
diff --git a/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl b/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl
index 12df138..ef38fdc 100644
--- a/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl
+++ b/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl
@@ -31,11 +31,6 @@
*/
Carrier[] excludedCarriers;
/**
- * Whether this is a carrier restriction with priority or not.
- * If this is false, allowedCarriersPrioritized is not applicable.
- */
- boolean priority;
- /**
* True means that only carriers included in the allowed list and not in the excluded list
* are permitted. Eg. allowedCarriers match mcc/mnc, excludedCarriers has same mcc/mnc and
* gid1 is ABCD. It means except the carrier whose gid1 is ABCD, all carriers with the
diff --git a/radio/aidl/android/hardware/radio/voice/EmergencyNumber.aidl b/radio/aidl/android/hardware/radio/voice/EmergencyNumber.aidl
index ddc5d76..9fed78e 100644
--- a/radio/aidl/android/hardware/radio/voice/EmergencyNumber.aidl
+++ b/radio/aidl/android/hardware/radio/voice/EmergencyNumber.aidl
@@ -16,8 +16,6 @@
package android.hardware.radio.voice;
-import android.hardware.radio.voice.EmergencyServiceCategory;
-
/**
* Emergency number contains information of number, one or more service category(s), zero or more
* emergency uniform resource names, mobile country code (mcc), mobile network country (mnc) and
diff --git a/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl b/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl
index b25e63d..c05d237 100644
--- a/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl
+++ b/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl
@@ -19,7 +19,6 @@
import android.hardware.radio.voice.CallForwardInfo;
import android.hardware.radio.voice.Dial;
import android.hardware.radio.voice.EmergencyCallRouting;
-import android.hardware.radio.voice.EmergencyServiceCategory;
import android.hardware.radio.voice.IRadioVoiceIndication;
import android.hardware.radio.voice.IRadioVoiceResponse;
import android.hardware.radio.voice.TtyMode;
@@ -45,6 +44,15 @@
void acceptCall(in int serial);
/**
+ * Cancel the current USSD session if one exists.
+ *
+ * @param serial Serial number of request.
+ *
+ * Response function is IRadioVoiceResponse.cancelPendingUssdResponse()
+ */
+ void cancelPendingUssd(in int serial);
+
+ /**
* Conference holding and active (like AT+CHLD=3)
*
* @param serial Serial number of request.
@@ -325,6 +333,23 @@
void sendDtmf(in int serial, in String s);
/**
+ * Send a USSD message. If a USSD session already exists, the message must be sent in the
+ * context of that session. Otherwise, a new session must be created. The network reply must be
+ * reported via unsolOnUssd.
+ *
+ * Only one USSD session must exist at a time, and the session is assumed to exist until:
+ * a) The android system invokes cancelUssd()
+ * b) The implementation sends a unsolOnUssd() with a type code of
+ * "0" (USSD-Notify/no further action) or "2" (session terminated)
+ *
+ * @param serial Serial number of request.
+ * @param ussd string containing the USSD request in UTF-8 format
+ *
+ * Response function is IRadioVoiceResponse.sendUssdResponse()
+ */
+ void sendUssd(in int serial, in String ussd);
+
+ /**
* Separate a party from a multiparty call placing the multiparty call (less the specified
* party) on hold and leaving the specified party as the only other member of the current
* (active) call. Like AT+CHLD=2x.
diff --git a/radio/aidl/android/hardware/radio/voice/IRadioVoiceIndication.aidl b/radio/aidl/android/hardware/radio/voice/IRadioVoiceIndication.aidl
index 25e87b3..437fef6 100644
--- a/radio/aidl/android/hardware/radio/voice/IRadioVoiceIndication.aidl
+++ b/radio/aidl/android/hardware/radio/voice/IRadioVoiceIndication.aidl
@@ -24,6 +24,7 @@
import android.hardware.radio.voice.EmergencyNumber;
import android.hardware.radio.voice.SrvccState;
import android.hardware.radio.voice.StkCcUnsolSsResult;
+import android.hardware.radio.voice.UssdModeType;
/**
* Interface declaring unsolicited radio indications for voice APIs.
@@ -138,6 +139,16 @@
void onSupplementaryServiceIndication(in RadioIndicationType type, in StkCcUnsolSsResult ss);
/**
+ * Indicates when a new USSD message is received. The USSD session is assumed to persist if the
+ * type code is REQUEST, otherwise the current session (if any) is assumed to have terminated.
+ *
+ * @param type Type of radio indication
+ * @param modeType USSD type code
+ * @param msg Message string in UTF-8, if applicable
+ */
+ void onUssd(in RadioIndicationType type, in UssdModeType modeType, in String msg);
+
+ /**
* Indicates that framework/application must reset the uplink mute state.
*
* @param type Type of radio indication
diff --git a/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl b/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl
index d126fc1..cf1b953 100644
--- a/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl
+++ b/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl
@@ -62,6 +62,27 @@
*
* Valid errors returned:
* RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:SIM_BUSY
+ * RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:INVALID_STATE
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:SYSTEM_ERR
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:INVALID_MODEM_STATE
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ */
+ void cancelPendingUssdResponse(in RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE (radio resetting)
* RadioError:NO_MEMORY
* RadioError:MODEM_ERR
@@ -569,6 +590,32 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:FDN_CHECK_FAILURE
+ * RadioError:USSD_MODIFIED_TO_DIAL
+ * RadioError:USSD_MODIFIED_TO_SS
+ * RadioError:USSD_MODIFIED_TO_USSD
+ * RadioError:SIM_BUSY
+ * RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:NO_MEMORY
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:ABORTED
+ * RadioError:SYSTEM_ERR
+ * RadioError:INVALID_STATE
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:INVALID_MODEM_STATE
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ */
+ void sendUssdResponse(in RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
* RadioError:INVALID_ARGUMENTS
* RadioError:INVALID_STATE
* RadioError:NO_RESOURCES
diff --git a/radio/aidl/android/hardware/radio/messaging/UssdModeType.aidl b/radio/aidl/android/hardware/radio/voice/UssdModeType.aidl
similarity index 95%
rename from radio/aidl/android/hardware/radio/messaging/UssdModeType.aidl
rename to radio/aidl/android/hardware/radio/voice/UssdModeType.aidl
index c3c111e..48d1fca 100644
--- a/radio/aidl/android/hardware/radio/messaging/UssdModeType.aidl
+++ b/radio/aidl/android/hardware/radio/voice/UssdModeType.aidl
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.hardware.radio.messaging;
+package android.hardware.radio.voice;
@VintfStability
@Backing(type="int")
diff --git a/radio/aidl/compat/libradiocompat/data/RadioData.cpp b/radio/aidl/compat/libradiocompat/data/RadioData.cpp
index d2f3687..51f5543 100644
--- a/radio/aidl/compat/libradiocompat/data/RadioData.cpp
+++ b/radio/aidl/compat/libradiocompat/data/RadioData.cpp
@@ -122,9 +122,10 @@
return ok();
}
-ScopedAStatus RadioData::setInitialAttachApn(int32_t serial, const aidl::DataProfileInfo& info) {
+ScopedAStatus RadioData::setInitialAttachApn(int32_t serial,
+ const std::optional<aidl::DataProfileInfo>& info) {
LOG_CALL << serial;
- mHal1_5->setInitialAttachApn_1_5(serial, toHidl(info));
+ mHal1_5->setInitialAttachApn_1_5(serial, toHidl(info.value()));
return ok();
}
@@ -136,14 +137,15 @@
return ok();
}
-ScopedAStatus RadioData::setupDataCall( //
- int32_t serial, aidlCommon::AccessNetwork accessNetwork,
- const aidl::DataProfileInfo& dataProfileInfo, bool roamingAllowed,
- aidl::DataRequestReason reason, const std::vector<aidl::LinkAddress>& addresses,
- const std::vector<std::string>& dnses, int32_t pduSessId,
- const std::optional<aidl::SliceInfo>& sliceInfo, bool matchAllRuleAllowed) {
+ScopedAStatus RadioData::setupDataCall(int32_t serial, aidlCommon::AccessNetwork accessNetwork,
+ const aidl::DataProfileInfo& dataProfileInfo,
+ bool roamingAllowed, aidl::DataRequestReason reason,
+ const std::vector<aidl::LinkAddress>& addresses,
+ const std::vector<std::string>& dnses, int32_t pduSessId,
+ const std::optional<aidl::SliceInfo>& sliceInfo,
+ bool matchAllRuleAllowed) {
if (mHal1_6) {
- mHal1_6->setupDataCall_1_6( //
+ mHal1_6->setupDataCall_1_6(
serial, V1_5::AccessNetwork(accessNetwork), toHidl(dataProfileInfo), roamingAllowed,
V1_2::DataRequestReason(reason), toHidl(addresses), toHidl(dnses), pduSessId,
toHidl<V1_6::OptionalSliceInfo>(sliceInfo),
@@ -151,7 +153,7 @@
matchAllRuleAllowed);
mContext->addDataProfile(dataProfileInfo);
} else {
- mHal1_5->setupDataCall_1_5( //
+ mHal1_5->setupDataCall_1_5(
serial, V1_5::AccessNetwork(accessNetwork), toHidl(dataProfileInfo), roamingAllowed,
V1_2::DataRequestReason(reason), toHidl(addresses), toHidl(dnses));
}
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioData.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioData.h
index c617ec2..c2c0de3 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioData.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioData.h
@@ -44,7 +44,8 @@
int64_t completionDurationMillis) override;
::ndk::ScopedAStatus setInitialAttachApn(
int32_t serial,
- const ::aidl::android::hardware::radio::data::DataProfileInfo& dpInfo) override;
+ const std::optional<::aidl::android::hardware::radio::data::DataProfileInfo>& dpInfo)
+ override;
::ndk::ScopedAStatus setResponseFunctions(
const std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse>&
radioDataResponse,
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioMessaging.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioMessaging.h
index 419e9fb..047f836 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioMessaging.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioMessaging.h
@@ -33,7 +33,6 @@
::ndk::ScopedAStatus acknowledgeLastIncomingGsmSms(
int32_t serial, bool success,
::aidl::android::hardware::radio::messaging::SmsAcknowledgeFailCause cause) override;
- ::ndk::ScopedAStatus cancelPendingUssd(int32_t serial) override;
::ndk::ScopedAStatus deleteSmsOnRuim(int32_t serial, int32_t index) override;
::ndk::ScopedAStatus deleteSmsOnSim(int32_t serial, int32_t index) override;
::ndk::ScopedAStatus getCdmaBroadcastConfig(int32_t serial) override;
@@ -56,7 +55,6 @@
::ndk::ScopedAStatus sendSmsExpectMore(
int32_t serial,
const ::aidl::android::hardware::radio::messaging::GsmSmsMessage& message) override;
- ::ndk::ScopedAStatus sendUssd(int32_t serial, const std::string& ussd) override;
::ndk::ScopedAStatus setCdmaBroadcastActivation(int32_t serial, bool activate) override;
::ndk::ScopedAStatus setCdmaBroadcastConfig(
int32_t serial,
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h
index a0e1e82..0f1d5fd 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h
@@ -26,6 +26,7 @@
std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> respond();
::ndk::ScopedAStatus acceptCall(int32_t serial) override;
+ ::ndk::ScopedAStatus cancelPendingUssd(int32_t serial) override;
::ndk::ScopedAStatus conference(int32_t serial) override;
::ndk::ScopedAStatus dial(
int32_t serial, const ::aidl::android::hardware::radio::voice::Dial& dialInfo) override;
@@ -58,6 +59,7 @@
int32_t off) override;
::ndk::ScopedAStatus sendCdmaFeatureCode(int32_t serial, const std::string& fcode) override;
::ndk::ScopedAStatus sendDtmf(int32_t serial, const std::string& s) override;
+ ::ndk::ScopedAStatus sendUssd(int32_t serial, const std::string& ussd) override;
::ndk::ScopedAStatus separateConnection(int32_t serial, int32_t gsmIndex) override;
::ndk::ScopedAStatus setCallForward(
int32_t serial,
diff --git a/radio/aidl/compat/libradiocompat/messaging/RadioIndication-messaging.cpp b/radio/aidl/compat/libradiocompat/messaging/RadioIndication-messaging.cpp
index e5c33b3..eb87828 100644
--- a/radio/aidl/compat/libradiocompat/messaging/RadioIndication-messaging.cpp
+++ b/radio/aidl/compat/libradiocompat/messaging/RadioIndication-messaging.cpp
@@ -73,13 +73,6 @@
return {};
}
-Return<void> RadioIndication::onUssd(V1_0::RadioIndicationType type, V1_0::UssdModeType modeType,
- const hidl_string& msg) {
- LOG_CALL << type;
- messagingCb()->onUssd(toAidl(type), aidl::UssdModeType(modeType), msg);
- return {};
-}
-
Return<void> RadioIndication::simSmsStorageFull(V1_0::RadioIndicationType type) {
LOG_CALL << type;
messagingCb()->simSmsStorageFull(toAidl(type));
diff --git a/radio/aidl/compat/libradiocompat/messaging/RadioMessaging.cpp b/radio/aidl/compat/libradiocompat/messaging/RadioMessaging.cpp
index 4d94e17..56d49f1 100644
--- a/radio/aidl/compat/libradiocompat/messaging/RadioMessaging.cpp
+++ b/radio/aidl/compat/libradiocompat/messaging/RadioMessaging.cpp
@@ -54,12 +54,6 @@
return ok();
}
-ScopedAStatus RadioMessaging::cancelPendingUssd(int32_t serial) {
- LOG_CALL << serial;
- mHal1_5->cancelPendingUssd(serial);
- return ok();
-}
-
ScopedAStatus RadioMessaging::deleteSmsOnRuim(int32_t serial, int32_t index) {
LOG_CALL << serial << ' ' << index;
mHal1_5->deleteSmsOnRuim(serial, index);
@@ -148,12 +142,6 @@
return ok();
}
-ScopedAStatus RadioMessaging::sendUssd(int32_t serial, const std::string& ussd) {
- LOG_CALL << serial << ' ' << ussd;
- mHal1_5->sendUssd(serial, ussd);
- return ok();
-}
-
ScopedAStatus RadioMessaging::setCdmaBroadcastActivation(int32_t serial, bool activate) {
LOG_CALL << serial << ' ' << activate;
mHal1_5->setCdmaBroadcastActivation(serial, activate);
diff --git a/radio/aidl/compat/libradiocompat/messaging/RadioResponse-messaging.cpp b/radio/aidl/compat/libradiocompat/messaging/RadioResponse-messaging.cpp
index 24ad3d7..7a9273f 100644
--- a/radio/aidl/compat/libradiocompat/messaging/RadioResponse-messaging.cpp
+++ b/radio/aidl/compat/libradiocompat/messaging/RadioResponse-messaging.cpp
@@ -57,12 +57,6 @@
return {};
}
-Return<void> RadioResponse::cancelPendingUssdResponse(const V1_0::RadioResponseInfo& info) {
- LOG_CALL << info.serial;
- messagingCb()->cancelPendingUssdResponse(toAidl(info));
- return {};
-}
-
Return<void> RadioResponse::deleteSmsOnRuimResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
messagingCb()->deleteSmsOnRuimResponse(toAidl(info));
@@ -166,12 +160,6 @@
return {};
}
-Return<void> RadioResponse::sendUssdResponse(const V1_0::RadioResponseInfo& info) {
- LOG_CALL << info.serial;
- messagingCb()->sendUssdResponse(toAidl(info));
- return {};
-}
-
Return<void> RadioResponse::setCdmaBroadcastActivationResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
diff --git a/radio/aidl/compat/libradiocompat/network/structs.cpp b/radio/aidl/compat/libradiocompat/network/structs.cpp
index 87a021f..c1d9b35 100644
--- a/radio/aidl/compat/libradiocompat/network/structs.cpp
+++ b/radio/aidl/compat/libradiocompat/network/structs.cpp
@@ -650,13 +650,6 @@
};
}
-aidl::NeighboringCell toAidl(const V1_0::NeighboringCell& cell) {
- return {
- .cid = cell.cid,
- .rssi = cell.rssi,
- };
-}
-
aidl::LceDataInfo toAidl(const V1_0::LceDataInfo& info) {
return {
.lastHopCapacityKbps = static_cast<int32_t>(info.lastHopCapacityKbps),
diff --git a/radio/aidl/compat/libradiocompat/network/structs.h b/radio/aidl/compat/libradiocompat/network/structs.h
index 854cb38..aaa49a0 100644
--- a/radio/aidl/compat/libradiocompat/network/structs.h
+++ b/radio/aidl/compat/libradiocompat/network/structs.h
@@ -20,7 +20,6 @@
#include <aidl/android/hardware/radio/network/CellInfo.h>
#include <aidl/android/hardware/radio/network/LceDataInfo.h>
#include <aidl/android/hardware/radio/network/LinkCapacityEstimate.h>
-#include <aidl/android/hardware/radio/network/NeighboringCell.h>
#include <aidl/android/hardware/radio/network/NetworkScanRequest.h>
#include <aidl/android/hardware/radio/network/NetworkScanResult.h>
#include <aidl/android/hardware/radio/network/OperatorInfo.h>
@@ -92,8 +91,6 @@
::aidl::android::hardware::radio::network::RegStateResult toAidl(const V1_5::RegStateResult& res);
::aidl::android::hardware::radio::network::RegStateResult toAidl(const V1_6::RegStateResult& res);
-::aidl::android::hardware::radio::network::NeighboringCell toAidl(const V1_0::NeighboringCell& c);
-
::aidl::android::hardware::radio::network::LceDataInfo toAidl(const V1_0::LceDataInfo& info);
} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/voice/RadioIndication-voice.cpp b/radio/aidl/compat/libradiocompat/voice/RadioIndication-voice.cpp
index 359fce0..23878ed 100644
--- a/radio/aidl/compat/libradiocompat/voice/RadioIndication-voice.cpp
+++ b/radio/aidl/compat/libradiocompat/voice/RadioIndication-voice.cpp
@@ -102,6 +102,13 @@
return {};
}
+Return<void> RadioIndication::onUssd(V1_0::RadioIndicationType type, V1_0::UssdModeType modeType,
+ const hidl_string& msg) {
+ LOG_CALL << type;
+ voiceCb()->onUssd(toAidl(type), aidl::UssdModeType(modeType), msg);
+ return {};
+}
+
Return<void> RadioIndication::resendIncallMute(V1_0::RadioIndicationType type) {
LOG_CALL << type;
voiceCb()->resendIncallMute(toAidl(type));
diff --git a/radio/aidl/compat/libradiocompat/voice/RadioResponse-voice.cpp b/radio/aidl/compat/libradiocompat/voice/RadioResponse-voice.cpp
index d233548..5307e11 100644
--- a/radio/aidl/compat/libradiocompat/voice/RadioResponse-voice.cpp
+++ b/radio/aidl/compat/libradiocompat/voice/RadioResponse-voice.cpp
@@ -42,6 +42,12 @@
return {};
}
+Return<void> RadioResponse::cancelPendingUssdResponse(const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ voiceCb()->cancelPendingUssdResponse(toAidl(info));
+ return {};
+}
+
Return<void> RadioResponse::conferenceResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
voiceCb()->conferenceResponse(toAidl(info));
@@ -198,6 +204,12 @@
return {};
}
+Return<void> RadioResponse::sendUssdResponse(const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ voiceCb()->sendUssdResponse(toAidl(info));
+ return {};
+}
+
Return<void> RadioResponse::separateConnectionResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
voiceCb()->separateConnectionResponse(toAidl(info));
diff --git a/radio/aidl/compat/libradiocompat/voice/RadioVoice.cpp b/radio/aidl/compat/libradiocompat/voice/RadioVoice.cpp
index 71d1a56..9088f01 100644
--- a/radio/aidl/compat/libradiocompat/voice/RadioVoice.cpp
+++ b/radio/aidl/compat/libradiocompat/voice/RadioVoice.cpp
@@ -40,6 +40,12 @@
return ok();
}
+ScopedAStatus RadioVoice::cancelPendingUssd(int32_t serial) {
+ LOG_CALL << serial;
+ mHal1_5->cancelPendingUssd(serial);
+ return ok();
+}
+
ScopedAStatus RadioVoice::conference(int32_t serial) {
LOG_CALL << serial;
mHal1_5->conference(serial);
@@ -201,6 +207,12 @@
return ok();
}
+ScopedAStatus RadioVoice::sendUssd(int32_t serial, const std::string& ussd) {
+ LOG_CALL << serial << ' ' << ussd;
+ mHal1_5->sendUssd(serial, ussd);
+ return ok();
+}
+
ScopedAStatus RadioVoice::separateConnection(int32_t serial, int32_t gsmIndex) {
LOG_CALL << serial;
mHal1_5->separateConnection(serial, gsmIndex);
diff --git a/radio/aidl/vts/OWNERS b/radio/aidl/vts/OWNERS
new file mode 100644
index 0000000..e75c6c8
--- /dev/null
+++ b/radio/aidl/vts/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 20868
+include ../../1.0/vts/OWNERS
+
diff --git a/radio/aidl/vts/radio_config_response.cpp b/radio/aidl/vts/radio_config_response.cpp
index 1a152fb..8d81605 100644
--- a/radio/aidl/vts/radio_config_response.cpp
+++ b/radio/aidl/vts/radio_config_response.cpp
@@ -19,12 +19,15 @@
RadioConfigResponse::RadioConfigResponse(RadioServiceTest& parent) : parent_config(parent) {}
ndk::ScopedAStatus RadioConfigResponse::getSimSlotsStatusResponse(
- const RadioResponseInfo& /* info */, const std::vector<SimSlotStatus>& /* slotStatus */) {
+ const RadioResponseInfo& info, const std::vector<SimSlotStatus>& /* slotStatus */) {
+ rspInfo = info;
+ parent_config.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioConfigResponse::setSimSlotsMappingResponse(
- const RadioResponseInfo& /* info */) {
+ndk::ScopedAStatus RadioConfigResponse::setSimSlotsMappingResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_config.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -37,22 +40,28 @@
}
ndk::ScopedAStatus RadioConfigResponse::setPreferredDataModemResponse(
- const RadioResponseInfo& /* info */) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_config.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioConfigResponse::getNumOfLiveModemsResponse(
- const RadioResponseInfo& /* info */, const int8_t /* numOfLiveModems */) {
+ const RadioResponseInfo& info, const int8_t /* numOfLiveModems */) {
+ rspInfo = info;
+ parent_config.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioConfigResponse::setNumOfLiveModemsResponse(
- const RadioResponseInfo& /* info */) {
+ndk::ScopedAStatus RadioConfigResponse::setNumOfLiveModemsResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_config.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioConfigResponse::getHalDeviceCapabilitiesResponse(
const RadioResponseInfo& info, bool modemReducedFeatures) {
+ rspInfo = info;
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
index 2d7fe01..a271b8a 100644
--- a/radio/aidl/vts/radio_config_test.cpp
+++ b/radio/aidl/vts/radio_config_test.cpp
@@ -54,3 +54,102 @@
ALOGI("getHalDeviceCapabilities, rspInfo.error = %s\n",
toString(radioRsp_config->rspInfo.error).c_str());
}
+
+/*
+ * Test IRadioConfig.getSimSlotsStatus() for the response returned.
+ */
+TEST_P(RadioConfigTest, getSimSlotsStatus) {
+ serial = GetRandomSerialNumber();
+ ndk::ScopedAStatus res = radio_config->getSimSlotsStatus(serial);
+ ASSERT_OK(res);
+ ALOGI("getSimSlotsStatus, rspInfo.error = %s\n",
+ toString(radioRsp_config->rspInfo.error).c_str());
+}
+
+/*
+ * Test IRadioConfig.getPhoneCapability() for the response returned.
+ */
+TEST_P(RadioConfigTest, getPhoneCapability) {
+ serial = GetRandomSerialNumber();
+ ndk::ScopedAStatus res = radio_config->getPhoneCapability(serial);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_config->rspInfo.serial);
+ ALOGI("getPhoneCapability, rspInfo.error = %s\n",
+ toString(radioRsp_config->rspInfo.error).c_str());
+
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_config->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
+
+ if (radioRsp_config->rspInfo.error == RadioError ::NONE) {
+ // maxActiveData should be greater than or equal to maxActiveInternetData.
+ EXPECT_GE(radioRsp_config->phoneCap.maxActiveData,
+ radioRsp_config->phoneCap.maxActiveInternetData);
+ // maxActiveData and maxActiveInternetData should be 0 or positive numbers.
+ EXPECT_GE(radioRsp_config->phoneCap.maxActiveInternetData, 0);
+ }
+}
+
+/*
+ * Test IRadioConfig.setPreferredDataModem() for the response returned.
+ */
+TEST_P(RadioConfigTest, setPreferredDataModem) {
+ serial = GetRandomSerialNumber();
+ ndk::ScopedAStatus res = radio_config->getPhoneCapability(serial);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_config->rspInfo.serial);
+ ALOGI("getPhoneCapability, rspInfo.error = %s\n",
+ toString(radioRsp_config->rspInfo.error).c_str());
+
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_config->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
+
+ if (radioRsp_config->rspInfo.error != RadioError ::NONE) {
+ return;
+ }
+
+ if (radioRsp_config->phoneCap.logicalModemIds.size() == 0) {
+ return;
+ }
+
+ // We get phoneCapability. Send setPreferredDataModem command
+ serial = GetRandomSerialNumber();
+ uint8_t modemId = radioRsp_config->phoneCap.logicalModemIds[0];
+ res = radio_config->setPreferredDataModem(serial, modemId);
+
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_config->rspInfo.serial);
+ ALOGI("setPreferredDataModem, rspInfo.error = %s\n",
+ toString(radioRsp_config->rspInfo.error).c_str());
+
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_config->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
+}
+
+/*
+ * Test IRadioConfig.setPreferredDataModem() with invalid arguments.
+ */
+TEST_P(RadioConfigTest, setPreferredDataModem_invalidArgument) {
+ serial = GetRandomSerialNumber();
+ uint8_t modemId = -1;
+ ndk::ScopedAStatus res = radio_config->setPreferredDataModem(serial, modemId);
+
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_config->rspInfo.serial);
+ ALOGI("setPreferredDataModem, rspInfo.error = %s\n",
+ toString(radioRsp_config->rspInfo.error).c_str());
+
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_config->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::INTERNAL_ERR}));
+}
diff --git a/radio/aidl/vts/radio_data_response.cpp b/radio/aidl/vts/radio_data_response.cpp
index 9b17bfb..8d51760 100644
--- a/radio/aidl/vts/radio_data_response.cpp
+++ b/radio/aidl/vts/radio_data_response.cpp
@@ -36,8 +36,9 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioDataResponse::deactivateDataCallResponse(
- const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioDataResponse::deactivateDataCallResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_data.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -61,11 +62,15 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioDataResponse::setDataAllowedResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioDataResponse::setDataAllowedResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_data.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioDataResponse::setDataProfileResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioDataResponse::setDataProfileResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_data.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -75,8 +80,9 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioDataResponse::setInitialAttachApnResponse(
- const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioDataResponse::setInitialAttachApnResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_data.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -94,11 +100,15 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioDataResponse::startKeepaliveResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioDataResponse::startKeepaliveResponse(const RadioResponseInfo& info,
const KeepaliveStatus& /*status*/) {
+ rspInfo = info;
+ parent_data.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioDataResponse::stopKeepaliveResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioDataResponse::stopKeepaliveResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_data.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
diff --git a/radio/aidl/vts/radio_data_test.cpp b/radio/aidl/vts/radio_data_test.cpp
index 8547e9d..f38a958 100644
--- a/radio/aidl/vts/radio_data_test.cpp
+++ b/radio/aidl/vts/radio_data_test.cpp
@@ -83,7 +83,7 @@
dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
dataProfileInfo.user = std::string("username");
dataProfileInfo.password = std::string("password");
- dataProfileInfo.type = DataProfileInfo::TYPE_THREE_GPP;
+ dataProfileInfo.type = DataProfileInfo::TYPE_3GPP;
dataProfileInfo.maxConnsTime = 300;
dataProfileInfo.maxConns = 20;
dataProfileInfo.waitTime = 0;
@@ -157,7 +157,7 @@
dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
dataProfileInfo.user = std::string("username");
dataProfileInfo.password = std::string("password");
- dataProfileInfo.type = DataProfileInfo::TYPE_THREE_GPP;
+ dataProfileInfo.type = DataProfileInfo::TYPE_3GPP;
dataProfileInfo.maxConnsTime = 300;
dataProfileInfo.maxConns = 20;
dataProfileInfo.waitTime = 0;
@@ -309,3 +309,280 @@
sleep(1);
}
+
+/*
+ * Test IRadioData.setInitialAttachApn() for the response returned.
+ */
+TEST_P(RadioDataTest, setInitialAttachApn) {
+ serial = GetRandomSerialNumber();
+
+ // Create a dataProfileInfo
+ DataProfileInfo dataProfileInfo;
+ memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
+ dataProfileInfo.profileId = DataProfileInfo::ID_DEFAULT;
+ dataProfileInfo.apn = std::string("internet");
+ dataProfileInfo.protocol = PdpProtocolType::IPV4V6;
+ dataProfileInfo.roamingProtocol = PdpProtocolType::IPV4V6;
+ dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
+ dataProfileInfo.user = std::string("username");
+ dataProfileInfo.password = std::string("password");
+ dataProfileInfo.type = DataProfileInfo::TYPE_3GPP;
+ dataProfileInfo.maxConnsTime = 300;
+ dataProfileInfo.maxConns = 20;
+ dataProfileInfo.waitTime = 0;
+ dataProfileInfo.enabled = true;
+ dataProfileInfo.supportedApnTypesBitmap = 320;
+ dataProfileInfo.bearerBitmap = 161543;
+ dataProfileInfo.mtuV4 = 0;
+ dataProfileInfo.mtuV6 = 0;
+ dataProfileInfo.preferred = true;
+ dataProfileInfo.persistent = false;
+
+ radio_data->setInitialAttachApn(serial, dataProfileInfo);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE}));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE}));
+ }
+}
+
+/*
+ * Test IRadioData.setDataProfile() for the response returned.
+ */
+TEST_P(RadioDataTest, setDataProfile) {
+ serial = GetRandomSerialNumber();
+
+ // Create a dataProfileInfo
+ DataProfileInfo dataProfileInfo;
+ memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
+ dataProfileInfo.profileId = DataProfileInfo::ID_DEFAULT;
+ dataProfileInfo.apn = std::string("internet");
+ dataProfileInfo.protocol = PdpProtocolType::IPV4V6;
+ dataProfileInfo.roamingProtocol = PdpProtocolType::IPV4V6;
+ dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
+ dataProfileInfo.user = std::string("username");
+ dataProfileInfo.password = std::string("password");
+ dataProfileInfo.type = DataProfileInfo::TYPE_3GPP;
+ dataProfileInfo.maxConnsTime = 300;
+ dataProfileInfo.maxConns = 20;
+ dataProfileInfo.waitTime = 0;
+ dataProfileInfo.enabled = true;
+ dataProfileInfo.supportedApnTypesBitmap = 320;
+ dataProfileInfo.bearerBitmap = 161543;
+ dataProfileInfo.mtuV4 = 0;
+ dataProfileInfo.mtuV6 = 0;
+ dataProfileInfo.preferred = true;
+ dataProfileInfo.persistent = true;
+
+ // Create a dataProfileInfoList
+ std::vector<DataProfileInfo> dataProfileInfoList = {dataProfileInfo};
+
+ radio_data->setDataProfile(serial, dataProfileInfoList);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE}));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE}));
+ }
+}
+
+/*
+ * Test IRadioData.deactivateDataCall() for the response returned.
+ */
+TEST_P(RadioDataTest, deactivateDataCall) {
+ serial = GetRandomSerialNumber();
+ int cid = 1;
+ DataRequestReason reason = DataRequestReason::NORMAL;
+
+ ndk::ScopedAStatus res = radio_data->deactivateDataCall(serial, cid, reason);
+ ASSERT_OK(res);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(
+ CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::INVALID_CALL_ID, RadioError::INVALID_STATE,
+ RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED,
+ RadioError::CANCELLED, RadioError::SIM_ABSENT}));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_data->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INVALID_CALL_ID,
+ RadioError::INVALID_STATE, RadioError::INVALID_ARGUMENTS,
+ RadioError::REQUEST_NOT_SUPPORTED, RadioError::CANCELLED}));
+ }
+}
+
+/*
+ * Test IRadioData.startKeepalive() for the response returned.
+ */
+TEST_P(RadioDataTest, startKeepalive) {
+ std::vector<KeepaliveRequest> requests = {
+ {
+ // Invalid IPv4 source address
+ KeepaliveRequest::TYPE_NATT_IPV4,
+ {192, 168, 0 /*, 100*/},
+ 1234,
+ {8, 8, 4, 4},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid IPv4 destination address
+ KeepaliveRequest::TYPE_NATT_IPV4,
+ {192, 168, 0, 100},
+ 1234,
+ {8, 8, 4, 4, 1, 2, 3, 4},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid Keepalive Type
+ -1,
+ {192, 168, 0, 100},
+ 1234,
+ {8, 8, 4, 4},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid IPv6 source address
+ KeepaliveRequest::TYPE_NATT_IPV6,
+ {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE,
+ 0xED, 0xBE, 0xEF, 0xBD},
+ 1234,
+ {0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x88, 0x44},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid IPv6 destination address
+ KeepaliveRequest::TYPE_NATT_IPV6,
+ {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE,
+ 0xED, 0xBE, 0xEF},
+ 1234,
+ {0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x88,
+ /*0x44*/},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid Context ID (cid), this should survive the initial
+ // range checking and fail in the modem data layer
+ KeepaliveRequest::TYPE_NATT_IPV4,
+ {192, 168, 0, 100},
+ 1234,
+ {8, 8, 4, 4},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid Context ID (cid), this should survive the initial
+ // range checking and fail in the modem data layer
+ KeepaliveRequest::TYPE_NATT_IPV6,
+ {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE,
+ 0xED, 0xBE, 0xEF},
+ 1234,
+ {0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x88, 0x44},
+ 4500,
+ 20000,
+ 0xBAD,
+ }};
+
+ for (auto req = requests.begin(); req != requests.end(); req++) {
+ serial = GetRandomSerialNumber();
+ radio_data->startKeepalive(serial, *req);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
+
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_data->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INVALID_ARGUMENTS,
+ RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+}
+
+/*
+ * Test IRadioData.stopKeepalive() for the response returned.
+ */
+TEST_P(RadioDataTest, stopKeepalive) {
+ serial = GetRandomSerialNumber();
+
+ radio_data->stopKeepalive(serial, 0xBAD);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
+
+ ASSERT_TRUE(
+ CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
+}
+
+/*
+ * Test IRadioData.getDataCallList() for the response returned.
+ */
+TEST_P(RadioDataTest, getDataCallList) {
+ LOG(DEBUG) << "getDataCallList";
+ serial = GetRandomSerialNumber();
+
+ radio_data->getDataCallList(serial);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_data->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::SIM_ABSENT}));
+ }
+ LOG(DEBUG) << "getDataCallList finished";
+}
+
+/*
+ * Test IRadioData.setDataAllowed() for the response returned.
+ */
+TEST_P(RadioDataTest, setDataAllowed) {
+ LOG(DEBUG) << "setDataAllowed";
+ serial = GetRandomSerialNumber();
+ bool allow = true;
+
+ radio_data->setDataAllowed(serial, allow);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp_data->rspInfo.error);
+ }
+ LOG(DEBUG) << "setDataAllowed finished";
+}
diff --git a/radio/aidl/vts/radio_messaging_indication.cpp b/radio/aidl/vts/radio_messaging_indication.cpp
index c69611f..481239e 100644
--- a/radio/aidl/vts/radio_messaging_indication.cpp
+++ b/radio/aidl/vts/radio_messaging_indication.cpp
@@ -48,12 +48,6 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioMessagingIndication::onUssd(RadioIndicationType /*type*/,
- UssdModeType /*modeType*/,
- const std::string& /*msg*/) {
- return ndk::ScopedAStatus::ok();
-}
-
ndk::ScopedAStatus RadioMessagingIndication::simSmsStorageFull(RadioIndicationType /*type*/) {
return ndk::ScopedAStatus::ok();
}
diff --git a/radio/aidl/vts/radio_messaging_response.cpp b/radio/aidl/vts/radio_messaging_response.cpp
index 718df7e..49c0806 100644
--- a/radio/aidl/vts/radio_messaging_response.cpp
+++ b/radio/aidl/vts/radio_messaging_response.cpp
@@ -20,17 +20,23 @@
: parent_messaging(parent) {}
ndk::ScopedAStatus RadioMessagingResponse::acknowledgeIncomingGsmSmsWithPduResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::acknowledgeLastIncomingCdmaSmsResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::acknowledgeLastIncomingGsmSmsResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -38,40 +44,43 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioMessagingResponse::cancelPendingUssdResponse(
- const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioMessagingResponse::deleteSmsOnRuimResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioMessagingResponse::deleteSmsOnRuimResponse(
- const RadioResponseInfo& /*info*/) {
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioMessagingResponse::deleteSmsOnSimResponse(
- const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioMessagingResponse::deleteSmsOnSimResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::getCdmaBroadcastConfigResponse(
- const RadioResponseInfo& /*info*/,
- const std::vector<CdmaBroadcastSmsConfigInfo>& /*configs*/) {
+ const RadioResponseInfo& info, const std::vector<CdmaBroadcastSmsConfigInfo>& /*configs*/) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::getGsmBroadcastConfigResponse(
- const RadioResponseInfo& /*info*/,
- const std::vector<GsmBroadcastSmsConfigInfo>& /*configs*/) {
+ const RadioResponseInfo& info, const std::vector<GsmBroadcastSmsConfigInfo>& /*configs*/) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioMessagingResponse::getSmscAddressResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioMessagingResponse::getSmscAddressResponse(const RadioResponseInfo& info,
const std::string& /*smsc*/) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::reportSmsMemoryStatusResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -91,8 +100,10 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioMessagingResponse::sendImsSmsResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioMessagingResponse::sendImsSmsResponse(const RadioResponseInfo& info,
const SendSmsResult& /*sms*/) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -112,41 +123,50 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioMessagingResponse::sendUssdResponse(const RadioResponseInfo& /*info*/) {
- return ndk::ScopedAStatus::ok();
-}
-
ndk::ScopedAStatus RadioMessagingResponse::setCdmaBroadcastActivationResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::setCdmaBroadcastConfigResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::setGsmBroadcastActivationResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::setGsmBroadcastConfigResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioMessagingResponse::setSmscAddressResponse(
- const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioMessagingResponse::setSmscAddressResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioMessagingResponse::writeSmsToRuimResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioMessagingResponse::writeSmsToRuimResponse(const RadioResponseInfo& info,
int32_t /*index*/) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioMessagingResponse::writeSmsToSimResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioMessagingResponse::writeSmsToSimResponse(const RadioResponseInfo& info,
int32_t /*index*/) {
+ rspInfo = info;
+ parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
diff --git a/radio/aidl/vts/radio_messaging_test.cpp b/radio/aidl/vts/radio_messaging_test.cpp
index 8abd91d..9f1718b 100644
--- a/radio/aidl/vts/radio_messaging_test.cpp
+++ b/radio/aidl/vts/radio_messaging_test.cpp
@@ -197,3 +197,535 @@
CHECK_GENERAL_ERROR));
}
}
+
+/*
+ * Test IRadioMessaging.setGsmBroadcastConfig() for the response returned.
+ */
+TEST_P(RadioMessagingTest, setGsmBroadcastConfig) {
+ LOG(DEBUG) << "setGsmBroadcastConfig";
+ serial = GetRandomSerialNumber();
+
+ // Create GsmBroadcastSmsConfigInfo #1
+ GsmBroadcastSmsConfigInfo gbSmsConfig1;
+ gbSmsConfig1.fromServiceId = 4352;
+ gbSmsConfig1.toServiceId = 4354;
+ gbSmsConfig1.fromCodeScheme = 0;
+ gbSmsConfig1.toCodeScheme = 255;
+ gbSmsConfig1.selected = true;
+
+ // Create GsmBroadcastSmsConfigInfo #2
+ GsmBroadcastSmsConfigInfo gbSmsConfig2;
+ gbSmsConfig2.fromServiceId = 4356;
+ gbSmsConfig2.toServiceId = 4356;
+ gbSmsConfig2.fromCodeScheme = 0;
+ gbSmsConfig2.toCodeScheme = 255;
+ gbSmsConfig2.selected = true;
+
+ // Create GsmBroadcastSmsConfigInfo #3
+ GsmBroadcastSmsConfigInfo gbSmsConfig3;
+ gbSmsConfig3.fromServiceId = 4370;
+ gbSmsConfig3.toServiceId = 4379;
+ gbSmsConfig3.fromCodeScheme = 0;
+ gbSmsConfig3.toCodeScheme = 255;
+ gbSmsConfig3.selected = true;
+
+ // Create GsmBroadcastSmsConfigInfo #4
+ GsmBroadcastSmsConfigInfo gbSmsConfig4;
+ gbSmsConfig4.fromServiceId = 4383;
+ gbSmsConfig4.toServiceId = 4391;
+ gbSmsConfig4.fromCodeScheme = 0;
+ gbSmsConfig4.toCodeScheme = 255;
+ gbSmsConfig4.selected = true;
+
+ // Create GsmBroadcastSmsConfigInfo #5
+ GsmBroadcastSmsConfigInfo gbSmsConfig5;
+ gbSmsConfig5.fromServiceId = 4392;
+ gbSmsConfig5.toServiceId = 4392;
+ gbSmsConfig5.fromCodeScheme = 0;
+ gbSmsConfig5.toCodeScheme = 255;
+ gbSmsConfig5.selected = true;
+
+ std::vector<GsmBroadcastSmsConfigInfo> gsmBroadcastSmsConfigsInfoList = {
+ gbSmsConfig1, gbSmsConfig2, gbSmsConfig3, gbSmsConfig4, gbSmsConfig5};
+
+ radio_messaging->setGsmBroadcastConfig(serial, gsmBroadcastSmsConfigsInfoList);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS,
+ RadioError::INVALID_MODEM_STATE, RadioError::INVALID_STATE},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "setGsmBroadcastConfig finished";
+}
+
+/*
+ * Test IRadioMessaging.getGsmBroadcastConfig() for the response returned.
+ */
+TEST_P(RadioMessagingTest, getGsmBroadcastConfig) {
+ LOG(DEBUG) << "getGsmBroadcastConfig";
+ serial = GetRandomSerialNumber();
+
+ radio_messaging->getGsmBroadcastConfig(serial);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_messaging->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_MODEM_STATE, RadioError::INVALID_STATE},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "getGsmBroadcastConfig finished";
+}
+
+/*
+ * Test IRadioMessaging.setCdmaBroadcastConfig() for the response returned.
+ */
+TEST_P(RadioMessagingTest, setCdmaBroadcastConfig) {
+ LOG(DEBUG) << "setCdmaBroadcastConfig";
+ serial = GetRandomSerialNumber();
+
+ CdmaBroadcastSmsConfigInfo cbSmsConfig;
+ cbSmsConfig.serviceCategory = 4096;
+ cbSmsConfig.language = 1;
+ cbSmsConfig.selected = true;
+
+ std::vector<CdmaBroadcastSmsConfigInfo> cdmaBroadcastSmsConfigInfoList = {cbSmsConfig};
+
+ radio_messaging->setCdmaBroadcastConfig(serial, cdmaBroadcastSmsConfigInfoList);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_MODEM_STATE},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "setCdmaBroadcastConfig finished";
+}
+
+/*
+ * Test IRadioMessaging.getCdmaBroadcastConfig() for the response returned.
+ */
+TEST_P(RadioMessagingTest, getCdmaBroadcastConfig) {
+ LOG(DEBUG) << "getCdmaBroadcastConfig";
+ serial = GetRandomSerialNumber();
+
+ radio_messaging->getCdmaBroadcastConfig(serial);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error, {RadioError::NONE},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "getCdmaBroadcastConfig finished";
+}
+
+/*
+ * Test IRadioMessaging.setCdmaBroadcastActivation() for the response returned.
+ */
+TEST_P(RadioMessagingTest, setCdmaBroadcastActivation) {
+ LOG(DEBUG) << "setCdmaBroadcastActivation";
+ serial = GetRandomSerialNumber();
+ bool activate = false;
+
+ radio_messaging->setCdmaBroadcastActivation(serial, activate);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "setCdmaBroadcastActivation finished";
+}
+
+/*
+ * Test IRadioMessaging.setGsmBroadcastActivation() for the response returned.
+ */
+TEST_P(RadioMessagingTest, setGsmBroadcastActivation) {
+ LOG(DEBUG) << "setGsmBroadcastActivation";
+ serial = GetRandomSerialNumber();
+ bool activate = false;
+
+ radio_messaging->setGsmBroadcastActivation(serial, activate);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_messaging->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_MODEM_STATE,
+ RadioError::INVALID_STATE, RadioError::OPERATION_NOT_ALLOWED},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "setGsmBroadcastActivation finished";
+}
+
+/*
+ * Test IRadioMessaging.acknowledgeLastIncomingGsmSms() for the response returned.
+ */
+TEST_P(RadioMessagingTest, acknowledgeLastIncomingGsmSms) {
+ LOG(DEBUG) << "acknowledgeLastIncomingGsmSms";
+ serial = GetRandomSerialNumber();
+ bool success = true;
+
+ radio_messaging->acknowledgeLastIncomingGsmSms(
+ serial, success, SmsAcknowledgeFailCause::MEMORY_CAPACITY_EXCEEDED);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "acknowledgeLastIncomingGsmSms finished";
+}
+
+/*
+ * Test IRadioMessaging.acknowledgeIncomingGsmSmsWithPdu() for the response returned.
+ */
+TEST_P(RadioMessagingTest, acknowledgeIncomingGsmSmsWithPdu) {
+ LOG(DEBUG) << "acknowledgeIncomingGsmSmsWithPdu";
+ serial = GetRandomSerialNumber();
+ bool success = true;
+ std::string ackPdu = "";
+
+ radio_messaging->acknowledgeIncomingGsmSmsWithPdu(serial, success, ackPdu);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::NO_SMS_TO_ACK},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "acknowledgeIncomingGsmSmsWithPdu finished";
+}
+
+/*
+ * Test IRadioMessaging.acknowledgeLastIncomingCdmaSms() for the response returned.
+ */
+TEST_P(RadioMessagingTest, acknowledgeLastIncomingCdmaSms) {
+ LOG(DEBUG) << "acknowledgeLastIncomingCdmaSms";
+ serial = GetRandomSerialNumber();
+
+ // Create a CdmaSmsAck
+ CdmaSmsAck cdmaSmsAck;
+ cdmaSmsAck.errorClass = false;
+ cdmaSmsAck.smsCauseCode = 1;
+
+ radio_messaging->acknowledgeLastIncomingCdmaSms(serial, cdmaSmsAck);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::NO_SMS_TO_ACK},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "acknowledgeLastIncomingCdmaSms finished";
+}
+
+/*
+ * Test IRadioMessaging.sendImsSms() for the response returned.
+ */
+TEST_P(RadioMessagingTest, sendImsSms) {
+ LOG(DEBUG) << "sendImsSms";
+ serial = GetRandomSerialNumber();
+
+ // Create a CdmaSmsAddress
+ CdmaSmsAddress cdmaSmsAddress;
+ cdmaSmsAddress.digitMode = CdmaSmsAddress::DIGIT_MODE_FOUR_BIT;
+ cdmaSmsAddress.isNumberModeDataNetwork = false;
+ cdmaSmsAddress.numberType = CdmaSmsAddress::NUMBER_TYPE_UNKNOWN;
+ cdmaSmsAddress.numberPlan = CdmaSmsAddress::NUMBER_PLAN_UNKNOWN;
+ cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
+
+ // Create a CdmaSmsSubAddress
+ CdmaSmsSubaddress cdmaSmsSubaddress;
+ cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddress::SUBADDRESS_TYPE_NSAP;
+ cdmaSmsSubaddress.odd = false;
+ cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
+
+ // Create a CdmaSmsMessage
+ CdmaSmsMessage cdmaSmsMessage;
+ cdmaSmsMessage.teleserviceId = 4098;
+ cdmaSmsMessage.isServicePresent = false;
+ cdmaSmsMessage.serviceCategory = 0;
+ cdmaSmsMessage.address = cdmaSmsAddress;
+ cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
+ cdmaSmsMessage.bearerData =
+ (std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
+
+ // Creata an ImsSmsMessage
+ ImsSmsMessage msg;
+ msg.tech = RadioTechnologyFamily::THREE_GPP2;
+ msg.retry = false;
+ msg.messageRef = 0;
+ msg.cdmaMessage = (std::vector<CdmaSmsMessage>){cdmaSmsMessage};
+ msg.gsmMessage = (std::vector<GsmSmsMessage>){};
+
+ radio_messaging->sendImsSms(serial, msg);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS}, CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "sendImsSms finished";
+}
+
+/*
+ * Test IRadioMessaging.getSmscAddress() for the response returned.
+ */
+TEST_P(RadioMessagingTest, getSmscAddress) {
+ LOG(DEBUG) << "getSmscAddress";
+ serial = GetRandomSerialNumber();
+
+ radio_messaging->getSmscAddress(serial);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
+ {RadioError::INVALID_MODEM_STATE, RadioError::INVALID_STATE,
+ RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "getSmscAddress finished";
+}
+
+/*
+ * Test IRadioMessaging.setSmscAddress() for the response returned.
+ */
+TEST_P(RadioMessagingTest, setSmscAddress) {
+ LOG(DEBUG) << "setSmscAddress";
+ serial = GetRandomSerialNumber();
+ std::string address = std::string("smscAddress");
+
+ radio_messaging->setSmscAddress(serial, address);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_SMS_FORMAT,
+ RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "setSmscAddress finished";
+}
+
+/*
+ * Test IRadioMessaging.writeSmsToSim() for the response returned.
+ */
+TEST_P(RadioMessagingTest, writeSmsToSim) {
+ LOG(DEBUG) << "writeSmsToSim";
+ serial = GetRandomSerialNumber();
+ SmsWriteArgs smsWriteArgs;
+ smsWriteArgs.status = SmsWriteArgs::STATUS_REC_UNREAD;
+ smsWriteArgs.smsc = "";
+ smsWriteArgs.pdu = "01000b916105770203f3000006d4f29c3e9b01";
+
+ radio_messaging->writeSmsToSim(serial, smsWriteArgs);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_messaging->rspInfo.error,
+ {RadioError::NONE, RadioError::ENCODING_ERR, RadioError::INVALID_ARGUMENTS,
+ RadioError::INVALID_SMSC_ADDRESS, RadioError::MODEM_ERR,
+ RadioError::NETWORK_NOT_READY, RadioError::NO_RESOURCES, RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "writeSmsToSim finished";
+}
+
+/*
+ * Test IRadioMessaging.deleteSmsOnSim() for the response returned.
+ */
+TEST_P(RadioMessagingTest, deleteSmsOnSim) {
+ LOG(DEBUG) << "deleteSmsOnSim";
+ serial = GetRandomSerialNumber();
+ int index = 1;
+
+ radio_messaging->deleteSmsOnSim(serial, index);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_messaging->rspInfo.error,
+ {RadioError::NONE, RadioError::ENCODING_ERR, RadioError::INVALID_ARGUMENTS,
+ RadioError::INVALID_MODEM_STATE, RadioError::NO_SUCH_ENTRY, RadioError::MODEM_ERR,
+ RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "deleteSmsOnSim finished";
+}
+
+/*
+ * Test IRadioMessaging.writeSmsToRuim() for the response returned.
+ */
+TEST_P(RadioMessagingTest, writeSmsToRuim) {
+ LOG(DEBUG) << "writeSmsToRuim";
+ serial = GetRandomSerialNumber();
+
+ // Create a CdmaSmsAddress
+ CdmaSmsAddress cdmaSmsAddress;
+ cdmaSmsAddress.digitMode = CdmaSmsAddress::DIGIT_MODE_FOUR_BIT;
+ cdmaSmsAddress.isNumberModeDataNetwork = false;
+ cdmaSmsAddress.numberType = CdmaSmsAddress::NUMBER_TYPE_UNKNOWN;
+ cdmaSmsAddress.numberPlan = CdmaSmsAddress::NUMBER_PLAN_UNKNOWN;
+ cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
+
+ // Create a CdmaSmsSubAddress
+ CdmaSmsSubaddress cdmaSmsSubaddress;
+ cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddress::SUBADDRESS_TYPE_NSAP;
+ cdmaSmsSubaddress.odd = false;
+ cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
+
+ // Create a CdmaSmsMessage
+ CdmaSmsMessage cdmaSmsMessage;
+ cdmaSmsMessage.teleserviceId = 4098;
+ cdmaSmsMessage.isServicePresent = false;
+ cdmaSmsMessage.serviceCategory = 0;
+ cdmaSmsMessage.address = cdmaSmsAddress;
+ cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
+ cdmaSmsMessage.bearerData =
+ (std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
+
+ // Create a CdmaSmsWriteArgs
+ CdmaSmsWriteArgs cdmaSmsWriteArgs;
+ cdmaSmsWriteArgs.status = CdmaSmsWriteArgs::STATUS_REC_UNREAD;
+ cdmaSmsWriteArgs.message = cdmaSmsMessage;
+
+ radio_messaging->writeSmsToRuim(serial, cdmaSmsWriteArgs);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_messaging->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_SMS_FORMAT,
+ RadioError::INVALID_SMSC_ADDRESS, RadioError::INVALID_STATE, RadioError::MODEM_ERR,
+ RadioError::NO_SUCH_ENTRY, RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "writeSmsToRuim finished";
+}
+
+/*
+ * Test IRadioMessaging.deleteSmsOnRuim() for the response returned.
+ */
+TEST_P(RadioMessagingTest, deleteSmsOnRuim) {
+ LOG(DEBUG) << "deleteSmsOnRuim";
+ serial = GetRandomSerialNumber();
+ int index = 1;
+
+ // Create a CdmaSmsAddress
+ CdmaSmsAddress cdmaSmsAddress;
+ cdmaSmsAddress.digitMode = CdmaSmsAddress::DIGIT_MODE_FOUR_BIT;
+ cdmaSmsAddress.isNumberModeDataNetwork = false;
+ cdmaSmsAddress.numberType = CdmaSmsAddress::NUMBER_TYPE_UNKNOWN;
+ cdmaSmsAddress.numberPlan = CdmaSmsAddress::NUMBER_PLAN_UNKNOWN;
+ cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
+
+ // Create a CdmaSmsSubAddress
+ CdmaSmsSubaddress cdmaSmsSubaddress;
+ cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddress::SUBADDRESS_TYPE_NSAP;
+ cdmaSmsSubaddress.odd = false;
+ cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
+
+ // Create a CdmaSmsMessage
+ CdmaSmsMessage cdmaSmsMessage;
+ cdmaSmsMessage.teleserviceId = 4098;
+ cdmaSmsMessage.isServicePresent = false;
+ cdmaSmsMessage.serviceCategory = 0;
+ cdmaSmsMessage.address = cdmaSmsAddress;
+ cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
+ cdmaSmsMessage.bearerData =
+ (std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
+
+ // Create a CdmaSmsWriteArgs
+ CdmaSmsWriteArgs cdmaSmsWriteArgs;
+ cdmaSmsWriteArgs.status = CdmaSmsWriteArgs::STATUS_REC_UNREAD;
+ cdmaSmsWriteArgs.message = cdmaSmsMessage;
+
+ radio_messaging->deleteSmsOnRuim(serial, index);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_messaging->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_MODEM_STATE,
+ RadioError::MODEM_ERR, RadioError::NO_SUCH_ENTRY, RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "deleteSmsOnRuim finished";
+}
+
+/*
+ * Test IRadioMessaging.reportSmsMemoryStatus() for the response returned.
+ */
+TEST_P(RadioMessagingTest, reportSmsMemoryStatus) {
+ LOG(DEBUG) << "reportSmsMemoryStatus";
+ serial = GetRandomSerialNumber();
+ bool available = true;
+
+ radio_messaging->reportSmsMemoryStatus(serial, available);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE,
+ RadioError::MODEM_ERR, RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "reportSmsMemoryStatus finished";
+}
diff --git a/radio/aidl/vts/radio_messaging_utils.h b/radio/aidl/vts/radio_messaging_utils.h
index 7bb99cd..7b66192 100644
--- a/radio/aidl/vts/radio_messaging_utils.h
+++ b/radio/aidl/vts/radio_messaging_utils.h
@@ -49,8 +49,6 @@
virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
- virtual ndk::ScopedAStatus cancelPendingUssdResponse(const RadioResponseInfo& info) override;
-
virtual ndk::ScopedAStatus deleteSmsOnRuimResponse(const RadioResponseInfo& info) override;
virtual ndk::ScopedAStatus deleteSmsOnSimResponse(const RadioResponseInfo& info) override;
@@ -84,8 +82,6 @@
virtual ndk::ScopedAStatus sendSmsResponse(const RadioResponseInfo& info,
const SendSmsResult& sms) override;
- virtual ndk::ScopedAStatus sendUssdResponse(const RadioResponseInfo& info) override;
-
virtual ndk::ScopedAStatus setCdmaBroadcastActivationResponse(
const RadioResponseInfo& info) override;
@@ -132,9 +128,6 @@
virtual ndk::ScopedAStatus newSmsStatusReport(RadioIndicationType type,
const std::vector<uint8_t>& pdu) override;
- virtual ndk::ScopedAStatus onUssd(RadioIndicationType type, UssdModeType modeType,
- const std::string& msg) override;
-
virtual ndk::ScopedAStatus simSmsStorageFull(RadioIndicationType type) override;
};
diff --git a/radio/aidl/vts/radio_modem_response.cpp b/radio/aidl/vts/radio_modem_response.cpp
index 53bfab4..d2715a8 100644
--- a/radio/aidl/vts/radio_modem_response.cpp
+++ b/radio/aidl/vts/radio_modem_response.cpp
@@ -22,70 +22,99 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioModemResponse::enableModemResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioModemResponse::enableModemResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioModemResponse::getBasebandVersionResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioModemResponse::getBasebandVersionResponse(const RadioResponseInfo& info,
const std::string& /*version*/) {
+ rspInfo = info;
+ parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioModemResponse::getDeviceIdentityResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioModemResponse::getDeviceIdentityResponse(const RadioResponseInfo& info,
const std::string& /*imei*/,
const std::string& /*imeisv*/,
const std::string& /*esn*/,
const std::string& /*meid*/) {
+ rspInfo = info;
+ parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::getHardwareConfigResponse(
- const RadioResponseInfo& /*info*/, const std::vector<HardwareConfig>& /*config*/) {
+ const RadioResponseInfo& info, const std::vector<HardwareConfig>& /*config*/) {
+ rspInfo = info;
+ parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::getModemActivityInfoResponse(
- const RadioResponseInfo& /*info*/, const ActivityStatsInfo& /*activityInfo*/) {
+ const RadioResponseInfo& info, const ActivityStatsInfo& /*activityInfo*/) {
+ rspInfo = info;
+ parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioModemResponse::getModemStackStatusResponse(
- const RadioResponseInfo& /*info*/, const bool /*enabled*/) {
+ndk::ScopedAStatus RadioModemResponse::getModemStackStatusResponse(const RadioResponseInfo& info,
+ const bool enabled) {
+ rspInfo = info;
+ isModemEnabled = enabled;
+ parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioModemResponse::getRadioCapabilityResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioModemResponse::getRadioCapabilityResponse(const RadioResponseInfo& info,
const RadioCapability& /*rc*/) {
+ rspInfo = info;
+ parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioModemResponse::nvReadItemResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioModemResponse::nvReadItemResponse(const RadioResponseInfo& info,
const std::string& /*result*/) {
+ rspInfo = info;
+ parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioModemResponse::nvResetConfigResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioModemResponse::nvResetConfigResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioModemResponse::nvWriteCdmaPrlResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioModemResponse::nvWriteCdmaPrlResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioModemResponse::nvWriteItemResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioModemResponse::nvWriteItemResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioModemResponse::requestShutdownResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioModemResponse::requestShutdownResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioModemResponse::sendDeviceStateResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioModemResponse::sendDeviceStateResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioModemResponse::setRadioCapabilityResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioModemResponse::setRadioCapabilityResponse(const RadioResponseInfo& info,
const RadioCapability& /*rc*/) {
+ rspInfo = info;
+ parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
diff --git a/radio/aidl/vts/radio_modem_test.cpp b/radio/aidl/vts/radio_modem_test.cpp
index b40bb7b..f88da13 100644
--- a/radio/aidl/vts/radio_modem_test.cpp
+++ b/radio/aidl/vts/radio_modem_test.cpp
@@ -87,3 +87,301 @@
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error);
}
+
+/*
+ * Test IRadioModem.enableModem() for the response returned.
+ */
+TEST_P(RadioModemTest, enableModem) {
+ serial = GetRandomSerialNumber();
+
+ if (isSsSsEnabled()) {
+ ALOGI("enableModem, no need to test in single SIM mode");
+ return;
+ }
+
+ bool responseToggle = radioRsp_modem->enableModemResponseToggle;
+ ndk::ScopedAStatus res = radio_modem->enableModem(serial, true);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+ ALOGI("getModemStackStatus, rspInfo.error = %s\n",
+ toString(radioRsp_modem->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::MODEM_ERR, RadioError::INVALID_STATE}));
+
+ // checking if getModemStackStatus returns true, as modem was enabled above
+ if (RadioError::NONE == radioRsp_modem->rspInfo.error) {
+ // wait until modem enabling is finished
+ while (responseToggle == radioRsp_modem->enableModemResponseToggle) {
+ sleep(1);
+ }
+ ndk::ScopedAStatus resEnabled = radio_modem->getModemStackStatus(serial);
+ ASSERT_OK(resEnabled);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+ ALOGI("getModemStackStatus, rspInfo.error = %s\n",
+ toString(radioRsp_modem->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::MODEM_ERR, RadioError::INVALID_STATE}));
+ // verify that enableModem did set isEnabled correctly
+ EXPECT_EQ(true, radioRsp_modem->isModemEnabled);
+ }
+}
+
+/*
+ * Test IRadioModem.getModemStackStatus() for the response returned.
+ */
+TEST_P(RadioModemTest, getModemStackStatus) {
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res = radio_modem->getModemStackStatus(serial);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+ ALOGI("getModemStackStatus, rspInfo.error = %s\n",
+ toString(radioRsp_modem->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_modem->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR}));
+}
+
+/*
+ * Test IRadioModem.getBasebandVersion() for the response returned.
+ */
+TEST_P(RadioModemTest, getBasebandVersion) {
+ LOG(DEBUG) << "getBasebandVersion";
+ serial = GetRandomSerialNumber();
+
+ radio_modem->getBasebandVersion(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error);
+ }
+ LOG(DEBUG) << "getBasebandVersion finished";
+}
+
+/*
+ * Test IRadioModem.getDeviceIdentity() for the response returned.
+ */
+TEST_P(RadioModemTest, getDeviceIdentity) {
+ LOG(DEBUG) << "getDeviceIdentity";
+ serial = GetRandomSerialNumber();
+
+ radio_modem->getDeviceIdentity(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
+ {RadioError::NONE, RadioError::EMPTY_RECORD}));
+ }
+ LOG(DEBUG) << "getDeviceIdentity finished";
+}
+
+/*
+ * Test IRadioModem.nvReadItem() for the response returned.
+ */
+TEST_P(RadioModemTest, nvReadItem) {
+ LOG(DEBUG) << "nvReadItem";
+ serial = GetRandomSerialNumber();
+
+ radio_modem->nvReadItem(serial, NvItem::LTE_BAND_ENABLE_25);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "nvReadItem finished";
+}
+
+/*
+ * Test IRadioModem.nvWriteItem() for the response returned.
+ */
+TEST_P(RadioModemTest, nvWriteItem) {
+ LOG(DEBUG) << "nvWriteItem";
+ serial = GetRandomSerialNumber();
+ NvWriteItem item;
+ memset(&item, 0, sizeof(item));
+ item.value = std::string();
+
+ radio_modem->nvWriteItem(serial, item);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "nvWriteItem finished";
+}
+
+/*
+ * Test IRadioModem.nvWriteCdmaPrl() for the response returned.
+ */
+TEST_P(RadioModemTest, nvWriteCdmaPrl) {
+ LOG(DEBUG) << "nvWriteCdmaPrl";
+ serial = GetRandomSerialNumber();
+ std::vector<uint8_t> prl = {1, 2, 3, 4, 5};
+
+ radio_modem->nvWriteCdmaPrl(serial, std::vector<uint8_t>(prl));
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "nvWriteCdmaPrl finished";
+}
+
+/*
+ * Test IRadioModem.nvResetConfig() for the response returned.
+ */
+TEST_P(RadioModemTest, nvResetConfig) {
+ LOG(DEBUG) << "nvResetConfig";
+ serial = GetRandomSerialNumber();
+
+ radio_modem->nvResetConfig(serial, ResetNvType::FACTORY_RESET);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+ LOG(DEBUG) << "nvResetConfig finished";
+}
+
+/*
+ * Test IRadioModem.getHardwareConfig() for the response returned.
+ */
+TEST_P(RadioModemTest, getHardwareConfig) {
+ LOG(DEBUG) << "getHardwareConfig";
+ serial = GetRandomSerialNumber();
+
+ radio_modem->getHardwareConfig(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "getHardwareConfig finished";
+}
+
+/*
+ * The following test is disabled due to b/64734869
+ *
+ * Test IRadioModem.requestShutdown() for the response returned.
+ */
+TEST_P(RadioModemTest, DISABLED_requestShutdown) {
+ serial = GetRandomSerialNumber();
+
+ radio_modem->requestShutdown(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE},
+ CHECK_GENERAL_ERROR));
+ }
+}
+
+/*
+ * Test IRadioModem.getRadioCapability() for the response returned.
+ */
+TEST_P(RadioModemTest, getRadioCapability) {
+ LOG(DEBUG) << "getRadioCapability";
+ serial = GetRandomSerialNumber();
+
+ radio_modem->getRadioCapability(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error);
+ }
+ LOG(DEBUG) << "getRadioCapability finished";
+}
+
+/*
+ * Test IRadioModem.setRadioCapability() for the response returned.
+ */
+TEST_P(RadioModemTest, setRadioCapability) {
+ LOG(DEBUG) << "setRadioCapability";
+ serial = GetRandomSerialNumber();
+ RadioCapability rc;
+ memset(&rc, 0, sizeof(rc));
+ rc.logicalModemUuid = std::string();
+
+ radio_modem->setRadioCapability(serial, rc);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "setRadioCapability finished";
+}
+
+/*
+ * Test IRadioModem.getModemActivityInfo() for the response returned.
+ */
+TEST_P(RadioModemTest, getModemActivityInfo) {
+ LOG(DEBUG) << "getModemActivityInfo";
+ serial = GetRandomSerialNumber();
+
+ radio_modem->getModemActivityInfo(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+ LOG(DEBUG) << "getModemActivityInfo finished";
+}
+
+/*
+ * Test IRadioModem.sendDeviceState() for the response returned.
+ */
+TEST_P(RadioModemTest, sendDeviceState) {
+ LOG(DEBUG) << "sendDeviceState";
+ serial = GetRandomSerialNumber();
+
+ radio_modem->sendDeviceState(serial, DeviceStateType::POWER_SAVE_MODE, true);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+
+ std::cout << static_cast<int>(radioRsp_modem->rspInfo.error) << std::endl;
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+ LOG(DEBUG) << "sendDeviceState finished";
+}
diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp
index ccae0f3..666d617 100644
--- a/radio/aidl/vts/radio_network_response.cpp
+++ b/radio/aidl/vts/radio_network_response.cpp
@@ -31,7 +31,10 @@
}
ndk::ScopedAStatus RadioNetworkResponse::getAvailableBandModesResponse(
- const RadioResponseInfo& /*info*/, const std::vector<RadioBandMode>& /*bandModes*/) {
+ const RadioResponseInfo& info, const std::vector<RadioBandMode>& bandModes) {
+ rspInfo = info;
+ radioBandModes = bandModes;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -44,48 +47,64 @@
}
ndk::ScopedAStatus RadioNetworkResponse::getBarringInfoResponse(
- const RadioResponseInfo& /*info*/, const CellIdentity& /*cellIdentity*/,
- const std::vector<BarringInfo>& /*barringInfos*/) {
+ const RadioResponseInfo& info, const CellIdentity& cellIdentity,
+ const std::vector<BarringInfo>& barringInfos) {
+ rspInfo = info;
+ barringCellIdentity = cellIdentity;
+ barringInfoList = barringInfos;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::getCdmaRoamingPreferenceResponse(
- const RadioResponseInfo& /*info*/, CdmaRoamingType /*type*/) {
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioNetworkResponse::getCellInfoListResponse(
- const RadioResponseInfo& /*info*/, const std::vector<CellInfo>& /*cellInfo*/) {
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioNetworkResponse::getDataRegistrationStateResponse(
- const RadioResponseInfo& info, const RegStateResult& /*regResponse*/) {
+ const RadioResponseInfo& info, CdmaRoamingType /*type*/) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus RadioNetworkResponse::getCellInfoListResponse(
+ const RadioResponseInfo& info, const std::vector<CellInfo>& /*cellInfo*/) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getDataRegistrationStateResponse(
+ const RadioResponseInfo& info, const RegStateResult& regResponse) {
+ rspInfo = info;
+ dataRegResp = regResponse;
+ parent_network.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
ndk::ScopedAStatus RadioNetworkResponse::getImsRegistrationStateResponse(
- const RadioResponseInfo& /*info*/, bool /*isRegistered*/,
- RadioTechnologyFamily /*ratFamily*/) {
+ const RadioResponseInfo& info, bool /*isRegistered*/, RadioTechnologyFamily /*ratFamily*/) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::getNetworkSelectionModeResponse(
- const RadioResponseInfo& /*info*/, bool /*manual*/) {
+ const RadioResponseInfo& info, bool /*manual*/) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioNetworkResponse::getOperatorResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioNetworkResponse::getOperatorResponse(const RadioResponseInfo& info,
const std::string& /*longName*/,
const std::string& /*shortName*/,
const std::string& /*numeric*/) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::getSignalStrengthResponse(
- const RadioResponseInfo& /*info*/, const SignalStrength& /*sig_strength*/) {
+ const RadioResponseInfo& info, const SignalStrength& /*sig_strength*/) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -105,14 +124,16 @@
}
ndk::ScopedAStatus RadioNetworkResponse::getVoiceRadioTechnologyResponse(
- const RadioResponseInfo& /*info*/, RadioTechnology /*rat*/) {
+ const RadioResponseInfo& info, RadioTechnology /*rat*/) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::getVoiceRegistrationStateResponse(
const RadioResponseInfo& info, const RegStateResult& regResponse) {
rspInfo = info;
- voiceRegResp.regState = regResponse.regState;
+ voiceRegResp = regResponse;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -132,47 +153,63 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioNetworkResponse::setBandModeResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioNetworkResponse::setBandModeResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioNetworkResponse::setBarringPasswordResponse(
- const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioNetworkResponse::setBarringPasswordResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setCdmaRoamingPreferenceResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setCellInfoListRateResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setIndicationFilterResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setLinkCapacityReportingCriteriaResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioNetworkResponse::setLocationUpdatesResponse(
- const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioNetworkResponse::setLocationUpdatesResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setNetworkSelectionModeAutomaticResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setNetworkSelectionModeManualResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -184,17 +221,23 @@
}
ndk::ScopedAStatus RadioNetworkResponse::setSignalStrengthReportingCriteriaResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setSuppServiceNotificationsResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setSystemSelectionChannelsResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -204,17 +247,21 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioNetworkResponse::startNetworkScanResponse(
- const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioNetworkResponse::startNetworkScanResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioNetworkResponse::stopNetworkScanResponse(
- const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioNetworkResponse::stopNetworkScanResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::supplyNetworkDepersonalizationResponse(
- const RadioResponseInfo& /*info*/, int32_t /*remainingRetries*/) {
+ const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
+ rspInfo = info;
+ 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 93c4c35..391d63c 100644
--- a/radio/aidl/vts/radio_network_test.cpp
+++ b/radio/aidl/vts/radio_network_test.cpp
@@ -16,6 +16,7 @@
#include <aidl/android/hardware/radio/RadioAccessFamily.h>
#include <aidl/android/hardware/radio/config/IRadioConfig.h>
+#include <aidl/android/hardware/radio/network/IndicationFilter.h>
#include <android-base/logging.h>
#include <android/binder_manager.h>
@@ -58,6 +59,12 @@
ASSERT_NE(nullptr, radio_config.get());
}
+void RadioNetworkTest::stopNetworkScan() {
+ serial = GetRandomSerialNumber();
+ radio_network->stopNetworkScan(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+}
+
/*
* Test IRadioNetwork.setAllowedNetworkTypesBitmap for the response returned.
*/
@@ -263,3 +270,1462 @@
// Check that indeed the original setting was reset.
ASSERT_TRUE(originalSetting == radioRsp_network->usageSetting);
}
+
+/*
+ * Test IRadioNetwork.setSignalStrengthReportingCriteria() with invalid hysteresisDb
+ */
+TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_invalidHysteresisDb) {
+ serial = GetRandomSerialNumber();
+
+ SignalThresholdInfo signalThresholdInfo;
+ signalThresholdInfo.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_RSSI;
+ signalThresholdInfo.hysteresisMs = 5000;
+ signalThresholdInfo.hysteresisDb = 10; // hysteresisDb too large given threshold list deltas
+ signalThresholdInfo.thresholds = {-109, -103, -97, -89};
+ signalThresholdInfo.isEnabled = true;
+ signalThresholdInfo.ran = AccessNetwork::GERAN;
+
+ ndk::ScopedAStatus res =
+ radio_network->setSignalStrengthReportingCriteria(serial, {signalThresholdInfo});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("setSignalStrengthReportingCriteria_invalidHysteresisDb, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::INVALID_ARGUMENTS}));
+}
+
+/*
+ * Test IRadioNetwork.setSignalStrengthReportingCriteria() with empty thresholds
+ */
+TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_EmptyThresholds) {
+ serial = GetRandomSerialNumber();
+
+ SignalThresholdInfo signalThresholdInfo;
+ signalThresholdInfo.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_RSSI;
+ signalThresholdInfo.hysteresisMs = 0;
+ signalThresholdInfo.hysteresisDb = 0;
+ signalThresholdInfo.isEnabled = true;
+ signalThresholdInfo.ran = AccessNetwork::GERAN;
+
+ ndk::ScopedAStatus res =
+ radio_network->setSignalStrengthReportingCriteria(serial, {signalThresholdInfo});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("setSignalStrengthReportingCriteria_EmptyParams, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE}));
+}
+
+/*
+ * Test IRadioNetwork.setSignalStrengthReportingCriteria() for GERAN
+ */
+TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Geran) {
+ serial = GetRandomSerialNumber();
+
+ SignalThresholdInfo signalThresholdInfo;
+ signalThresholdInfo.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_RSSI;
+ signalThresholdInfo.hysteresisMs = 5000;
+ signalThresholdInfo.hysteresisDb = 2;
+ signalThresholdInfo.thresholds = {-109, -103, -97, -89};
+ signalThresholdInfo.isEnabled = true;
+ signalThresholdInfo.ran = AccessNetwork::GERAN;
+
+ ndk::ScopedAStatus res =
+ radio_network->setSignalStrengthReportingCriteria(serial, {signalThresholdInfo});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("setSignalStrengthReportingCriteria_Geran, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE}));
+}
+
+/*
+ * Test IRadioNetwork.setSignalStrengthReportingCriteria() for UTRAN
+ */
+TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Utran) {
+ serial = GetRandomSerialNumber();
+
+ SignalThresholdInfo signalThresholdInfo;
+ signalThresholdInfo.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_RSCP;
+ signalThresholdInfo.hysteresisMs = 5000;
+ signalThresholdInfo.hysteresisDb = 2;
+ signalThresholdInfo.thresholds = {-110, -97, -73, -49, -25};
+ signalThresholdInfo.isEnabled = true;
+ signalThresholdInfo.ran = AccessNetwork::UTRAN;
+
+ ndk::ScopedAStatus res =
+ radio_network->setSignalStrengthReportingCriteria(serial, {signalThresholdInfo});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("setSignalStrengthReportingCriteria_Utran, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE}));
+}
+
+/*
+ * Test IRadioNetwork.setSignalStrengthReportingCriteria() for EUTRAN
+ */
+TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Eutran_RSRP) {
+ serial = GetRandomSerialNumber();
+
+ SignalThresholdInfo signalThresholdInfo;
+ signalThresholdInfo.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_RSRP;
+ signalThresholdInfo.hysteresisMs = 5000;
+ signalThresholdInfo.hysteresisDb = 2;
+ signalThresholdInfo.thresholds = {-128, -108, -88, -68};
+ signalThresholdInfo.isEnabled = true;
+ signalThresholdInfo.ran = AccessNetwork::EUTRAN;
+
+ ndk::ScopedAStatus res =
+ radio_network->setSignalStrengthReportingCriteria(serial, {signalThresholdInfo});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("setSignalStrengthReportingCriteria_Eutran, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE}));
+}
+
+/*
+ * Test IRadioNetwork.setSignalStrengthReportingCriteria() for EUTRAN
+ */
+TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Eutran_RSRQ) {
+ serial = GetRandomSerialNumber();
+
+ SignalThresholdInfo signalThresholdInfo;
+ signalThresholdInfo.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_RSRQ;
+ signalThresholdInfo.hysteresisMs = 5000;
+ signalThresholdInfo.hysteresisDb = 2;
+ signalThresholdInfo.thresholds = {-27, -20, -13, -6};
+ signalThresholdInfo.isEnabled = true;
+ signalThresholdInfo.ran = AccessNetwork::EUTRAN;
+
+ ndk::ScopedAStatus res =
+ radio_network->setSignalStrengthReportingCriteria(serial, {signalThresholdInfo});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("setSignalStrengthReportingCriteria_Eutran, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE}));
+}
+
+/*
+ * Test IRadioNetwork.setSignalStrengthReportingCriteria() for EUTRAN
+ */
+TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Eutran_RSSNR) {
+ serial = GetRandomSerialNumber();
+
+ SignalThresholdInfo signalThresholdInfo;
+ signalThresholdInfo.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_RSSNR;
+ signalThresholdInfo.hysteresisMs = 5000;
+ signalThresholdInfo.hysteresisDb = 2;
+ signalThresholdInfo.thresholds = {-10, 0, 10, 20};
+ signalThresholdInfo.isEnabled = true;
+ signalThresholdInfo.ran = AccessNetwork::EUTRAN;
+
+ ndk::ScopedAStatus res =
+ radio_network->setSignalStrengthReportingCriteria(serial, {signalThresholdInfo});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+}
+
+/*
+ * Test IRadioNetwork.setSignalStrengthReportingCriteria() for CDMA2000
+ */
+TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Cdma2000) {
+ serial = GetRandomSerialNumber();
+
+ SignalThresholdInfo signalThresholdInfo;
+ signalThresholdInfo.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_RSSI;
+ signalThresholdInfo.hysteresisMs = 5000;
+ signalThresholdInfo.hysteresisDb = 2;
+ signalThresholdInfo.thresholds = {-105, -90, -75, -65};
+ signalThresholdInfo.isEnabled = true;
+ signalThresholdInfo.ran = AccessNetwork::CDMA2000;
+
+ ndk::ScopedAStatus res =
+ radio_network->setSignalStrengthReportingCriteria(serial, {signalThresholdInfo});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("setSignalStrengthReportingCriteria_Cdma2000, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE}));
+}
+
+/*
+ * Test IRadioNetwork.setSignalStrengthReportingCriteria() for NGRAN_SSRSRP
+ */
+TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_NGRAN_SSRSRP) {
+ serial = GetRandomSerialNumber();
+
+ SignalThresholdInfo signalThresholdInfo;
+ signalThresholdInfo.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_SSRSRP;
+ signalThresholdInfo.hysteresisMs = 5000;
+ signalThresholdInfo.hysteresisDb = 0;
+ signalThresholdInfo.thresholds = {-105, -90, -75, -65};
+ signalThresholdInfo.isEnabled = true;
+ signalThresholdInfo.ran = AccessNetwork::NGRAN;
+
+ ndk::ScopedAStatus res =
+ radio_network->setSignalStrengthReportingCriteria(serial, {signalThresholdInfo});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("setSignalStrengthReportingCriteria_NGRAN_SSRSRP, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+
+ // Allow REQUEST_NOT_SUPPORTED because some non-5G device may not support NGRAN for
+ // setSignalStrengthReportingCriteria()
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+}
+
+/*
+ * Test IRadioNetwork.setSignalStrengthReportingCriteria() for NGRAN_SSRSRQ
+ */
+TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_NGRAN_SSRSRQ) {
+ serial = GetRandomSerialNumber();
+
+ SignalThresholdInfo signalThresholdInfo;
+ signalThresholdInfo.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_SSRSRQ;
+ signalThresholdInfo.hysteresisMs = 5000;
+ signalThresholdInfo.hysteresisDb = 0;
+ signalThresholdInfo.thresholds = {-43, -20, 0, 20};
+ signalThresholdInfo.isEnabled = true;
+ signalThresholdInfo.ran = AccessNetwork::NGRAN;
+
+ ndk::ScopedAStatus res =
+ radio_network->setSignalStrengthReportingCriteria(serial, {signalThresholdInfo});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("setSignalStrengthReportingCriteria_NGRAN_SSRSRQ, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+
+ // Allow REQUEST_NOT_SUPPORTED because some non-5G device may not support NGRAN for
+ // setSignalStrengthReportingCriteria()
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+}
+
+/*
+ * Test IRadioNetwork.setSignalStrengthReportingCriteria() for EUTRAN
+ */
+TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Disable_RSSNR) {
+ serial = GetRandomSerialNumber();
+
+ SignalThresholdInfo signalThresholdInfo;
+ signalThresholdInfo.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_RSSNR;
+ signalThresholdInfo.hysteresisMs = 5000;
+ signalThresholdInfo.hysteresisDb = 2;
+ signalThresholdInfo.thresholds = {-10, 0, 10, 20};
+ signalThresholdInfo.isEnabled = false;
+ signalThresholdInfo.ran = AccessNetwork::EUTRAN;
+
+ ndk::ScopedAStatus res =
+ radio_network->setSignalStrengthReportingCriteria(serial, {signalThresholdInfo});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+}
+
+/*
+ * Test IRadioNetwork.setSignalStrengthReportingCriteria() for NGRAN_SSSINR
+ */
+TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_NGRAN_SSSINR) {
+ serial = GetRandomSerialNumber();
+
+ SignalThresholdInfo signalThresholdInfo;
+ signalThresholdInfo.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_SSSINR;
+ signalThresholdInfo.hysteresisMs = 5000;
+ signalThresholdInfo.hysteresisDb = 0;
+ signalThresholdInfo.thresholds = {-10, 3, 16, 18};
+ signalThresholdInfo.isEnabled = true;
+ signalThresholdInfo.ran = AccessNetwork::NGRAN;
+
+ ndk::ScopedAStatus res =
+ radio_network->setSignalStrengthReportingCriteria(serial, {signalThresholdInfo});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("setSignalStrengthReportingCriteria_NGRAN_SSSINR, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+
+ // Allow REQUEST_NOT_SUPPORTED because some non-5G device may not support NGRAN for
+ // setSignalStrengthReportingCriteria()
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+}
+
+/*
+ * Test IRadioNetwork.setLinkCapacityReportingCriteria() invalid hysteresisDlKbps
+ */
+TEST_P(RadioNetworkTest, setLinkCapacityReportingCriteria_invalidHysteresisDlKbps) {
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res = radio_network->setLinkCapacityReportingCriteria(
+ serial, 5000,
+ 5000, // hysteresisDlKbps too big for thresholds delta
+ 100, {1000, 5000, 10000, 20000}, {500, 1000, 5000, 10000}, AccessNetwork::GERAN);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("setLinkCapacityReportingCriteria_invalidHysteresisDlKbps, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ // Allow REQUEST_NOT_SUPPORTED as setLinkCapacityReportingCriteria() may not be supported
+ // for GERAN
+ ASSERT_TRUE(
+ CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
+}
+
+/*
+ * Test IRadioNetwork.setLinkCapacityReportingCriteria() invalid hysteresisUlKbps
+ */
+TEST_P(RadioNetworkTest, setLinkCapacityReportingCriteria_invalidHysteresisUlKbps) {
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res = radio_network->setLinkCapacityReportingCriteria(
+ serial, 5000, 500, 1000, // hysteresisUlKbps too big for thresholds delta
+ {1000, 5000, 10000, 20000}, {500, 1000, 5000, 10000}, AccessNetwork::GERAN);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("setLinkCapacityReportingCriteria_invalidHysteresisUlKbps, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ // Allow REQUEST_NOT_SUPPORTED as setLinkCapacityReportingCriteria() may not be supported
+ // for GERAN
+ ASSERT_TRUE(
+ CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
+}
+
+/*
+ * Test IRadioNetwork.setLinkCapacityReportingCriteria() empty params
+ */
+TEST_P(RadioNetworkTest, setLinkCapacityReportingCriteria_emptyParams) {
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res = radio_network->setLinkCapacityReportingCriteria(
+ serial, 0, 0, 0, {}, {}, AccessNetwork::GERAN);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("setLinkCapacityReportingCriteria_emptyParams, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ // Allow REQUEST_NOT_SUPPORTED as setLinkCapacityReportingCriteria() may not be supported
+ // for GERAN
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+}
+
+/*
+ * Test IRadioNetwork.setLinkCapacityReportingCriteria() for GERAN
+ */
+TEST_P(RadioNetworkTest, setLinkCapacityReportingCriteria_Geran) {
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res = radio_network->setLinkCapacityReportingCriteria(
+ serial, 5000, 500, 100, {1000, 5000, 10000, 20000}, {500, 1000, 5000, 10000},
+ AccessNetwork::GERAN);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("setLinkCapacityReportingCriteria_Geran, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ // Allow REQUEST_NOT_SUPPORTED as setLinkCapacityReportingCriteria() may not be supported
+ // for GERAN
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+}
+
+/*
+ * Test IRadioNetwork.setSystemSelectionChannels() for the response returned.
+ */
+TEST_P(RadioNetworkTest, setSystemSelectionChannels) {
+ serial = GetRandomSerialNumber();
+
+ RadioAccessSpecifierBands bandP900 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_P900});
+ RadioAccessSpecifierBands band850 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_850});
+ RadioAccessSpecifier specifierP900 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = bandP900, .channels = {1, 2}};
+ RadioAccessSpecifier specifier850 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = band850, .channels = {128, 129}};
+
+ ndk::ScopedAStatus res =
+ radio_network->setSystemSelectionChannels(serial, true, {specifierP900, specifier850});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ALOGI("setSystemSelectionChannels, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
+
+ if (radioRsp_network->rspInfo.error == RadioError::NONE) {
+ serial = GetRandomSerialNumber();
+ ndk::ScopedAStatus res = radio_network->setSystemSelectionChannels(
+ serial, false, {specifierP900, specifier850});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ALOGI("setSystemSelectionChannels, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ EXPECT_EQ(RadioError::NONE, radioRsp_network->rspInfo.error);
+ }
+}
+
+/*
+ * Test IRadioNetwork.startNetworkScan() for the response returned.
+ */
+TEST_P(RadioNetworkTest, startNetworkScan) {
+ serial = GetRandomSerialNumber();
+
+ RadioAccessSpecifierBands bandP900 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_P900});
+ RadioAccessSpecifierBands band850 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_850});
+ RadioAccessSpecifier specifierP900 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = bandP900, .channels = {1, 2}};
+ RadioAccessSpecifier specifier850 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = band850, .channels = {128, 129}};
+
+ NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT,
+ .interval = 60,
+ .specifiers = {specifierP900, specifier850},
+ .maxSearchTime = 60,
+ .incrementalResults = false,
+ .incrementalResultsPeriodicity = 1};
+
+ ndk::ScopedAStatus res = radio_network->startNetworkScan(serial, request);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ALOGI("startNetworkScan, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::SIM_ABSENT}));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ // OPERATION_NOT_ALLOWED should not be allowed; however, some vendors do
+ // not support the required manual GSM search functionality. This is
+ // tracked in b/112206766. Modems have "GSM" rat scan need to
+ // support scanning requests combined with some parameters.
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::OPERATION_NOT_ALLOWED}));
+ }
+
+ if (radioRsp_network->rspInfo.error == RadioError::NONE) {
+ ALOGI("Stop Network Scan");
+ stopNetworkScan();
+ }
+}
+
+/*
+ * Test IRadioNetwork.startNetworkScan() with invalid specifier.
+ */
+TEST_P(RadioNetworkTest, startNetworkScan_InvalidArgument) {
+ serial = GetRandomSerialNumber();
+
+ NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT, .interval = 60};
+
+ ndk::ScopedAStatus res = radio_network->startNetworkScan(serial, request);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ALOGI("startNetworkScan_InvalidArgument, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS}));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+}
+
+/*
+ * Test IRadioNetwork.startNetworkScan() with invalid interval (lower boundary).
+ */
+TEST_P(RadioNetworkTest, startNetworkScan_InvalidInterval1) {
+ serial = GetRandomSerialNumber();
+
+ RadioAccessSpecifierBands bandP900 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_P900});
+ RadioAccessSpecifierBands band850 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_850});
+ RadioAccessSpecifier specifierP900 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = bandP900, .channels = {1, 2}};
+ RadioAccessSpecifier specifier850 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = band850, .channels = {128, 129}};
+
+ NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT,
+ .interval = 4,
+ .specifiers = {specifierP900, specifier850},
+ .maxSearchTime = 60,
+ .incrementalResults = false,
+ .incrementalResultsPeriodicity = 1};
+
+ ndk::ScopedAStatus res = radio_network->startNetworkScan(serial, request);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ALOGI("startNetworkScan_InvalidInterval1, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS}));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+}
+
+/*
+ * Test IRadioNetwork.startNetworkScan() with invalid interval (upper boundary).
+ */
+TEST_P(RadioNetworkTest, startNetworkScan_InvalidInterval2) {
+ serial = GetRandomSerialNumber();
+
+ RadioAccessSpecifierBands bandP900 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_P900});
+ RadioAccessSpecifierBands band850 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_850});
+ RadioAccessSpecifier specifierP900 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = bandP900, .channels = {1, 2}};
+ RadioAccessSpecifier specifier850 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = band850, .channels = {128, 129}};
+
+ NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT,
+ .interval = 301,
+ .specifiers = {specifierP900, specifier850},
+ .maxSearchTime = 60,
+ .incrementalResults = false,
+ .incrementalResultsPeriodicity = 1};
+
+ ndk::ScopedAStatus res = radio_network->startNetworkScan(serial, request);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ALOGI("startNetworkScan_InvalidInterval2, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS}));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+}
+
+/*
+ * Test IRadioNetwork.startNetworkScan() with invalid max search time (lower boundary).
+ */
+TEST_P(RadioNetworkTest, startNetworkScan_InvalidMaxSearchTime1) {
+ serial = GetRandomSerialNumber();
+
+ RadioAccessSpecifierBands bandP900 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_P900});
+ RadioAccessSpecifierBands band850 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_850});
+ RadioAccessSpecifier specifierP900 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = bandP900, .channels = {1, 2}};
+ RadioAccessSpecifier specifier850 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = band850, .channels = {128, 129}};
+
+ NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT,
+ .interval = 60,
+ .specifiers = {specifierP900, specifier850},
+ .maxSearchTime = 59,
+ .incrementalResults = false,
+ .incrementalResultsPeriodicity = 1};
+
+ ndk::ScopedAStatus res = radio_network->startNetworkScan(serial, request);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ALOGI("startNetworkScan_InvalidMaxSearchTime1, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS}));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+}
+
+/*
+ * Test IRadioNetwork.startNetworkScan() with invalid max search time (upper boundary).
+ */
+TEST_P(RadioNetworkTest, startNetworkScan_InvalidMaxSearchTime2) {
+ serial = GetRandomSerialNumber();
+
+ RadioAccessSpecifierBands bandP900 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_P900});
+ RadioAccessSpecifierBands band850 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_850});
+ RadioAccessSpecifier specifierP900 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = bandP900, .channels = {1, 2}};
+ RadioAccessSpecifier specifier850 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = band850, .channels = {128, 129}};
+
+ NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT,
+ .interval = 60,
+ .specifiers = {specifierP900, specifier850},
+ .maxSearchTime = 3601,
+ .incrementalResults = false,
+ .incrementalResultsPeriodicity = 1};
+
+ ndk::ScopedAStatus res = radio_network->startNetworkScan(serial, request);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ALOGI("startNetworkScan_InvalidMaxSearchTime2, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS}));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+}
+
+/*
+ * Test IRadioNetwork.startNetworkScan() with invalid periodicity (lower boundary).
+ */
+TEST_P(RadioNetworkTest, startNetworkScan_InvalidPeriodicity1) {
+ serial = GetRandomSerialNumber();
+
+ RadioAccessSpecifierBands bandP900 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_P900});
+ RadioAccessSpecifierBands band850 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_850});
+ RadioAccessSpecifier specifierP900 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = bandP900, .channels = {1, 2}};
+ RadioAccessSpecifier specifier850 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = band850, .channels = {128, 129}};
+
+ NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT,
+ .interval = 60,
+ .specifiers = {specifierP900, specifier850},
+ .maxSearchTime = 600,
+ .incrementalResults = true,
+ .incrementalResultsPeriodicity = 0};
+
+ ndk::ScopedAStatus res = radio_network->startNetworkScan(serial, request);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ALOGI("startNetworkScan_InvalidPeriodicity1, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS}));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+}
+
+/*
+ * Test IRadioNetwork.startNetworkScan() with invalid periodicity (upper boundary).
+ */
+TEST_P(RadioNetworkTest, startNetworkScan_InvalidPeriodicity2) {
+ serial = GetRandomSerialNumber();
+
+ RadioAccessSpecifierBands bandP900 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_P900});
+ RadioAccessSpecifierBands band850 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_850});
+ RadioAccessSpecifier specifierP900 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = bandP900, .channels = {1, 2}};
+ RadioAccessSpecifier specifier850 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = band850, .channels = {128, 129}};
+
+ NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT,
+ .interval = 60,
+ .specifiers = {specifierP900, specifier850},
+ .maxSearchTime = 600,
+ .incrementalResults = true,
+ .incrementalResultsPeriodicity = 11};
+
+ ndk::ScopedAStatus res = radio_network->startNetworkScan(serial, request);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ALOGI("startNetworkScan_InvalidPeriodicity2, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS}));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+}
+
+/*
+ * Test IRadioNetwork.startNetworkScan() with valid periodicity
+ */
+TEST_P(RadioNetworkTest, startNetworkScan_GoodRequest1) {
+ serial = GetRandomSerialNumber();
+
+ RadioAccessSpecifierBands bandP900 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_P900});
+ RadioAccessSpecifierBands band850 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_850});
+ RadioAccessSpecifier specifierP900 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = bandP900, .channels = {1, 2}};
+ RadioAccessSpecifier specifier850 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = band850, .channels = {128, 129}};
+
+ NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT,
+ .interval = 60,
+ .specifiers = {specifierP900, specifier850},
+ .maxSearchTime = 360,
+ .incrementalResults = false,
+ .incrementalResultsPeriodicity = 10};
+
+ ndk::ScopedAStatus res = radio_network->startNetworkScan(serial, request);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ALOGI("startNetworkScan_GoodRequest1, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::SIM_ABSENT}));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS,
+ RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+
+ if (radioRsp_network->rspInfo.error == RadioError::NONE) {
+ ALOGI("Stop Network Scan");
+ stopNetworkScan();
+ }
+}
+
+/*
+ * Test IRadioNetwork.startNetworkScan() with valid periodicity and plmns
+ */
+TEST_P(RadioNetworkTest, startNetworkScan_GoodRequest2) {
+ serial = GetRandomSerialNumber();
+
+ RadioAccessSpecifierBands bandP900 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_P900});
+ RadioAccessSpecifierBands band850 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
+ {GeranBands::BAND_850});
+ RadioAccessSpecifier specifierP900 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = bandP900, .channels = {1, 2}};
+ RadioAccessSpecifier specifier850 = {
+ .accessNetwork = AccessNetwork::GERAN, .bands = band850, .channels = {128, 129}};
+
+ NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT,
+ .interval = 60,
+ .specifiers = {specifierP900, specifier850},
+ .maxSearchTime = 360,
+ .incrementalResults = false,
+ .incrementalResultsPeriodicity = 10,
+ .mccMncs = {"310410"}};
+
+ ndk::ScopedAStatus res = radio_network->startNetworkScan(serial, request);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ALOGI("startNetworkScan_GoodRequest2, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::SIM_ABSENT}));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS,
+ RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+
+ if (radioRsp_network->rspInfo.error == RadioError::NONE) {
+ ALOGI("Stop Network Scan");
+ stopNetworkScan();
+ }
+}
+
+/*
+ * Test IRadioNetwork.setNetworkSelectionModeManual() for the response returned.
+ */
+TEST_P(RadioNetworkTest, setNetworkSelectionModeManual) {
+ serial = GetRandomSerialNumber();
+
+ // can't camp on nonexistent MCCMNC, so we expect this to fail.
+ ndk::ScopedAStatus res =
+ radio_network->setNetworkSelectionModeManual(serial, "123456", AccessNetwork::GERAN);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::ILLEGAL_SIM_OR_ME,
+ RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE},
+ CHECK_GENERAL_ERROR));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE},
+ CHECK_GENERAL_ERROR));
+ }
+}
+
+/*
+ * Test IRadioNetwork.getBarringInfo() for the response returned.
+ */
+TEST_P(RadioNetworkTest, getBarringInfo) {
+ serial = GetRandomSerialNumber();
+ ndk::ScopedAStatus res = radio_network->getBarringInfo(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ASSERT_TRUE(radioRsp_network->barringInfoList.size() > 0);
+
+ std::set<int> reportedServices;
+
+ // validate that the service types are in range
+ for (const auto& info : radioRsp_network->barringInfoList) {
+ ASSERT_TRUE((info.serviceType >= BarringInfo::SERVICE_TYPE_CS_SERVICE &&
+ info.serviceType <= BarringInfo::SERVICE_TYPE_SMS) ||
+ (info.serviceType >= BarringInfo::SERVICE_TYPE_OPERATOR_1 &&
+ info.serviceType <= BarringInfo::SERVICE_TYPE_OPERATOR_32));
+ reportedServices.insert(info.serviceType);
+
+ // Any type that is "conditional" must have valid values for conditional barring
+ // factor and time.
+ switch (info.barringType) {
+ case BarringInfo::BARRING_TYPE_NONE: // fall through
+ case BarringInfo::BARRING_TYPE_UNCONDITIONAL:
+ break;
+ case BarringInfo::BARRING_TYPE_CONDITIONAL: {
+ const int32_t barringFactor = info.barringTypeSpecificInfo->factor;
+ ASSERT_TRUE(barringFactor >= 0 && barringFactor <= 100);
+ ASSERT_TRUE(info.barringTypeSpecificInfo->timeSeconds > 0);
+ break;
+ }
+ default:
+ FAIL();
+ }
+ }
+
+ // Certain types of barring are relevant for certain RANs. Ensure that only the right
+ // types are reported. Note that no types are required, simply that for a given technology
+ // only certain types are valid. This is one way to check that implementations are
+ // not providing information that they don't have.
+ static const std::set<int> UTRA_SERVICES{
+ BarringInfo::SERVICE_TYPE_CS_SERVICE, BarringInfo::SERVICE_TYPE_PS_SERVICE,
+ BarringInfo::SERVICE_TYPE_CS_VOICE, BarringInfo::SERVICE_TYPE_EMERGENCY,
+ BarringInfo::SERVICE_TYPE_SMS,
+ };
+
+ static const std::set<int> EUTRA_SERVICES{
+ BarringInfo::SERVICE_TYPE_MO_SIGNALLING, BarringInfo::SERVICE_TYPE_MO_DATA,
+ BarringInfo::SERVICE_TYPE_CS_FALLBACK, BarringInfo::SERVICE_TYPE_MMTEL_VOICE,
+ BarringInfo::SERVICE_TYPE_MMTEL_VIDEO, BarringInfo::SERVICE_TYPE_EMERGENCY,
+ BarringInfo::SERVICE_TYPE_SMS,
+ };
+
+ static const std::set<int> NGRA_SERVICES = {
+ BarringInfo::SERVICE_TYPE_MO_SIGNALLING, BarringInfo::SERVICE_TYPE_MO_DATA,
+ BarringInfo::SERVICE_TYPE_CS_FALLBACK, BarringInfo::SERVICE_TYPE_MMTEL_VOICE,
+ BarringInfo::SERVICE_TYPE_MMTEL_VIDEO, BarringInfo::SERVICE_TYPE_EMERGENCY,
+ BarringInfo::SERVICE_TYPE_SMS, BarringInfo::SERVICE_TYPE_OPERATOR_1,
+ BarringInfo::SERVICE_TYPE_OPERATOR_2, BarringInfo::SERVICE_TYPE_OPERATOR_3,
+ BarringInfo::SERVICE_TYPE_OPERATOR_4, BarringInfo::SERVICE_TYPE_OPERATOR_5,
+ BarringInfo::SERVICE_TYPE_OPERATOR_6, BarringInfo::SERVICE_TYPE_OPERATOR_7,
+ BarringInfo::SERVICE_TYPE_OPERATOR_8, BarringInfo::SERVICE_TYPE_OPERATOR_9,
+ BarringInfo::SERVICE_TYPE_OPERATOR_10, BarringInfo::SERVICE_TYPE_OPERATOR_11,
+ BarringInfo::SERVICE_TYPE_OPERATOR_12, BarringInfo::SERVICE_TYPE_OPERATOR_13,
+ BarringInfo::SERVICE_TYPE_OPERATOR_14, BarringInfo::SERVICE_TYPE_OPERATOR_15,
+ BarringInfo::SERVICE_TYPE_OPERATOR_16, BarringInfo::SERVICE_TYPE_OPERATOR_17,
+ BarringInfo::SERVICE_TYPE_OPERATOR_18, BarringInfo::SERVICE_TYPE_OPERATOR_19,
+ BarringInfo::SERVICE_TYPE_OPERATOR_20, BarringInfo::SERVICE_TYPE_OPERATOR_21,
+ BarringInfo::SERVICE_TYPE_OPERATOR_22, BarringInfo::SERVICE_TYPE_OPERATOR_23,
+ BarringInfo::SERVICE_TYPE_OPERATOR_24, BarringInfo::SERVICE_TYPE_OPERATOR_25,
+ BarringInfo::SERVICE_TYPE_OPERATOR_26, BarringInfo::SERVICE_TYPE_OPERATOR_27,
+ BarringInfo::SERVICE_TYPE_OPERATOR_28, BarringInfo::SERVICE_TYPE_OPERATOR_29,
+ BarringInfo::SERVICE_TYPE_OPERATOR_30, BarringInfo::SERVICE_TYPE_OPERATOR_31,
+ };
+
+ const std::set<int>* compareTo = nullptr;
+
+ switch (radioRsp_network->barringCellIdentity.getTag()) {
+ case CellIdentity::Tag::wcdma:
+ // fall through
+ case CellIdentity::Tag::tdscdma:
+ compareTo = &UTRA_SERVICES;
+ break;
+ case CellIdentity::Tag::lte:
+ compareTo = &EUTRA_SERVICES;
+ break;
+ case CellIdentity::Tag::nr:
+ compareTo = &NGRA_SERVICES;
+ break;
+ case CellIdentity::Tag::cdma:
+ // fall through
+ default:
+ FAIL();
+ break;
+ }
+
+ std::set<int> diff;
+
+ std::set_difference(reportedServices.begin(), reportedServices.end(), compareTo->begin(),
+ compareTo->end(), std::inserter(diff, diff.begin()));
+}
+
+/*
+ * Test IRadioNetwork.getSignalStrength() for the response returned.
+ */
+TEST_P(RadioNetworkTest, getSignalStrength) {
+ serial = GetRandomSerialNumber();
+
+ radio_network->getSignalStrength(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp_network->rspInfo.error);
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE}));
+ }
+}
+
+/*
+ * Test IRadioNetwork.getCellInfoList() for the response returned.
+ */
+TEST_P(RadioNetworkTest, getCellInfoList) {
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res = radio_network->getCellInfoList(serial);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("getCellInfoList, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::NO_NETWORK_FOUND}));
+}
+
+/*
+ * Test IRadioNetwork.getVoiceRegistrationState() for the response returned.
+ */
+TEST_P(RadioNetworkTest, getVoiceRegistrationState) {
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res = radio_network->getVoiceRegistrationState(serial);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("getVoiceRegistrationStateResponse, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE}));
+}
+
+/*
+ * Test IRadioNetwork.getDataRegistrationState() for the response returned.
+ */
+TEST_P(RadioNetworkTest, getDataRegistrationState) {
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res = radio_network->getDataRegistrationState(serial);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("getDataRegistrationStateResponse, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::NOT_PROVISIONED}));
+
+ // Check the mcc [0, 999] and mnc [0, 999].
+ std::string mcc;
+ std::string mnc;
+ bool checkMccMnc = true;
+ CellIdentity cellIdentity = radioRsp_network->dataRegResp.cellIdentity;
+ switch (cellIdentity.getTag()) {
+ case CellIdentity::noinit: {
+ checkMccMnc = false;
+ break;
+ }
+ case CellIdentity::gsm: {
+ CellIdentityGsm cig = cellIdentity.get<CellIdentity::gsm>();
+ mcc = cig.mcc;
+ mnc = cig.mnc;
+ break;
+ }
+ case CellIdentity::wcdma: {
+ CellIdentityWcdma ciw = cellIdentity.get<CellIdentity::wcdma>();
+ mcc = ciw.mcc;
+ mnc = ciw.mnc;
+ break;
+ }
+ case CellIdentity::tdscdma: {
+ CellIdentityTdscdma cit = cellIdentity.get<CellIdentity::tdscdma>();
+ mcc = cit.mcc;
+ mnc = cit.mnc;
+ break;
+ }
+ case CellIdentity::cdma: {
+ // CellIdentityCdma has no mcc/mnc
+ CellIdentityCdma cic = cellIdentity.get<CellIdentity::cdma>();
+ checkMccMnc = false;
+ break;
+ }
+ case CellIdentity::lte: {
+ CellIdentityLte cil = cellIdentity.get<CellIdentity::lte>();
+ mcc = cil.mcc;
+ mnc = cil.mnc;
+ break;
+ }
+ case CellIdentity::nr: {
+ CellIdentityNr cin = cellIdentity.get<CellIdentity::nr>();
+ mcc = cin.mcc;
+ mnc = cin.mnc;
+ break;
+ }
+ }
+
+ // 32 bit system might return invalid mcc and mnc string "\xff\xff..."
+ if (checkMccMnc && mcc.size() < 4 && mnc.size() < 4) {
+ int mcc_int = stoi(mcc);
+ int mnc_int = stoi(mnc);
+ EXPECT_TRUE(mcc_int >= 0 && mcc_int <= 999);
+ EXPECT_TRUE(mnc_int >= 0 && mnc_int <= 999);
+ }
+
+ // Check for access technology specific info
+ AccessTechnologySpecificInfo info = radioRsp_network->dataRegResp.accessTechnologySpecificInfo;
+ RadioTechnology rat = radioRsp_network->dataRegResp.rat;
+ // TODO: add logic for cdmaInfo
+ if (rat == RadioTechnology::LTE || rat == RadioTechnology::LTE_CA) {
+ ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::eutranInfo);
+ } else if (rat == RadioTechnology::NR) {
+ ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::ngranNrVopsInfo);
+ }
+}
+
+/*
+ * Test IRadioNetwork.getAvailableBandModes() for the response returned.
+ */
+TEST_P(RadioNetworkTest, getAvailableBandModes) {
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res = radio_network->getAvailableBandModes(serial);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ALOGI("getAvailableBandModes, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::MODEM_ERR, RadioError::INTERNAL_ERR,
+ // If REQUEST_NOT_SUPPORTED is returned, then it should also be
+ // returned for setBandMode().
+ RadioError::REQUEST_NOT_SUPPORTED}));
+ bool hasUnspecifiedBandMode = false;
+ if (radioRsp_network->rspInfo.error == RadioError::NONE) {
+ for (const RadioBandMode& mode : radioRsp_network->radioBandModes) {
+ // Automatic mode selection must be supported
+ if (mode == RadioBandMode::BAND_MODE_UNSPECIFIED) hasUnspecifiedBandMode = true;
+ }
+ ASSERT_TRUE(hasUnspecifiedBandMode);
+ }
+}
+
+/*
+ * Test IRadioNetwork.setIndicationFilter()
+ */
+TEST_P(RadioNetworkTest, setIndicationFilter) {
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res =
+ radio_network->setIndicationFilter(serial, static_cast<int>(IndicationFilter::ALL));
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ALOGI("setIndicationFilter, rspInfo.error = %s\n",
+ toString(radioRsp_network->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE}));
+}
+
+/*
+ * Test IRadioNetwork.setBarringPassword() for the response returned.
+ */
+TEST_P(RadioNetworkTest, setBarringPassword) {
+ serial = GetRandomSerialNumber();
+ std::string facility = "";
+ std::string oldPassword = "";
+ std::string newPassword = "";
+
+ radio_network->setBarringPassword(serial, facility, oldPassword, newPassword);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::FDN_CHECK_FAILURE,
+ RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+}
+
+/*
+ * Test IRadioNetwork.setSuppServiceNotifications() for the response returned.
+ */
+TEST_P(RadioNetworkTest, setSuppServiceNotifications) {
+ serial = GetRandomSerialNumber();
+ bool enable = false;
+
+ radio_network->setSuppServiceNotifications(serial, enable);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::SIM_ABSENT}));
+ }
+}
+
+/*
+ * Test IRadioNetwork.getImsRegistrationState() for the response returned.
+ */
+TEST_P(RadioNetworkTest, getImsRegistrationState) {
+ serial = GetRandomSerialNumber();
+
+ radio_network->getImsRegistrationState(serial);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::MODEM_ERR, RadioError::INVALID_MODEM_STATE},
+ CHECK_GENERAL_ERROR));
+ }
+}
+
+/*
+ * Test IRadioNetwork.getOperator() for the response returned.
+ */
+TEST_P(RadioNetworkTest, getOperator) {
+ LOG(DEBUG) << "getOperator";
+ serial = GetRandomSerialNumber();
+
+ radio_network->getOperator(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp_network->rspInfo.error);
+ }
+ LOG(DEBUG) << "getOperator finished";
+}
+
+/*
+ * Test IRadioNetwork.getNetworkSelectionMode() for the response returned.
+ */
+TEST_P(RadioNetworkTest, getNetworkSelectionMode) {
+ LOG(DEBUG) << "getNetworkSelectionMode";
+ serial = GetRandomSerialNumber();
+
+ radio_network->getNetworkSelectionMode(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp_network->rspInfo.error);
+ }
+ LOG(DEBUG) << "getNetworkSelectionMode finished";
+}
+
+/*
+ * Test IRadioNetwork.setNetworkSelectionModeAutomatic() for the response returned.
+ */
+TEST_P(RadioNetworkTest, setNetworkSelectionModeAutomatic) {
+ LOG(DEBUG) << "setNetworkSelectionModeAutomatic";
+ serial = GetRandomSerialNumber();
+
+ radio_network->setNetworkSelectionModeAutomatic(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::ILLEGAL_SIM_OR_ME,
+ RadioError::OPERATION_NOT_ALLOWED},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "setNetworkSelectionModeAutomatic finished";
+}
+
+/*
+ * Test IRadioNetwork.getAvailableNetworks() for the response returned.
+ */
+TEST_P(RadioNetworkTest, getAvailableNetworks) {
+ LOG(DEBUG) << "getAvailableNetworks";
+ serial = GetRandomSerialNumber();
+
+ radio_network->getAvailableNetworks(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ASSERT_TRUE(radioRsp_network->rspInfo.type == RadioResponseType::SOLICITED ||
+ radioRsp_network->rspInfo.type == RadioResponseType::SOLICITED_ACK_EXP);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::CANCELLED, RadioError::DEVICE_IN_USE,
+ RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "getAvailableNetworks finished";
+}
+
+/*
+ * Test IRadioNetwork.setBandMode() for the response returned.
+ */
+TEST_P(RadioNetworkTest, setBandMode) {
+ LOG(DEBUG) << "setBandMode";
+ serial = GetRandomSerialNumber();
+
+ radio_network->setBandMode(serial, RadioBandMode::BAND_MODE_USA);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "setBandMode finished";
+}
+
+/*
+ * Test IRadioNetwork.setLocationUpdates() for the response returned.
+ */
+TEST_P(RadioNetworkTest, setLocationUpdates) {
+ LOG(DEBUG) << "setLocationUpdates";
+ serial = GetRandomSerialNumber();
+
+ radio_network->setLocationUpdates(serial, true);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::SIM_ABSENT}));
+ }
+ LOG(DEBUG) << "setLocationUpdates finished";
+}
+
+/*
+ * Test IRadioNetwork.setCdmaRoamingPreference() for the response returned.
+ */
+TEST_P(RadioNetworkTest, setCdmaRoamingPreference) {
+ LOG(DEBUG) << "setCdmaRoamingPreference";
+ serial = GetRandomSerialNumber();
+
+ radio_network->setCdmaRoamingPreference(serial, CdmaRoamingType::HOME_NETWORK);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::SIM_ABSENT, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+ LOG(DEBUG) << "setCdmaRoamingPreference finished";
+}
+
+/*
+ * Test IRadioNetwork.getCdmaRoamingPreference() for the response returned.
+ */
+TEST_P(RadioNetworkTest, getCdmaRoamingPreference) {
+ LOG(DEBUG) << "getCdmaRoamingPreference";
+ serial = GetRandomSerialNumber();
+
+ radio_network->getCdmaRoamingPreference(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(
+ CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::SIM_ABSENT, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "getCdmaRoamingPreference finished";
+}
+
+/*
+ * Test IRadioNetwork.getVoiceRadioTechnology() for the response returned.
+ */
+TEST_P(RadioNetworkTest, getVoiceRadioTechnology) {
+ LOG(DEBUG) << "getVoiceRadioTechnology";
+ serial = GetRandomSerialNumber();
+
+ radio_network->getVoiceRadioTechnology(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp_network->rspInfo.error);
+ }
+ LOG(DEBUG) << "getVoiceRadioTechnology finished";
+}
+
+/*
+ * Test IRadioNetwork.setCellInfoListRate() for the response returned.
+ */
+TEST_P(RadioNetworkTest, setCellInfoListRate) {
+ LOG(DEBUG) << "setCellInfoListRate";
+ serial = GetRandomSerialNumber();
+
+ radio_network->setCellInfoListRate(serial, 10);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+ LOG(DEBUG) << "setCellInfoListRate finished";
+}
+
+/*
+ * Test IRadioNetwork.supplyNetworkDepersonalization() for the response returned.
+ */
+TEST_P(RadioNetworkTest, supplyNetworkDepersonalization) {
+ LOG(DEBUG) << "supplyNetworkDepersonalization";
+ serial = GetRandomSerialNumber();
+
+ radio_network->supplyNetworkDepersonalization(serial, std::string("test"));
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INTERNAL_ERR,
+ RadioError::INVALID_SIM_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY,
+ RadioError::PASSWORD_INCORRECT, RadioError::SIM_ABSENT, RadioError::SYSTEM_ERR}));
+ }
+ LOG(DEBUG) << "supplyNetworkDepersonalization finished";
+}
\ No newline at end of file
diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h
index 9f76769..29ba2f2 100644
--- a/radio/aidl/vts/radio_network_utils.h
+++ b/radio/aidl/vts/radio_network_utils.h
@@ -41,8 +41,9 @@
bool isNrDualConnectivityEnabled;
int networkTypeBitmapResponse;
RegStateResult voiceRegResp;
+ RegStateResult dataRegResp;
CellIdentity barringCellIdentity;
- std::vector<BarringInfo> barringInfos;
+ std::vector<BarringInfo> barringInfoList;
UsageSetting usageSetting;
virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
@@ -218,4 +219,6 @@
// Helper function to reduce copy+paste
void testSetUsageSetting_InvalidValues(std::vector<RadioError> errors);
+
+ void stopNetworkScan();
};
diff --git a/radio/aidl/vts/radio_sim_response.cpp b/radio/aidl/vts/radio_sim_response.cpp
index a783f43..391c9cb 100644
--- a/radio/aidl/vts/radio_sim_response.cpp
+++ b/radio/aidl/vts/radio_sim_response.cpp
@@ -23,44 +23,62 @@
}
ndk::ScopedAStatus RadioSimResponse::areUiccApplicationsEnabledResponse(
- const RadioResponseInfo& /*info*/, bool /*enabled*/) {
+ const RadioResponseInfo& info, bool enabled) {
+ rspInfo = info;
+ areUiccApplicationsEnabled = enabled;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::changeIccPin2ForAppResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioSimResponse::changeIccPin2ForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::changeIccPinForAppResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioSimResponse::changeIccPinForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::enableUiccApplicationsResponse(
- const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioSimResponse::enableUiccApplicationsResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::getAllowedCarriersResponse(
- const RadioResponseInfo& /*info*/, const CarrierRestrictions& /*carriers*/,
- SimLockMultiSimPolicy /*multiSimPolicy*/) {
+ const RadioResponseInfo& info, const CarrierRestrictions& carriers,
+ SimLockMultiSimPolicy multiSimPolicy) {
+ rspInfo = info;
+ carrierRestrictionsResp = carriers;
+ multiSimPolicyResp = multiSimPolicy;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::getCdmaSubscriptionResponse(
- const RadioResponseInfo& /*info*/, const std::string& /*mdn*/, const std::string& /*hSid*/,
+ const RadioResponseInfo& info, const std::string& /*mdn*/, const std::string& /*hSid*/,
const std::string& /*hNid*/, const std::string& /*min*/, const std::string& /*prl*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::getCdmaSubscriptionSourceResponse(
- const RadioResponseInfo& /*info*/, CdmaSubscriptionSource /*source*/) {
+ const RadioResponseInfo& info, CdmaSubscriptionSource /*source*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::getFacilityLockForAppResponse(
- const RadioResponseInfo& /*info*/, int32_t /*response*/) {
+ndk::ScopedAStatus RadioSimResponse::getFacilityLockForAppResponse(const RadioResponseInfo& info,
+ int32_t /*response*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -72,8 +90,11 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::getImsiForAppResponse(const RadioResponseInfo& /*info*/,
- const std::string& /*imsi*/) {
+ndk::ScopedAStatus RadioSimResponse::getImsiForAppResponse(const RadioResponseInfo& info,
+ const std::string& imsi_str) {
+ rspInfo = info;
+ imsi = imsi_str;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -91,58 +112,79 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::iccCloseLogicalChannelResponse(
- const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioSimResponse::iccCloseLogicalChannelResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::iccIoForAppResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioSimResponse::iccIoForAppResponse(const RadioResponseInfo& info,
const IccIoResult& /*iccIo*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::iccOpenLogicalChannelResponse(
- const RadioResponseInfo& /*info*/, int32_t /*channelId*/,
+ const RadioResponseInfo& info, int32_t /*channelId*/,
const std::vector<uint8_t>& /*selectResponse*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::iccTransmitApduBasicChannelResponse(
- const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
+ const RadioResponseInfo& info, const IccIoResult& /*result*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::iccTransmitApduLogicalChannelResponse(
- const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
+ const RadioResponseInfo& info, const IccIoResult& /*result*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::reportStkServiceIsRunningResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::requestIccSimAuthenticationResponse(
- const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
+ const RadioResponseInfo& info, const IccIoResult& /*result*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::sendEnvelopeResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioSimResponse::sendEnvelopeResponse(const RadioResponseInfo& info,
const std::string& /*commandResponse*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::sendEnvelopeWithStatusResponse(
- const RadioResponseInfo& /*info*/, const IccIoResult& /*iccIo*/) {
+ndk::ScopedAStatus RadioSimResponse::sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
+ const IccIoResult& /*iccIo*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::sendTerminalResponseToSimResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::setAllowedCarriersResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioSimResponse::setAllowedCarriersResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -154,12 +196,16 @@
}
ndk::ScopedAStatus RadioSimResponse::setCdmaSubscriptionSourceResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::setFacilityLockForAppResponse(
- const RadioResponseInfo& /*info*/, int32_t /*retry*/) {
+ndk::ScopedAStatus RadioSimResponse::setFacilityLockForAppResponse(const RadioResponseInfo& info,
+ int32_t /*retry*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -169,34 +215,44 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::setUiccSubscriptionResponse(
- const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioSimResponse::setUiccSubscriptionResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::supplyIccPin2ForAppResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioSimResponse::supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::supplyIccPinForAppResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioSimResponse::supplyIccPinForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::supplyIccPuk2ForAppResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioSimResponse::supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioSimResponse::supplyIccPukForAppResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioSimResponse::supplyIccPukForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::supplySimDepersonalizationResponse(
- const RadioResponseInfo& /*info*/, PersoSubstate /*persoType*/,
- int32_t /*remainingRetries*/) {
+ const RadioResponseInfo& info, PersoSubstate /*persoType*/, int32_t /*remainingRetries*/) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
diff --git a/radio/aidl/vts/radio_sim_test.cpp b/radio/aidl/vts/radio_sim_test.cpp
index 5db77f6..64474c9 100644
--- a/radio/aidl/vts/radio_sim_test.cpp
+++ b/radio/aidl/vts/radio_sim_test.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <aidl/android/hardware/radio/RadioConst.h>
#include <aidl/android/hardware/radio/config/IRadioConfig.h>
#include <android-base/logging.h>
#include <android/binder_manager.h>
@@ -260,3 +261,764 @@
}
}
}
+
+/*
+ * Test IRadioSim.enableUiccApplications() for the response returned.
+ * For SIM ABSENT case.
+ */
+TEST_P(RadioSimTest, togglingUiccApplicationsSimAbsent) {
+ // This test case only test SIM ABSENT case.
+ if (cardStatus.cardState != CardStatus::STATE_ABSENT) return;
+
+ // Disable Uicc applications.
+ serial = GetRandomSerialNumber();
+ radio_sim->enableUiccApplications(serial, false);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ // As SIM is absent, RadioError::SIM_ABSENT should be thrown.
+ EXPECT_EQ(RadioError::SIM_ABSENT, radioRsp_sim->rspInfo.error);
+
+ // Query Uicc application enablement.
+ serial = GetRandomSerialNumber();
+ radio_sim->areUiccApplicationsEnabled(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ // As SIM is absent, RadioError::SIM_ABSENT should be thrown.
+ EXPECT_EQ(RadioError::SIM_ABSENT, radioRsp_sim->rspInfo.error);
+}
+
+/*
+ * Test IRadioSim.enableUiccApplications() for the response returned.
+ * For SIM PRESENT case.
+ */
+TEST_P(RadioSimTest, togglingUiccApplicationsSimPresent) {
+ // This test case only test SIM ABSENT case.
+ if (cardStatus.cardState != CardStatus::STATE_PRESENT) return;
+ if (cardStatus.applications.size() == 0) return;
+
+ // Disable Uicc applications.
+ serial = GetRandomSerialNumber();
+ radio_sim->enableUiccApplications(serial, false);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ // As SIM is present, there shouldn't be error.
+ EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
+
+ // Query Uicc application enablement.
+ serial = GetRandomSerialNumber();
+ radio_sim->areUiccApplicationsEnabled(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ // As SIM is present, there shouldn't be error.
+ EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
+ ASSERT_FALSE(radioRsp_sim->areUiccApplicationsEnabled);
+
+ // Enable Uicc applications.
+ serial = GetRandomSerialNumber();
+ radio_sim->enableUiccApplications(serial, true);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ // As SIM is present, there shouldn't be error.
+ EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
+
+ // Query Uicc application enablement.
+ serial = GetRandomSerialNumber();
+ radio_sim->areUiccApplicationsEnabled(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ // As SIM is present, there shouldn't be error.
+ EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
+ ASSERT_TRUE(radioRsp_sim->areUiccApplicationsEnabled);
+}
+
+/*
+ * Test IRadioSim.areUiccApplicationsEnabled() for the response returned.
+ */
+TEST_P(RadioSimTest, areUiccApplicationsEnabled) {
+ // Disable Uicc applications.
+ serial = GetRandomSerialNumber();
+ radio_sim->areUiccApplicationsEnabled(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ // If SIM is absent, RadioError::SIM_ABSENT should be thrown. Otherwise there shouldn't be any
+ // error.
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ EXPECT_EQ(RadioError::SIM_ABSENT, radioRsp_sim->rspInfo.error);
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
+ }
+}
+
+/*
+ * Test IRadioSim.getAllowedCarriers() for the response returned.
+ */
+TEST_P(RadioSimTest, getAllowedCarriers) {
+ serial = GetRandomSerialNumber();
+
+ radio_sim->getAllowedCarriers(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+}
+
+/**
+ * Test IRadioSim.setAllowedCarriers() for the response returned.
+ */
+TEST_P(RadioSimTest, setAllowedCarriers) {
+ // TODO (b/210712359): remove once shim supports 1.4 or alternative is found
+ GTEST_SKIP();
+ serial = GetRandomSerialNumber();
+ CarrierRestrictions carrierRestrictions;
+ memset(&carrierRestrictions, 0, sizeof(carrierRestrictions));
+ carrierRestrictions.allowedCarriers.resize(1);
+ carrierRestrictions.excludedCarriers.resize(0);
+ carrierRestrictions.allowedCarriers[0].mcc = std::string("123");
+ carrierRestrictions.allowedCarriers[0].mnc = std::string("456");
+ carrierRestrictions.allowedCarriers[0].matchType = Carrier::MATCH_TYPE_ALL;
+ carrierRestrictions.allowedCarriers[0].matchData = std::string();
+ carrierRestrictions.allowedCarriersPrioritized = true;
+ SimLockMultiSimPolicy multisimPolicy = SimLockMultiSimPolicy::NO_MULTISIM_POLICY;
+
+ radio_sim->setAllowedCarriers(serial, carrierRestrictions, multisimPolicy);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+
+ if (radioRsp_sim->rspInfo.error == RadioError::NONE) {
+ /* Verify the update of the SIM status. This might need some time */
+ if (cardStatus.cardState != CardStatus::STATE_ABSENT) {
+ updateSimCardStatus();
+ auto startTime = std::chrono::system_clock::now();
+ while (cardStatus.cardState != CardStatus::STATE_RESTRICTED &&
+ std::chrono::duration_cast<std::chrono::seconds>(
+ std::chrono::system_clock::now() - startTime)
+ .count() < 30) {
+ /* Set 2 seconds as interval to check card status */
+ sleep(2);
+ updateSimCardStatus();
+ }
+ EXPECT_EQ(CardStatus::STATE_RESTRICTED, cardStatus.cardState);
+ }
+
+ /* Verify that configuration was set correctly, retrieving it from the modem */
+ serial = GetRandomSerialNumber();
+
+ radio_sim->getAllowedCarriers(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
+
+ EXPECT_EQ(1, radioRsp_sim->carrierRestrictionsResp.allowedCarriers.size());
+ EXPECT_EQ(0, radioRsp_sim->carrierRestrictionsResp.excludedCarriers.size());
+ ASSERT_TRUE(std::string("123") ==
+ radioRsp_sim->carrierRestrictionsResp.allowedCarriers[0].mcc);
+ ASSERT_TRUE(std::string("456") ==
+ radioRsp_sim->carrierRestrictionsResp.allowedCarriers[0].mnc);
+ EXPECT_EQ(Carrier::MATCH_TYPE_ALL,
+ radioRsp_sim->carrierRestrictionsResp.allowedCarriers[0].matchType);
+ ASSERT_TRUE(radioRsp_sim->carrierRestrictionsResp.allowedCarriersPrioritized);
+ EXPECT_EQ(SimLockMultiSimPolicy::NO_MULTISIM_POLICY, radioRsp_sim->multiSimPolicyResp);
+
+ sleep(10);
+
+ /**
+ * Another test case of the API to cover to allow carrier.
+ * If the API is supported, this is also used to reset to no carrier restriction
+ * status for cardStatus.
+ */
+ memset(&carrierRestrictions, 0, sizeof(carrierRestrictions));
+ carrierRestrictions.allowedCarriers.resize(0);
+ carrierRestrictions.excludedCarriers.resize(0);
+ carrierRestrictions.allowedCarriersPrioritized = false;
+
+ serial = GetRandomSerialNumber();
+ radio_sim->setAllowedCarriers(serial, carrierRestrictions, multisimPolicy);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
+
+ if (cardStatus.cardState != CardStatus::STATE_ABSENT) {
+ /* Resetting back to no carrier restriction needs some time */
+ updateSimCardStatus();
+ auto startTime = std::chrono::system_clock::now();
+ while (cardStatus.cardState == CardStatus::STATE_RESTRICTED &&
+ std::chrono::duration_cast<std::chrono::seconds>(
+ std::chrono::system_clock::now() - startTime)
+ .count() < 10) {
+ /* Set 2 seconds as interval to check card status */
+ sleep(2);
+ updateSimCardStatus();
+ }
+ EXPECT_NE(CardStatus::STATE_RESTRICTED, cardStatus.cardState);
+ sleep(10);
+ }
+ }
+}
+
+/*
+ * Test IRadioSim.getIccCardStatus() for the response returned.
+ */
+TEST_P(RadioSimTest, getIccCardStatus) {
+ LOG(DEBUG) << "getIccCardStatus";
+ EXPECT_LE(cardStatus.applications.size(), RadioConst::CARD_MAX_APPS);
+ EXPECT_LT(cardStatus.gsmUmtsSubscriptionAppIndex, RadioConst::CARD_MAX_APPS);
+ EXPECT_LT(cardStatus.cdmaSubscriptionAppIndex, RadioConst::CARD_MAX_APPS);
+ EXPECT_LT(cardStatus.imsSubscriptionAppIndex, RadioConst::CARD_MAX_APPS);
+ LOG(DEBUG) << "getIccCardStatus finished";
+}
+
+/*
+ * Test IRadioSim.supplyIccPinForApp() for the response returned
+ */
+TEST_P(RadioSimTest, supplyIccPinForApp) {
+ LOG(DEBUG) << "supplyIccPinForApp";
+ serial = GetRandomSerialNumber();
+
+ // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
+ // 3GPP2 apps only
+ for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+ if (cardStatus.applications[i].appType == AppStatus::APP_TYPE_SIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_USIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_RUIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_CSIM) {
+ radio_sim->supplyIccPinForApp(serial, std::string("test1"),
+ cardStatus.applications[i].aidPtr);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_sim->rspInfo.error,
+ {RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+ }
+ LOG(DEBUG) << "supplyIccPinForApp finished";
+}
+
+/*
+ * Test IRadioSim.supplyIccPukForApp() for the response returned.
+ */
+TEST_P(RadioSimTest, supplyIccPukForApp) {
+ LOG(DEBUG) << "supplyIccPukForApp";
+ serial = GetRandomSerialNumber();
+
+ // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
+ // 3GPP2 apps only
+ for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+ if (cardStatus.applications[i].appType == AppStatus::APP_TYPE_SIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_USIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_RUIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_CSIM) {
+ radio_sim->supplyIccPukForApp(serial, std::string("test1"), std::string("test2"),
+ cardStatus.applications[i].aidPtr);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_sim->rspInfo.error,
+ {RadioError::PASSWORD_INCORRECT, RadioError::INVALID_SIM_STATE}));
+ }
+ }
+ LOG(DEBUG) << "supplyIccPukForApp finished";
+}
+
+/*
+ * Test IRadioSim.supplyIccPin2ForApp() for the response returned.
+ */
+TEST_P(RadioSimTest, supplyIccPin2ForApp) {
+ LOG(DEBUG) << "supplyIccPin2ForApp";
+ serial = GetRandomSerialNumber();
+
+ // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
+ // 3GPP2 apps only
+ for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+ if (cardStatus.applications[i].appType == AppStatus::APP_TYPE_SIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_USIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_RUIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_CSIM) {
+ radio_sim->supplyIccPin2ForApp(serial, std::string("test1"),
+ cardStatus.applications[i].aidPtr);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ ASSERT_TRUE(
+ CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::PASSWORD_INCORRECT,
+ RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_PUK2}));
+ }
+ }
+ LOG(DEBUG) << "supplyIccPin2ForApp finished";
+}
+
+/*
+ * Test IRadioSim.supplyIccPuk2ForApp() for the response returned.
+ */
+TEST_P(RadioSimTest, supplyIccPuk2ForApp) {
+ LOG(DEBUG) << "supplyIccPuk2ForApp";
+ serial = GetRandomSerialNumber();
+
+ // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
+ // 3GPP2 apps only
+ for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+ if (cardStatus.applications[i].appType == AppStatus::APP_TYPE_SIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_USIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_RUIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_CSIM) {
+ radio_sim->supplyIccPuk2ForApp(serial, std::string("test1"), std::string("test2"),
+ cardStatus.applications[i].aidPtr);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_sim->rspInfo.error,
+ {RadioError::PASSWORD_INCORRECT, RadioError::INVALID_SIM_STATE}));
+ }
+ }
+ LOG(DEBUG) << "supplyIccPuk2ForApp finished";
+}
+
+/*
+ * Test IRadioSim.changeIccPinForApp() for the response returned.
+ */
+TEST_P(RadioSimTest, changeIccPinForApp) {
+ LOG(DEBUG) << "changeIccPinForApp";
+ serial = GetRandomSerialNumber();
+
+ // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
+ // 3GPP2 apps only
+ for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+ if (cardStatus.applications[i].appType == AppStatus::APP_TYPE_SIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_USIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_RUIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_CSIM) {
+ radio_sim->changeIccPinForApp(serial, std::string("test1"), std::string("test2"),
+ cardStatus.applications[i].aidPtr);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_sim->rspInfo.error,
+ {RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+ }
+ LOG(DEBUG) << "changeIccPinForApp finished";
+}
+
+/*
+ * Test IRadioSim.changeIccPin2ForApp() for the response returned.
+ */
+TEST_P(RadioSimTest, changeIccPin2ForApp) {
+ LOG(DEBUG) << "changeIccPin2ForApp";
+ serial = GetRandomSerialNumber();
+
+ // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
+ // 3GPP2 apps only
+ for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+ if (cardStatus.applications[i].appType == AppStatus::APP_TYPE_SIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_USIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_RUIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_CSIM) {
+ radio_sim->changeIccPin2ForApp(serial, std::string("test1"), std::string("test2"),
+ cardStatus.applications[i].aidPtr);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ ASSERT_TRUE(
+ CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::PASSWORD_INCORRECT,
+ RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_PUK2}));
+ }
+ }
+ LOG(DEBUG) << "changeIccPin2ForApp finished";
+}
+
+/*
+ * Test IRadioSim.getImsiForApp() for the response returned.
+ */
+TEST_P(RadioSimTest, getImsiForApp) {
+ LOG(DEBUG) << "getImsiForApp";
+ serial = GetRandomSerialNumber();
+
+ // Check success returned while getting imsi for 3GPP and 3GPP2 apps only
+ for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+ if (cardStatus.applications[i].appType == AppStatus::APP_TYPE_SIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_USIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_RUIM ||
+ cardStatus.applications[i].appType == AppStatus::APP_TYPE_CSIM) {
+ radio_sim->getImsiForApp(serial, cardStatus.applications[i].aidPtr);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error, {RadioError::NONE},
+ CHECK_GENERAL_ERROR));
+
+ // IMSI (MCC+MNC+MSIN) is at least 6 digits, but not more than 15
+ if (radioRsp_sim->rspInfo.error == RadioError::NONE) {
+ EXPECT_NE(radioRsp_sim->imsi, std::string());
+ EXPECT_GE((int)(radioRsp_sim->imsi).size(), 6);
+ EXPECT_LE((int)(radioRsp_sim->imsi).size(), 15);
+ }
+ }
+ }
+ LOG(DEBUG) << "getImsiForApp finished";
+}
+
+/*
+ * Test IRadioSim.iccIoForApp() for the response returned.
+ */
+TEST_P(RadioSimTest, iccIoForApp) {
+ LOG(DEBUG) << "iccIoForApp";
+ serial = GetRandomSerialNumber();
+
+ for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+ IccIo iccIo;
+ iccIo.command = 0xc0;
+ iccIo.fileId = 0x6f11;
+ iccIo.path = std::string("3F007FFF");
+ iccIo.p1 = 0;
+ iccIo.p2 = 0;
+ iccIo.p3 = 0;
+ iccIo.data = std::string();
+ iccIo.pin2 = std::string();
+ iccIo.aid = cardStatus.applications[i].aidPtr;
+
+ radio_sim->iccIoForApp(serial, iccIo);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ }
+ LOG(DEBUG) << "iccIoForApp finished";
+}
+
+/*
+ * Test IRadioSim.iccTransmitApduBasicChannel() for the response returned.
+ */
+TEST_P(RadioSimTest, iccTransmitApduBasicChannel) {
+ LOG(DEBUG) << "iccTransmitApduBasicChannel";
+ serial = GetRandomSerialNumber();
+ SimApdu msg;
+ memset(&msg, 0, sizeof(msg));
+ msg.data = std::string();
+
+ radio_sim->iccTransmitApduBasicChannel(serial, msg);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ LOG(DEBUG) << "iccTransmitApduBasicChannel finished";
+}
+
+/*
+ * Test IRadioSim.iccOpenLogicalChannel() for the response returned.
+ */
+TEST_P(RadioSimTest, iccOpenLogicalChannel) {
+ LOG(DEBUG) << "iccOpenLogicalChannel";
+ serial = GetRandomSerialNumber();
+ int p2 = 0x04;
+ // Specified in ISO 7816-4 clause 7.1.1 0x04 means that FCP template is requested.
+ for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+ radio_sim->iccOpenLogicalChannel(serial, cardStatus.applications[i].aidPtr, p2);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ }
+ LOG(DEBUG) << "iccOpenLogicalChannel finished";
+}
+
+/*
+ * Test IRadioSim.iccCloseLogicalChannel() for the response returned.
+ */
+TEST_P(RadioSimTest, iccCloseLogicalChannel) {
+ LOG(DEBUG) << "iccCloseLogicalChannel";
+ serial = GetRandomSerialNumber();
+ // Try closing invalid channel and check INVALID_ARGUMENTS returned as error
+ radio_sim->iccCloseLogicalChannel(serial, 0);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp_sim->rspInfo.error);
+ LOG(DEBUG) << "iccCloseLogicalChannel finished";
+}
+
+/*
+ * Test IRadioSim.iccTransmitApduLogicalChannel() for the response returned.
+ */
+TEST_P(RadioSimTest, iccTransmitApduLogicalChannel) {
+ LOG(DEBUG) << "iccTransmitApduLogicalChannel";
+ serial = GetRandomSerialNumber();
+ SimApdu msg;
+ memset(&msg, 0, sizeof(msg));
+ msg.data = std::string();
+
+ radio_sim->iccTransmitApduLogicalChannel(serial, msg);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ LOG(DEBUG) << "iccTransmitApduLogicalChannel finished";
+}
+
+/*
+ * Test IRadioSim.requestIccSimAuthentication() for the response returned.
+ */
+TEST_P(RadioSimTest, requestIccSimAuthentication) {
+ LOG(DEBUG) << "requestIccSimAuthentication";
+ serial = GetRandomSerialNumber();
+
+ // Pass wrong challenge string and check RadioError::INVALID_ARGUMENTS
+ // or REQUEST_NOT_SUPPORTED returned as error.
+ for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+ radio_sim->requestIccSimAuthentication(serial, 0, std::string("test"),
+ cardStatus.applications[i].aidPtr);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_sim->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+ LOG(DEBUG) << "requestIccSimAuthentication finished";
+}
+
+/*
+ * Test IRadioSim.getFacilityLockForApp() for the response returned.
+ */
+TEST_P(RadioSimTest, getFacilityLockForApp) {
+ serial = GetRandomSerialNumber();
+ std::string facility = "";
+ std::string password = "";
+ int32_t serviceClass = 1;
+ std::string appId = "";
+
+ radio_sim->getFacilityLockForApp(serial, facility, password, serviceClass, appId);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+}
+
+/*
+ * Test IRadioSim.setFacilityLockForApp() for the response returned.
+ */
+TEST_P(RadioSimTest, setFacilityLockForApp) {
+ serial = GetRandomSerialNumber();
+ std::string facility = "";
+ bool lockState = false;
+ std::string password = "";
+ int32_t serviceClass = 1;
+ std::string appId = "";
+
+ radio_sim->setFacilityLockForApp(serial, facility, lockState, password, serviceClass, appId);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+}
+
+/*
+ * Test IRadioSim.getCdmaSubscription() for the response returned.
+ */
+TEST_P(RadioSimTest, getCdmaSubscription) {
+ LOG(DEBUG) << "getCdmaSubscription";
+ serial = GetRandomSerialNumber();
+
+ radio_sim->getCdmaSubscription(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_sim->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT}));
+ }
+ LOG(DEBUG) << "getCdmaSubscription finished";
+}
+
+/*
+ * Test IRadioSim.getCdmaSubscriptionSource() for the response returned.
+ */
+TEST_P(RadioSimTest, getCdmaSubscriptionSource) {
+ LOG(DEBUG) << "getCdmaSubscriptionSource";
+ serial = GetRandomSerialNumber();
+
+ radio_sim->getCdmaSubscriptionSource(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_sim->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT}));
+ }
+ LOG(DEBUG) << "getCdmaSubscriptionSource finished";
+}
+
+/*
+ * Test IRadioSim.setCdmaSubscriptionSource() for the response returned.
+ */
+TEST_P(RadioSimTest, setCdmaSubscriptionSource) {
+ LOG(DEBUG) << "setCdmaSubscriptionSource";
+ serial = GetRandomSerialNumber();
+
+ radio_sim->setCdmaSubscriptionSource(serial, CdmaSubscriptionSource::RUIM_SIM);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_sim->rspInfo.error,
+ {RadioError::NONE, RadioError::SIM_ABSENT, RadioError::SUBSCRIPTION_NOT_AVAILABLE},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "setCdmaSubscriptionSource finished";
+}
+
+/*
+ * Test IRadioSim.setUiccSubscription() for the response returned.
+ */
+TEST_P(RadioSimTest, setUiccSubscription) {
+ LOG(DEBUG) << "setUiccSubscription";
+ serial = GetRandomSerialNumber();
+ SelectUiccSub item;
+ memset(&item, 0, sizeof(item));
+
+ radio_sim->setUiccSubscription(serial, item);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(
+ CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS,
+ RadioError::MODEM_ERR, RadioError::SUBSCRIPTION_NOT_SUPPORTED},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "setUiccSubscription finished";
+}
+
+/*
+ * Test IRadioSim.sendEnvelope() for the response returned.
+ */
+TEST_P(RadioSimTest, sendEnvelope) {
+ LOG(DEBUG) << "sendEnvelope";
+ serial = GetRandomSerialNumber();
+
+ // Test with sending empty string
+ std::string content = "";
+
+ radio_sim->sendEnvelope(serial, content);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS,
+ RadioError::MODEM_ERR, RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "sendEnvelope finished";
+}
+
+/*
+ * Test IRadioSim.sendTerminalResponseToSim() for the response returned.
+ */
+TEST_P(RadioSimTest, sendTerminalResponseToSim) {
+ LOG(DEBUG) << "sendTerminalResponseToSim";
+ serial = GetRandomSerialNumber();
+
+ // Test with sending empty string
+ std::string commandResponse = "";
+
+ radio_sim->sendTerminalResponseToSim(serial, commandResponse);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_sim->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "sendTerminalResponseToSim finished";
+}
+
+/*
+ * Test IRadioSim.reportStkServiceIsRunning() for the response returned.
+ */
+TEST_P(RadioSimTest, reportStkServiceIsRunning) {
+ LOG(DEBUG) << "reportStkServiceIsRunning";
+ serial = GetRandomSerialNumber();
+
+ radio_sim->reportStkServiceIsRunning(serial);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error, {RadioError::NONE},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "reportStkServiceIsRunning finished";
+}
+
+/*
+ * Test IRadioSim.sendEnvelopeWithStatus() for the response returned with empty
+ * string.
+ */
+TEST_P(RadioSimTest, sendEnvelopeWithStatus) {
+ LOG(DEBUG) << "sendEnvelopeWithStatus";
+ serial = GetRandomSerialNumber();
+
+ // Test with sending empty string
+ std::string contents = "";
+
+ radio_sim->sendEnvelopeWithStatus(serial, contents);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_sim->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR, RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "sendEnvelopeWithStatus finished";
+}
diff --git a/radio/aidl/vts/radio_sim_utils.h b/radio/aidl/vts/radio_sim_utils.h
index b5e365d..83f1cbc 100644
--- a/radio/aidl/vts/radio_sim_utils.h
+++ b/radio/aidl/vts/radio_sim_utils.h
@@ -42,6 +42,7 @@
bool areUiccApplicationsEnabled;
PhonebookCapacity capacity;
int32_t updatedRecordIndex;
+ std::string imsi;
virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
diff --git a/radio/aidl/vts/radio_voice_indication.cpp b/radio/aidl/vts/radio_voice_indication.cpp
index d814c18..3fee326 100644
--- a/radio/aidl/vts/radio_voice_indication.cpp
+++ b/radio/aidl/vts/radio_voice_indication.cpp
@@ -65,6 +65,12 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus RadioVoiceIndication::onUssd(RadioIndicationType /*type*/,
+ UssdModeType /*modeType*/,
+ const std::string& /*msg*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
ndk::ScopedAStatus RadioVoiceIndication::resendIncallMute(RadioIndicationType /*type*/) {
return ndk::ScopedAStatus::ok();
}
diff --git a/radio/aidl/vts/radio_voice_response.cpp b/radio/aidl/vts/radio_voice_response.cpp
index a491613..dd7b1bf 100644
--- a/radio/aidl/vts/radio_voice_response.cpp
+++ b/radio/aidl/vts/radio_voice_response.cpp
@@ -18,7 +18,9 @@
RadioVoiceResponse::RadioVoiceResponse(RadioServiceTest& parent) : parent_voice(parent) {}
-ndk::ScopedAStatus RadioVoiceResponse::acceptCallResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::acceptCallResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -26,11 +28,21 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::conferenceResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::cancelPendingUssdResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::dialResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::conferenceResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::dialResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -41,34 +53,44 @@
}
ndk::ScopedAStatus RadioVoiceResponse::exitEmergencyCallbackModeResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::explicitCallTransferResponse(
- const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::explicitCallTransferResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::getCallForwardStatusResponse(
- const RadioResponseInfo& /*info*/,
- const std::vector<CallForwardInfo>& /*callForwardInfos*/) {
+ const RadioResponseInfo& info, const std::vector<CallForwardInfo>& /*callForwardInfos*/) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::getCallWaitingResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioVoiceResponse::getCallWaitingResponse(const RadioResponseInfo& info,
bool /*enable*/,
int32_t /*serviceClass*/) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::getClipResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioVoiceResponse::getClipResponse(const RadioResponseInfo& info,
ClipStatus /*status*/) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::getClirResponse(const RadioResponseInfo& /*info*/,
- int32_t /*n*/, int32_t /*m*/) {
+ndk::ScopedAStatus RadioVoiceResponse::getClirResponse(const RadioResponseInfo& info, int32_t /*n*/,
+ int32_t /*m*/) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -81,27 +103,37 @@
}
ndk::ScopedAStatus RadioVoiceResponse::getLastCallFailCauseResponse(
- const RadioResponseInfo& /*info*/, const LastCallFailCauseInfo& /*failCauseInfo*/) {
+ const RadioResponseInfo& info, const LastCallFailCauseInfo& /*failCauseInfo*/) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::getMuteResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioVoiceResponse::getMuteResponse(const RadioResponseInfo& info,
bool /*enable*/) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::getPreferredVoicePrivacyResponse(
- const RadioResponseInfo& /*info*/, bool /*enable*/) {
+ const RadioResponseInfo& info, bool /*enable*/) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::getTtyModeResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioVoiceResponse::getTtyModeResponse(const RadioResponseInfo& info,
TtyMode /*mode*/) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::handleStkCallSetupRequestFromSimResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@@ -112,80 +144,120 @@
}
ndk::ScopedAStatus RadioVoiceResponse::hangupForegroundResumeBackgroundResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::hangupWaitingOrBackgroundResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::isVoNrEnabledResponse(const RadioResponseInfo& /*info*/,
+ndk::ScopedAStatus RadioVoiceResponse::isVoNrEnabledResponse(const RadioResponseInfo& info,
bool /*enabled*/) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::rejectCallResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::rejectCallResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::sendBurstDtmfResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::sendBurstDtmfResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::sendCdmaFeatureCodeResponse(
- const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::sendCdmaFeatureCodeResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::sendDtmfResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::sendDtmfResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::separateConnectionResponse(
- const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::sendUssdResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::setCallForwardResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::separateConnectionResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::setCallWaitingResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::setCallForwardResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::setClirResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::setCallWaitingResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::setMuteResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::setClirResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::setMuteResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::setPreferredVoicePrivacyResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::setTtyModeResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::setTtyModeResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::setVoNrEnabledResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::setVoNrEnabledResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::startDtmfResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::startDtmfResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus RadioVoiceResponse::stopDtmfResponse(const RadioResponseInfo& /*info*/) {
+ndk::ScopedAStatus RadioVoiceResponse::stopDtmfResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::switchWaitingOrHoldingAndActiveResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
diff --git a/radio/aidl/vts/radio_voice_test.cpp b/radio/aidl/vts/radio_voice_test.cpp
index 717f3f0..eec28b1 100644
--- a/radio/aidl/vts/radio_voice_test.cpp
+++ b/radio/aidl/vts/radio_voice_test.cpp
@@ -265,3 +265,681 @@
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
}
+
+/*
+ * Test IRadioVoice.getClir() for the response returned.
+ */
+TEST_P(RadioVoiceTest, getClir) {
+ serial = GetRandomSerialNumber();
+
+ radio_voice->getClir(serial);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+}
+
+/*
+ * Test IRadioVoice.setClir() for the response returned.
+ */
+TEST_P(RadioVoiceTest, setClir) {
+ serial = GetRandomSerialNumber();
+ int32_t status = 1;
+
+ radio_voice->setClir(serial, status);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
+ }
+}
+
+/*
+ * Test IRadioVoice.getClip() for the response returned.
+ */
+TEST_P(RadioVoiceTest, getClip) {
+ serial = GetRandomSerialNumber();
+
+ radio_voice->getClip(serial);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+}
+
+/*
+ * Test IRadioVoice.getTtyMode() for the response returned.
+ */
+TEST_P(RadioVoiceTest, getTtyMode) {
+ LOG(DEBUG) << "getTtyMode";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->getTtyMode(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
+ }
+ LOG(DEBUG) << "getTtyMode finished";
+}
+
+/*
+ * Test IRadioVoice.setTtyMode() for the response returned.
+ */
+TEST_P(RadioVoiceTest, setTtyMode) {
+ LOG(DEBUG) << "setTtyMode";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->setTtyMode(serial, TtyMode::OFF);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
+ }
+ LOG(DEBUG) << "setTtyMode finished";
+}
+
+/*
+ * Test IRadioVoice.setPreferredVoicePrivacy() for the response returned.
+ */
+TEST_P(RadioVoiceTest, setPreferredVoicePrivacy) {
+ LOG(DEBUG) << "setPreferredVoicePrivacy";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->setPreferredVoicePrivacy(serial, true);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+ LOG(DEBUG) << "setPreferredVoicePrivacy finished";
+}
+
+/*
+ * Test IRadioVoice.getPreferredVoicePrivacy() for the response returned.
+ */
+TEST_P(RadioVoiceTest, getPreferredVoicePrivacy) {
+ LOG(DEBUG) << "getPreferredVoicePrivacy";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->getPreferredVoicePrivacy(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+ LOG(DEBUG) << "getPreferredVoicePrivacy finished";
+}
+
+/*
+ * Test IRadioVoice.exitEmergencyCallbackMode() for the response returned.
+ */
+TEST_P(RadioVoiceTest, exitEmergencyCallbackMode) {
+ LOG(DEBUG) << "exitEmergencyCallbackMode";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->exitEmergencyCallbackMode(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_voice->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT}));
+ }
+ LOG(DEBUG) << "exitEmergencyCallbackMode finished";
+}
+
+/*
+ * Test IRadioVoice.handleStkCallSetupRequestFromSim() for the response returned.
+ */
+TEST_P(RadioVoiceTest, handleStkCallSetupRequestFromSim) {
+ LOG(DEBUG) << "handleStkCallSetupRequestFromSim";
+ serial = GetRandomSerialNumber();
+ bool accept = false;
+
+ radio_voice->handleStkCallSetupRequestFromSim(serial, accept);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS,
+ RadioError::MODEM_ERR, RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "handleStkCallSetupRequestFromSim finished";
+}
+
+/*
+ * Test IRadioVoice.dial() for the response returned.
+ */
+TEST_P(RadioVoiceTest, dial) {
+ LOG(DEBUG) << "dial";
+ serial = GetRandomSerialNumber();
+
+ Dial dialInfo;
+ memset(&dialInfo, 0, sizeof(dialInfo));
+ dialInfo.address = std::string("123456789");
+
+ radio_voice->dial(serial, dialInfo);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_voice->rspInfo.error,
+ {RadioError::CANCELLED, RadioError::DEVICE_IN_USE, RadioError::FDN_CHECK_FAILURE,
+ RadioError::INVALID_ARGUMENTS, RadioError::INVALID_CALL_ID,
+ RadioError::INVALID_MODEM_STATE, RadioError::INVALID_STATE, RadioError::MODEM_ERR,
+ RadioError::NO_NETWORK_FOUND, RadioError::NO_SUBSCRIPTION,
+ RadioError::OPERATION_NOT_ALLOWED},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "dial finished";
+}
+
+/*
+ * Test IRadioVoice.hangup() for the response returned.
+ */
+TEST_P(RadioVoiceTest, hangup) {
+ LOG(DEBUG) << "hangup";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->hangup(serial, 1);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_voice->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "hangup finished";
+}
+
+/*
+ * Test IRadioVoice.hangupWaitingOrBackground() for the response returned.
+ */
+TEST_P(RadioVoiceTest, hangupWaitingOrBackground) {
+ LOG(DEBUG) << "hangupWaitingOrBackground";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->hangupWaitingOrBackground(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
+ {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "hangupWaitingOrBackground finished";
+}
+
+/*
+ * Test IRadioVoice.hangupForegroundResumeBackground() for the response returned.
+ */
+TEST_P(RadioVoiceTest, hangupForegroundResumeBackground) {
+ LOG(DEBUG) << "hangupForegroundResumeBackground";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->hangupForegroundResumeBackground(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
+ {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "hangupForegroundResumeBackground finished";
+}
+
+/*
+ * Test IRadioVoice.switchWaitingOrHoldingAndActive() for the response returned.
+ */
+TEST_P(RadioVoiceTest, switchWaitingOrHoldingAndActive) {
+ LOG(DEBUG) << "switchWaitingOrHoldingAndActive";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->switchWaitingOrHoldingAndActive(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
+ {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "switchWaitingOrHoldingAndActive finished";
+}
+
+/*
+ * Test IRadioVoice.conference() for the response returned.
+ */
+TEST_P(RadioVoiceTest, conference) {
+ LOG(DEBUG) << "conference";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->conference(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
+ {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "conference finished";
+}
+
+/*
+ * Test IRadioVoice.rejectCall() for the response returned.
+ */
+TEST_P(RadioVoiceTest, rejectCall) {
+ LOG(DEBUG) << "rejectCall";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->rejectCall(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
+ {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "rejectCall finished";
+}
+
+/*
+ * Test IRadioVoice.getLastCallFailCause() for the response returned.
+ */
+TEST_P(RadioVoiceTest, getLastCallFailCause) {
+ LOG(DEBUG) << "getLastCallFailCause";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->getLastCallFailCause(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::NONE},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "getLastCallFailCause finished";
+}
+
+/*
+ * Test IRadioVoice.getCallForwardStatus() for the response returned.
+ */
+TEST_P(RadioVoiceTest, getCallForwardStatus) {
+ LOG(DEBUG) << "getCallForwardStatus";
+ serial = GetRandomSerialNumber();
+ CallForwardInfo callInfo;
+ memset(&callInfo, 0, sizeof(callInfo));
+ callInfo.number = std::string();
+
+ radio_voice->getCallForwardStatus(serial, callInfo);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_voice->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "getCallForwardStatus finished";
+}
+
+/*
+ * Test IRadioVoice.setCallForward() for the response returned.
+ */
+TEST_P(RadioVoiceTest, setCallForward) {
+ LOG(DEBUG) << "setCallForward";
+ serial = GetRandomSerialNumber();
+ CallForwardInfo callInfo;
+ memset(&callInfo, 0, sizeof(callInfo));
+ callInfo.number = std::string();
+
+ radio_voice->setCallForward(serial, callInfo);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_voice->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "setCallForward finished";
+}
+
+/*
+ * Test IRadioVoice.getCallWaiting() for the response returned.
+ */
+TEST_P(RadioVoiceTest, getCallWaiting) {
+ LOG(DEBUG) << "getCallWaiting";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->getCallWaiting(serial, 1);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_voice->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "getCallWaiting finished";
+}
+
+/*
+ * Test IRadioVoice.setCallWaiting() for the response returned.
+ */
+TEST_P(RadioVoiceTest, setCallWaiting) {
+ LOG(DEBUG) << "setCallWaiting";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->setCallWaiting(serial, true, 1);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_voice->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "setCallWaiting finished";
+}
+
+/*
+ * Test IRadioVoice.acceptCall() for the response returned.
+ */
+TEST_P(RadioVoiceTest, acceptCall) {
+ LOG(DEBUG) << "acceptCall";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->acceptCall(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
+ {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "acceptCall finished";
+}
+
+/*
+ * Test IRadioVoice.separateConnection() for the response returned.
+ */
+TEST_P(RadioVoiceTest, separateConnection) {
+ LOG(DEBUG) << "separateConnection";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->separateConnection(serial, 1);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_voice->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "separateConnection finished";
+}
+
+/*
+ * Test IRadioVoice.explicitCallTransfer() for the response returned.
+ */
+TEST_P(RadioVoiceTest, explicitCallTransfer) {
+ LOG(DEBUG) << "explicitCallTransfer";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->explicitCallTransfer(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
+ {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "explicitCallTransfer finished";
+}
+
+/*
+ * Test IRadioVoice.sendCdmaFeatureCode() for the response returned.
+ */
+TEST_P(RadioVoiceTest, sendCdmaFeatureCode) {
+ LOG(DEBUG) << "sendCdmaFeatureCode";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->sendCdmaFeatureCode(serial, std::string());
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS,
+ RadioError::INVALID_CALL_ID, RadioError::INVALID_MODEM_STATE,
+ RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "sendCdmaFeatureCode finished";
+}
+
+/*
+ * Test IRadioVoice.sendDtmf() for the response returned.
+ */
+TEST_P(RadioVoiceTest, sendDtmf) {
+ LOG(DEBUG) << "sendDtmf";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->sendDtmf(serial, "1");
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_voice->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_CALL_ID,
+ RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "sendDtmf finished";
+}
+
+/*
+ * Test IRadioVoice.startDtmf() for the response returned.
+ */
+TEST_P(RadioVoiceTest, startDtmf) {
+ LOG(DEBUG) << "startDtmf";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->startDtmf(serial, "1");
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_voice->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_CALL_ID,
+ RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "startDtmf finished";
+}
+
+/*
+ * Test IRadioVoice.stopDtmf() for the response returned.
+ */
+TEST_P(RadioVoiceTest, stopDtmf) {
+ LOG(DEBUG) << "stopDtmf";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->stopDtmf(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_CALL_ID,
+ RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "stopDtmf finished";
+}
+
+/*
+ * Test IRadioVoice.setMute() for the response returned.
+ */
+TEST_P(RadioVoiceTest, setMute) {
+ LOG(DEBUG) << "setMute";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->setMute(serial, true);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "setMute finished";
+}
+
+/*
+ * Test IRadioVoice.getMute() for the response returned.
+ */
+TEST_P(RadioVoiceTest, getMute) {
+ LOG(DEBUG) << "getMute";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->getMute(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
+ }
+ LOG(DEBUG) << "getMute finished";
+}
+
+/*
+ * Test IRadioVoice.sendBurstDtmf() for the response returned.
+ */
+TEST_P(RadioVoiceTest, sendBurstDtmf) {
+ LOG(DEBUG) << "sendBurstDtmf";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->sendBurstDtmf(serial, "1", 0, 0);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE,
+ RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "sendBurstDtmf finished";
+}
+
+/*
+ * Test IRadioVoice.sendUssd() for the response returned.
+ */
+TEST_P(RadioVoiceTest, sendUssd) {
+ LOG(DEBUG) << "sendUssd";
+ serial = GetRandomSerialNumber();
+ radio_voice->sendUssd(serial, std::string("test"));
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_voice->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "sendUssd finished";
+}
+
+/*
+ * Test IRadioVoice.cancelPendingUssd() for the response returned.
+ */
+TEST_P(RadioVoiceTest, cancelPendingUssd) {
+ LOG(DEBUG) << "cancelPendingUssd";
+ serial = GetRandomSerialNumber();
+
+ radio_voice->cancelPendingUssd(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_voice->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "cancelPendingUssd finished";
+}
diff --git a/radio/aidl/vts/radio_voice_utils.h b/radio/aidl/vts/radio_voice_utils.h
index d61bf1e..0c3df7f 100644
--- a/radio/aidl/vts/radio_voice_utils.h
+++ b/radio/aidl/vts/radio_voice_utils.h
@@ -43,6 +43,8 @@
virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
+ virtual ndk::ScopedAStatus cancelPendingUssdResponse(const RadioResponseInfo& info) override;
+
virtual ndk::ScopedAStatus conferenceResponse(const RadioResponseInfo& info) override;
virtual ndk::ScopedAStatus dialResponse(const RadioResponseInfo& info) override;
@@ -103,6 +105,8 @@
virtual ndk::ScopedAStatus sendDtmfResponse(const RadioResponseInfo& info) override;
+ virtual ndk::ScopedAStatus sendUssdResponse(const RadioResponseInfo& info) override;
+
virtual ndk::ScopedAStatus separateConnectionResponse(const RadioResponseInfo& info) override;
virtual ndk::ScopedAStatus setCallForwardResponse(const RadioResponseInfo& info) override;
@@ -164,6 +168,9 @@
virtual ndk::ScopedAStatus onSupplementaryServiceIndication(
RadioIndicationType type, const StkCcUnsolSsResult& ss) override;
+ virtual ndk::ScopedAStatus onUssd(RadioIndicationType type, UssdModeType modeType,
+ const std::string& msg) override;
+
virtual ndk::ScopedAStatus resendIncallMute(RadioIndicationType type) override;
virtual ndk::ScopedAStatus srvccStateNotify(RadioIndicationType type,
diff --git a/security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl b/security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl
index b0761bf..153a04f 100644
--- a/security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl
+++ b/security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl
@@ -27,29 +27,27 @@
@VintfStability
parcelable DeviceInfo {
/**
- * DeviceInfo is a CBOR Map structure described by the following CDDL.
+ * DeviceInfo is a CBOR Map structure described by the following CDDL. DeviceInfo must be
+ * canonicalized according to the specification in RFC 7049. The ordering presented here is
+ * non-canonical to group similar entries semantically.
*
* DeviceInfo = {
- * ? "brand" : tstr,
- * ? "manufacturer" : tstr,
- * ? "product" : tstr,
- * ? "model" : tstr,
- * ? "board" : tstr,
- * ? "vb_state" : "green" / "yellow" / "orange", // Taken from the AVB values
- * ? "bootloader_state" : "locked" / "unlocked", // Taken from the AVB values
- * ? "vbmeta_digest": bstr, // Taken from the AVB values
- * ? "os_version" : tstr, // Same as android.os.Build.VERSION.release
- * ? "system_patch_level" : uint, // YYYYMMDD
- * ? "boot_patch_level" : uint, // YYYYMMDD
- * ? "vendor_patch_level" : uint, // YYYYMMDD
- * "version" : 1, // The CDDL schema version.
- * "security_level" : "tee" / "strongbox"
- * "att_id_state": "locked" / "open", // Attestation IDs State. If "locked", this
- * // indicates a device's attestable IDs are
- * // factory-locked and immutable. If "open",
- * // this indicates the device is still in a
- * // provisionable state and the attestable IDs
- * // are not yet frozen.
+ * "brand" : tstr,
+ * "manufacturer" : tstr,
+ * "product" : tstr,
+ * "model" : tstr,
+ * "device" : tstr,
+ * "vb_state" : "green" / "yellow" / "orange", // Taken from the AVB values
+ * "bootloader_state" : "locked" / "unlocked", // Taken from the AVB values
+ * "vbmeta_digest": bstr, // Taken from the AVB values
+ * "os_version" : tstr, // Same as android.os.Build.VERSION.release
+ * "system_patch_level" : uint, // YYYYMMDD
+ * "boot_patch_level" : uint, // YYYYMMDD
+ * "vendor_patch_level" : uint, // YYYYMMDD
+ * "version" : 2, // The CDDL schema version.
+ * "security_level" : "tee" / "strongbox",
+ * "fused": 1 / 0, // 1 if secure boot is enforced for the processor that the IRPC
+ * // implementation is contained in. 0 otherwise.
* }
*/
byte[] deviceInfo;
diff --git a/security/keymint/aidl/android/hardware/security/keymint/MacedPublicKey.aidl b/security/keymint/aidl/android/hardware/security/keymint/MacedPublicKey.aidl
index 62a48e9..ad97443 100644
--- a/security/keymint/aidl/android/hardware/security/keymint/MacedPublicKey.aidl
+++ b/security/keymint/aidl/android/hardware/security/keymint/MacedPublicKey.aidl
@@ -37,10 +37,10 @@
*
* PublicKey = { // COSE_Key
* 1 : 2, // Key type : EC2
- * 3 : -8 // Algorithm : ES256
- * -1 : 6, // Curve : P256
- * -2 : bstr // X coordinate, little-endian
- * -3 : bstr // Y coordinate, little-endian
+ * 3 : -7, // Algorithm : ES256
+ * -1 : 1, // Curve : P256
+ * -2 : bstr, // X coordinate, little-endian
+ * -3 : bstr, // Y coordinate, little-endian
* ? -70000 : nil // Presence indicates this is a test key. If set, K_mac is
* // all zeros.
* },
diff --git a/security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl b/security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl
index 24cdbc1..a14fc88 100644
--- a/security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl
+++ b/security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl
@@ -169,7 +169,6 @@
* PubKeyEd25519 = { // COSE_Key
* 1 : 1, // Key type : octet key pair
* 3 : AlgorithmEdDSA, // Algorithm : EdDSA
- * 4 : 2, // Ops: Verify
* -1 : 6, // Curve : Ed25519
* -2 : bstr // X coordinate, little-endian
* }
@@ -184,7 +183,6 @@
* PubKeyECDSA256 = { // COSE_Key
* 1 : 2, // Key type : EC2
* 3 : AlgorithmES256, // Algorithm : ECDSA w/ SHA-256
- * 4 : 2, // Ops: Verify
* -1 : 1, // Curve: P256
* -2 : bstr, // X coordinate
* -3 : bstr // Y coordinate
diff --git a/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
index 829780d..927d7d7 100644
--- a/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
+++ b/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
@@ -57,6 +57,22 @@
using namespace remote_prov;
using namespace keymaster;
+std::set<std::string> getAllowedVbStates() {
+ return {"green", "yellow", "orange"};
+}
+
+std::set<std::string> getAllowedBootloaderStates() {
+ return {"locked", "unlocked"};
+}
+
+std::set<std::string> getAllowedSecurityLevels() {
+ return {"tee", "strongbox"};
+}
+
+std::set<std::string> getAllowedAttIdStates() {
+ return {"locked", "open"};
+}
+
bytevec string_to_bytevec(const char* s) {
const uint8_t* p = reinterpret_cast<const uint8_t*>(s);
return bytevec(p, p + strlen(s));
@@ -406,6 +422,8 @@
ASSERT_TRUE(deviceInfoMap) << "Failed to parse deviceInfo: " << deviceInfoErrMsg;
ASSERT_TRUE(deviceInfoMap->asMap());
+ checkDeviceInfo(deviceInfoMap->asMap(), deviceInfo.deviceInfo);
+
auto& signingKey = bccContents->back().pubKey;
auto macKey = verifyAndParseCoseSign1(signedMac->asArray(), signingKey,
cppbor::Array() // SignedMacAad
@@ -432,6 +450,78 @@
}
}
+ void checkType(const cppbor::Map* devInfo, uint8_t majorType, std::string entryName) {
+ const auto& val = devInfo->get(entryName);
+ ASSERT_TRUE(val) << entryName << " does not exist";
+ ASSERT_EQ(val->type(), majorType) << entryName << " has the wrong type.";
+ switch (majorType) {
+ case cppbor::TSTR:
+ ASSERT_GT(val->asTstr()->value().size(), 0);
+ break;
+ case cppbor::BSTR:
+ ASSERT_GT(val->asBstr()->value().size(), 0);
+ break;
+ default:
+ break;
+ }
+ }
+
+ void checkDeviceInfo(const cppbor::Map* deviceInfo, bytevec deviceInfoBytes) {
+ const auto& version = deviceInfo->get("version");
+ ASSERT_TRUE(version);
+ ASSERT_TRUE(version->asUint());
+ RpcHardwareInfo info;
+ provisionable_->getHardwareInfo(&info);
+ ASSERT_EQ(version->asUint()->value(), info.versionNumber);
+ std::set<std::string> allowList;
+ switch (version->asUint()->value()) {
+ // These fields became mandated in version 2.
+ case 2:
+ checkType(deviceInfo, cppbor::TSTR, "brand");
+ checkType(deviceInfo, cppbor::TSTR, "manufacturer");
+ checkType(deviceInfo, cppbor::TSTR, "product");
+ checkType(deviceInfo, cppbor::TSTR, "model");
+ checkType(deviceInfo, cppbor::TSTR, "device");
+ // TODO: Refactor the KeyMint code that validates these fields and include it here.
+ checkType(deviceInfo, cppbor::TSTR, "vb_state");
+ allowList = getAllowedVbStates();
+ ASSERT_NE(allowList.find(deviceInfo->get("vb_state")->asTstr()->value()),
+ allowList.end());
+ checkType(deviceInfo, cppbor::TSTR, "bootloader_state");
+ allowList = getAllowedBootloaderStates();
+ ASSERT_NE(allowList.find(deviceInfo->get("bootloader_state")->asTstr()->value()),
+ allowList.end());
+ checkType(deviceInfo, cppbor::BSTR, "vbmeta_digest");
+ checkType(deviceInfo, cppbor::TSTR, "os_version");
+ checkType(deviceInfo, cppbor::UINT, "system_patch_level");
+ checkType(deviceInfo, cppbor::UINT, "boot_patch_level");
+ checkType(deviceInfo, cppbor::UINT, "vendor_patch_level");
+ checkType(deviceInfo, cppbor::UINT, "fused");
+ ASSERT_LT(deviceInfo->get("fused")->asUint()->value(), 2); // Must be 0 or 1.
+ checkType(deviceInfo, cppbor::TSTR, "security_level");
+ allowList = getAllowedSecurityLevels();
+ ASSERT_NE(allowList.find(deviceInfo->get("security_level")->asTstr()->value()),
+ allowList.end());
+ break;
+ case 1:
+ checkType(deviceInfo, cppbor::TSTR, "security_level");
+ allowList = getAllowedSecurityLevels();
+ ASSERT_NE(allowList.find(deviceInfo->get("security_level")->asTstr()->value()),
+ allowList.end());
+ if (version->asUint()->value() == 1) {
+ checkType(deviceInfo, cppbor::TSTR, "att_id_state");
+ allowList = getAllowedAttIdStates();
+ ASSERT_NE(allowList.find(deviceInfo->get("att_id_state")->asTstr()->value()),
+ allowList.end());
+ }
+ break;
+ default:
+ FAIL() << "Unrecognized version: " << version->asUint()->value();
+ }
+ ASSERT_EQ(deviceInfo->clone()->asMap()->canonicalize().encode(), deviceInfoBytes)
+ << "DeviceInfo ordering is non-canonical.";
+ }
+
bytevec eekId_;
size_t testEekLength_;
EekChain testEekChain_;
diff --git a/security/keymint/support/remote_prov_utils.cpp b/security/keymint/support/remote_prov_utils.cpp
index 0cbee51..35cb891 100644
--- a/security/keymint/support/remote_prov_utils.cpp
+++ b/security/keymint/support/remote_prov_utils.cpp
@@ -26,6 +26,11 @@
namespace aidl::android::hardware::security::keymint::remote_prov {
+constexpr uint32_t kBccPayloadIssuer = 1;
+constexpr uint32_t kBccPayloadSubject = 2;
+constexpr int32_t kBccPayloadSubjPubKey = -4670552;
+constexpr int32_t kBccPayloadKeyUsage = -4670553;
+
bytevec kTestMacKey(32 /* count */, 0 /* byte value */);
bytevec randomBytes(size_t numBytes) {
@@ -98,6 +103,18 @@
return prodEek;
}
+ErrMsgOr<bytevec> validatePayloadAndFetchPubKey(const cppbor::Map* payload) {
+ const auto& issuer = payload->get(kBccPayloadIssuer);
+ if (!issuer || !issuer->asTstr()) return "Issuer is not present or not a tstr.";
+ const auto& subject = payload->get(kBccPayloadSubject);
+ if (!subject || !subject->asTstr()) return "Subject is not present or not a tstr.";
+ const auto& keyUsage = payload->get(kBccPayloadKeyUsage);
+ if (!keyUsage || !keyUsage->asBstr()) return "Key usage is not present or not a bstr.";
+ const auto& serializedKey = payload->get(kBccPayloadSubjPubKey);
+ if (!serializedKey || !serializedKey->asBstr()) return "Key is not present or not a bstr.";
+ return serializedKey->asBstr()->value();
+}
+
ErrMsgOr<bytevec> verifyAndParseCoseSign1Cwt(const cppbor::Array* coseSign1,
const bytevec& signingCoseKey, const bytevec& aad) {
if (!coseSign1 || coseSign1->size() != kCoseSign1EntryCount) {
@@ -126,18 +143,16 @@
return "Unsupported signature algorithm";
}
- // TODO(jbires): Handle CWTs as the CoseSign1 payload in a less hacky way. Since the CWT payload
- // is extremely remote provisioning specific, probably just make a separate
- // function there.
auto [parsedPayload, __, payloadErrMsg] = cppbor::parse(payload);
if (!parsedPayload) return payloadErrMsg + " when parsing key";
if (!parsedPayload->asMap()) return "CWT must be a map";
- auto serializedKey = parsedPayload->asMap()->get(-4670552)->clone();
- if (!serializedKey || !serializedKey->asBstr()) return "Could not find key entry";
+ auto serializedKey = validatePayloadAndFetchPubKey(parsedPayload->asMap());
+ if (!serializedKey) {
+ return "CWT validation failed: " + serializedKey.moveMessage();
+ }
bool selfSigned = signingCoseKey.empty();
- auto key =
- CoseKey::parseEd25519(selfSigned ? serializedKey->asBstr()->value() : signingCoseKey);
+ auto key = CoseKey::parseEd25519(selfSigned ? *serializedKey : signingCoseKey);
if (!key) return "Bad signing key: " + key.moveMessage();
bytevec signatureInput =
@@ -148,7 +163,7 @@
return "Signature verification failed";
}
- return serializedKey->asBstr()->value();
+ return serializedKey.moveValue();
}
ErrMsgOr<std::vector<BccEntryData>> validateBcc(const cppbor::Array* bcc) {
@@ -156,8 +171,11 @@
std::vector<BccEntryData> result;
+ const auto& devicePubKey = bcc->get(0);
+ if (!devicePubKey->asMap()) return "Invalid device public key at the 1st entry in the BCC";
+
bytevec prevKey;
- // TODO(jbires): Actually process the pubKey at the start of the new bcc entry
+
for (size_t i = 1; i < bcc->size(); ++i) {
const cppbor::Array* entry = bcc->get(i)->asArray();
if (!entry || entry->size() != kCoseSign1EntryCount) {
@@ -177,6 +195,13 @@
// This entry's public key is the signing key for the next entry.
prevKey = payload.moveValue();
+ if (i == 1) {
+ auto [parsedRootKey, _, errMsg] = cppbor::parse(prevKey);
+ if (!parsedRootKey || !parsedRootKey->asMap()) return "Invalid payload entry in BCC.";
+ if (*parsedRootKey != *devicePubKey) {
+ return "Device public key doesn't match BCC root.";
+ }
+ }
}
return result;
diff --git a/sensors/aidl/android/hardware/sensors/SensorInfo.aidl b/sensors/aidl/android/hardware/sensors/SensorInfo.aidl
index 35caf8b..065642a 100644
--- a/sensors/aidl/android/hardware/sensors/SensorInfo.aidl
+++ b/sensors/aidl/android/hardware/sensors/SensorInfo.aidl
@@ -21,7 +21,7 @@
@VintfStability
parcelable SensorInfo {
/**
- * handle that identifies this sensors. This handle is used to reference
+ * Handle that identifies this sensors. This handle is used to reference
* this sensor throughout the HAL API.
*/
int sensorHandle;
@@ -33,25 +33,25 @@
String name;
/**
- * vendor of the hardware part
+ * Vendor of the hardware part.
*/
String vendor;
/**
- * version of the hardware part + driver. The value of this field
- * must increase when the driver is updated in a way that changes the
- * output of this sensor. This is important for fused sensors when the
- * fusion algorithm is updated.
+ * Version of the hardware part + driver, used for informational purposes.
+ * The value of this field must increase when the driver is updated in a
+ * way that changes the output of this sensor. This is important for fused
+ * sensors when the fusion algorithm is updated.
*/
int version;
/**
- * this sensor's type.
+ * This sensor's type.
*/
SensorType type;
/**
- * type of this sensor as a string.
+ * Type of this sensor as a string.
*
* When defining an OEM specific sensor or sensor manufacturer specific
* sensor, use your reserve domain name as a prefix.
@@ -63,22 +63,22 @@
String typeAsString;
/**
- * maximum range of this sensor's value in SI units
+ * Maximum range of this sensor's value in SI units
*/
float maxRange;
/**
- * smallest difference between two values reported by this sensor
+ * Smallest difference between two values reported by this sensor
*/
float resolution;
/**
- * rough estimate of this sensor's power consumption in mA
+ * Rough estimate of this sensor's power consumption in mA
*/
float power;
/**
- * this value depends on the reporting mode:
+ * This value depends on the reporting mode:
*
* continuous: minimum sample period allowed in microseconds
* on-change : 0
@@ -88,7 +88,7 @@
int minDelayUs;
/**
- * number of events reserved for this sensor in the batch mode FIFO.
+ * Number of events reserved for this sensor in the batch mode FIFO.
* If there is a dedicated FIFO for this sensor, then this is the
* size of this FIFO. If the FIFO is shared with other sensors,
* this is the size reserved for that sensor and it can be zero.
@@ -96,14 +96,14 @@
int fifoReservedEventCount;
/**
- * maximum number of events of this sensor that could be batched.
+ * Maximum number of events of this sensor that could be batched.
* This is especially relevant when the FIFO is shared between
* several sensors; this value is then set to the size of that FIFO.
*/
int fifoMaxEventCount;
/**
- * permission required to see this sensor, register to it and receive data.
+ * Permission required to see this sensor, register to it and receive data.
* Set to "" if no permission is required. Some sensor types like the
* heart rate monitor have a mandatory require_permission.
* For sensors that always require a specific permission, like the heart
diff --git a/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp b/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp
index 1bc7263..83d0dc9 100644
--- a/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp
+++ b/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp
@@ -60,6 +60,8 @@
ASSERT_STREQ(SENSOR_STRING_TYPE_##type, stringType.c_str()); \
break;
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ACCELEROMETER);
+ CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ACCELEROMETER_LIMITED_AXES);
+ CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ACCELEROMETER_LIMITED_AXES_UNCALIBRATED);
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ACCELEROMETER_UNCALIBRATED);
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ADDITIONAL_INFO);
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(AMBIENT_TEMPERATURE);
@@ -70,7 +72,10 @@
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(GLANCE_GESTURE);
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(GRAVITY);
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(GYROSCOPE);
+ CHECK_TYPE_STRING_FOR_SENSOR_TYPE(GYROSCOPE_LIMITED_AXES);
+ CHECK_TYPE_STRING_FOR_SENSOR_TYPE(GYROSCOPE_LIMITED_AXES_UNCALIBRATED);
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(GYROSCOPE_UNCALIBRATED);
+ CHECK_TYPE_STRING_FOR_SENSOR_TYPE(HEADING);
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(HEART_BEAT);
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(HEART_RATE);
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(LIGHT);
@@ -122,8 +127,11 @@
int expectedReportModeForType(SensorType type) {
switch (type) {
case SensorType::ACCELEROMETER:
+ case SensorType::ACCELEROMETER_LIMITED_AXES:
case SensorType::ACCELEROMETER_UNCALIBRATED:
+ case SensorType::ACCELEROMETER_LIMITED_AXES_UNCALIBRATED:
case SensorType::GYROSCOPE:
+ case SensorType::GYROSCOPE_LIMITED_AXES:
case SensorType::MAGNETIC_FIELD:
case SensorType::ORIENTATION:
case SensorType::PRESSURE:
@@ -133,9 +141,11 @@
case SensorType::MAGNETIC_FIELD_UNCALIBRATED:
case SensorType::GAME_ROTATION_VECTOR:
case SensorType::GYROSCOPE_UNCALIBRATED:
+ case SensorType::GYROSCOPE_LIMITED_AXES_UNCALIBRATED:
case SensorType::GEOMAGNETIC_ROTATION_VECTOR:
case SensorType::POSE_6DOF:
case SensorType::HEART_BEAT:
+ case SensorType::HEADING:
return SensorInfo::SENSOR_FLAG_BITS_CONTINUOUS_MODE;
case SensorType::LIGHT:
diff --git a/thermal/2.0/default/Android.bp b/thermal/2.0/default/Android.bp
index a63ffbc..f743ade 100644
--- a/thermal/2.0/default/Android.bp
+++ b/thermal/2.0/default/Android.bp
@@ -22,16 +22,26 @@
default_applicable_licenses: ["hardware_interfaces_license"],
}
+filegroup {
+ name: "android.hardware.thermal@2.0-service.xml",
+ srcs: ["android.hardware.thermal@2.0-service.xml"],
+}
+
+filegroup {
+ name: "android.hardware.thermal@2.0-service.rc",
+ srcs: ["android.hardware.thermal@2.0-service.rc"],
+}
+
cc_binary {
name: "android.hardware.thermal@2.0-service.mock",
defaults: ["hidl_defaults"],
relative_install_path: "hw",
vendor: true,
- init_rc: ["android.hardware.thermal@2.0-service.rc"],
- vintf_fragments: ["android.hardware.thermal@2.0-service.xml"],
+ init_rc: [":android.hardware.thermal@2.0-service.rc"],
+ vintf_fragments: [":android.hardware.thermal@2.0-service.xml"],
srcs: [
"Thermal.cpp",
- "service.cpp"
+ "service.cpp",
],
shared_libs: [
"libbase",
diff --git a/thermal/2.0/default/apex/Android.bp b/thermal/2.0/default/apex/Android.bp
new file mode 100644
index 0000000..914a3a8
--- /dev/null
+++ b/thermal/2.0/default/apex/Android.bp
@@ -0,0 +1,55 @@
+// Copyright (C) 2022 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package {
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+apex_key {
+ name: "com.android.hardware.thermal.key",
+ public_key: "com.android.hardware.thermal.avbpubkey",
+ private_key: "com.android.hardware.thermal.pem",
+}
+
+android_app_certificate {
+ name: "com.android.hardware.thermal.certificate",
+ certificate: "com.android.hardware.thermal",
+}
+
+genrule {
+ name: "com.android.hardware.thermal.rc-gen",
+ srcs: [":android.hardware.thermal@2.0-service.rc"],
+ out: ["com.android.hardware.thermal.rc"],
+ cmd: "sed -E 's/\\/vendor/\\/apex\\/com.android.hardware.thermal.mock/' $(in) > $(out)",
+}
+
+prebuilt_etc {
+ name: "com.android.hardware.thermal.rc",
+ src: ":com.android.hardware.thermal.rc-gen",
+ installable: false,
+}
+
+apex {
+ name: "com.android.hardware.thermal.mock",
+ manifest: "manifest.json",
+ file_contexts: "file_contexts",
+ key: "com.android.hardware.thermal.key",
+ certificate: ":com.android.hardware.thermal.certificate",
+ use_vndk_as_stable: true,
+ updatable: false,
+ soc_specific: true,
+ binaries: ["android.hardware.thermal@2.0-service.mock"],
+ prebuilts: ["com.android.hardware.thermal.rc"],
+ vintf_fragments: [":android.hardware.thermal@2.0-service.xml"],
+}
diff --git a/thermal/2.0/default/apex/com.android.hardware.thermal.avbpubkey b/thermal/2.0/default/apex/com.android.hardware.thermal.avbpubkey
new file mode 100644
index 0000000..8f7cf72
--- /dev/null
+++ b/thermal/2.0/default/apex/com.android.hardware.thermal.avbpubkey
Binary files differ
diff --git a/thermal/2.0/default/apex/com.android.hardware.thermal.pem b/thermal/2.0/default/apex/com.android.hardware.thermal.pem
new file mode 100644
index 0000000..4ea6e85
--- /dev/null
+++ b/thermal/2.0/default/apex/com.android.hardware.thermal.pem
@@ -0,0 +1,51 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIJKQIBAAKCAgEApXL2prEKqnU/xHlYeZB55x5EOrVAsfBuyHN5xOgUY877UuDC
+xoX+DOYAkCDSwMPmBj/Q9E70lId1PXMeI3y0obgYpdFubqRsoGNcEq2zG811tr6J
+BAE/7mAI0a4VVFWtauBNTiP5G31hsRpZNTE/dyZxs20GEVQqdvtBlEAuebCt7VIb
+fCwXnPCXSiYQ9WyjU0dwHoZPuy02qBuq3v9NYt5J6lYiPDqTWmpYBFm+SIZvth/j
+HUcaU3p+BlUad0qLhA8HYTPPBwJq2uHbTXeFrWXngt+UPCdzYubyUjG4WmgHIfee
+zSvoTjud2Gaofnd4/PcE5jFTMYUJuz0D4E+8StZArw+xegfxGcvqFZ4gfKAO1Vha
+eQBhw94P2eieUfh9metQEyKZ+A24sxG0awtAUOgcwr/WNv2TgJoN8+56DhuPXOuO
+U2qeIZuIrmE5xmyzrzJsCx+5vRQA7A3kpxRo1ZCgbJlzMgdAQaRTe2rqxyyoeFQR
+HbxUdsM7ZwDLE62UlaTTZFoJ1wzvZmsIJdkdRg97zcc3R3kYnVehCxAZ1KdAKzq6
+bhrw/kNAVA0zUHhlhHWGDnJQ/rkGfjQ9GGhS51IJYgKEoQc5M9hSgZD3idic8hso
+63r/P2Wn4S78gwLigfpzsGD7RrusTbMIRkebwpHwAYpB8qIykrtUKfunLtMCAwEA
+AQKCAgEAjiKbv0ytaw9bfwD4f0cdUu5vkzgPok55/f8mh4ERs0UoKGUrL74BKTeX
+GDr6k9w4CvpcGuaRu+A7WlVBeR8zVxN/KUUo6CidoZR6jxlmm+YA0MQTlbs1Hyal
+rO0vKcqJNx4Hi6/f3Dv0519JcCck7Mm8OHbbFZwG9zyXdDNHOggNA6rcLer7Rjpy
+3qKhQxbXoT3oFnEwog8Pu5A5VWZjJyLswULKGo//81cU0nf+vvOvmPj/9jEVbs32
+4p3OJNmHziXTIzCNFOqAvhX2fzDFSNgY8hf9k0gZGshpOS+5vwFLz2SZqo2j/0G8
+MyLOcgdVi4zzSobpf8tZNuAOKnCVwxteV3Ddl0o+qAf4cQCAXtuEkJvFWpAxrX4m
+J7nDDuvcTjKMlnchlm6XxmP27YNTKA2w5uNfrJQV5LR3IDs77PFpNiKOwERka6MU
+WE1LnjAFTCDxujT29NfIjC9z0iOY45TYut4okesaK7woe6pfK2H0ouvE6mZ+Lb7Y
+qZphPb4e4DZZZAVoELVvWflm/VC/xmBMA9vtzpjuvRXD+iYjgxbHaiG2UANLWmTd
+vADLqBadlbp10AvyrjKxHUhAiZnJgaVKRXtw5qk8YrwZOwypEHCQjY41fJuRScWF
+pD58/PYOLtSdwewzTijXSVwwPeqL1JMdJ+KWFk5zI410DtmHwoECggEBANM5dHEj
+L4ZOCcgHVG7aCLah7f/0Za7BBiPsZFD0uRIzWFTd77st3v8ulMw1JQiO3+xmpL7e
+iOP+onuSEMKgNQqeX9WCnv6pL+mjg0of2IEcGnvCpmfUZRA2x/MlyJRrQ1vHGqkV
+oBIIWgCGmIAWuFbHPmkNYx7mAJymAfzShkVtMw29oiGYyubqx9cTjD0odeyScbhZ
+LuMt72O5QeNsPREX4SsSRAL+vZbz1+8iRI8Fon89csZym3hos3DA4QSml+FNHnLe
+YFD6AfU7pdn79YhhNkn4jE0BxLaEkXhMs8RRTU2Q3o990ZxrAZGQz4zqOm5sOIQT
+JaXFXxGvOwEysrMCggEBAMiFaTzkhJSLEmLEu0T3gNEC2d3jE9kt4Olv4mQmzD00
+AzDtkrkArLQCeG3CMn55oFcJRwr8gAEk7/f2mvJSoZQnw0J0tRI+QiHJG4zwdsQC
+UszqN89X8ef0yoobwVa31ZoWxK4/NvLO4GZQ6UUd9uni10jfYVWmwEwKBU61ihvT
+ntcZIXvROR6khxzLeXtglnsznnYcdYMPJUeN+cfK9/rL3V3jk1jes8y8XwYfxkUa
+99nEe1NkRCUznzKxvkRwnKunlMCEkZ5z4nNMlqEqiOlVEYgwKwNCP+qM7ZKUJg7t
+uOL91bqWFPj2qdzyUh0uP5V/dg2odnu0xSblKWhxI2ECggEBAKbZttJ8Idlsoath
+pt+d2c4yoadTLlNZ5HjSDfgpKFxpNLhtTCbGuGVJLX8V5/gXrGi4OCER9n5rMXx9
+SEIFfYCy1C77bI7rpI5hfJ88ArESOxVSEFLqYx7otw+p5AThqibAY533GCfGcxoB
+OEvOJrVd1D31tju9IfSb6ewFfM0w0mhjSMRTRswb39pUda4F3QkQMUaXJEOOkJBs
+0dBNOvvaqiJ03kajZa3tVsBuiEuV/uOV7ak29Pqrcjt6EQW0dzsgyRGh+eFda9iE
+0qEbt7uQVusdq+5UnEg09hhaNpK4SmEgM76Te9WcbXPIOTst9xQs5oPmABIvk8aL
+bgenPaMCggEAX9EAHIzFnYVm37NKGQZ7k2RdXt2nGlwF4QYJk/nGFmjILZUYSza7
+T7jueuQU5MKRj4VrYSCOuf1AfahlGe3KL9VgRF0oOPNu/l3uwEYXOkox7qDs0jMf
+8MrUDXJ9zEZD10GR8gFa7GNWbw2yqchLuC8g2D2FcTwhHzSanKW6vNk+SWJE0bmE
+JdRQi73e6smYnn5n9eBbdqjCE5MQDBw8qqbHvJmGSyz/lZFdhrugLl1YmcJ9e7ep
+qG0mYT71wBZfhtapCeVO//w39Qhf4dtFWNnBauY5Z3E8wYNd8nDATtnhQvYwLtyQ
+YPbc7CsOecsjrvgdHSGmnC4hFxjh1HpbgQKCAQBzEr35CFQpUfGsu06SqRrxp7mb
+BfQzLmqnt+ZLu21H/YjVbamMXNjbJFSdtFLxAK/s9vFGQzEWWEYia2pRZejlCXhQ
+RO+TREJ4rm4Erfdh+zS9z8MZlxe2ybIMs260XxjZ0gEltRtJ6P14zLBlChi/rQEY
+tGrOpfjvLc1Lryaucwj7snDLtMfyqvemAUmuJNn/6IEMuG4DcdtJ3Whh7t3xKfO0
+Hc71Oh7F30okQQ6Ctiwp1T77Y1EXlRJrUtpf1sLxeItP6/r3WXLNaiFdKqGJxiCM
+Gw11oUcBA9bvfAzeJIpVVbLtGPNOp4J1XpkgFcWzsTM+ZpxWwbj4yJL6rSN2
+-----END RSA PRIVATE KEY-----
diff --git a/thermal/2.0/default/apex/com.android.hardware.thermal.pk8 b/thermal/2.0/default/apex/com.android.hardware.thermal.pk8
new file mode 100644
index 0000000..3e5bf69
--- /dev/null
+++ b/thermal/2.0/default/apex/com.android.hardware.thermal.pk8
Binary files differ
diff --git a/thermal/2.0/default/apex/com.android.hardware.thermal.x509.pem b/thermal/2.0/default/apex/com.android.hardware.thermal.x509.pem
new file mode 100644
index 0000000..048e69a
--- /dev/null
+++ b/thermal/2.0/default/apex/com.android.hardware.thermal.x509.pem
@@ -0,0 +1,34 @@
+-----BEGIN CERTIFICATE-----
+MIIF3TCCA8UCFFWeg2KJX/fyAqZPcKaFS61/a3GiMA0GCSqGSIb3DQEBCwUAMIGp
+MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91
+bnRhaW4gVmlldzEQMA4GA1UECgwHQW5kcm9pZDEQMA4GA1UECwwHQW5kcm9pZDEi
+MCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTElMCMGA1UEAwwcY29t
+LmFuZHJvaWQuaGFyZHdhcmUudGhlcm1hbDAgFw0yMTExMTcxODE3MjRaGA80NzU5
+MTAxNDE4MTcyNFowgakxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlh
+MRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRAwDgYDVQQKDAdBbmRyb2lkMRAwDgYD
+VQQLDAdBbmRyb2lkMSIwIAYJKoZIhvcNAQkBFhNhbmRyb2lkQGFuZHJvaWQuY29t
+MSUwIwYDVQQDDBxjb20uYW5kcm9pZC5oYXJkd2FyZS50aGVybWFsMIICIjANBgkq
+hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA2W8QhCKX0WoS5jhIWbWBoKulD6XhKASA
+CL0oU6Uci0U6id2m++ou/T0aHSlliS9kT1NEABNwbLeTDa9h1qg1lbajRzXbvzEz
+EvZYT+dlgYFNZ9zaVCIlMapoiN+nrM/Rs24UBjJrZu1B39+IcE5ciQz69PgrLKWF
+vFEdYzxWI246azOVr3fvdelQg+CyPgiGObVAGOHhAidvsjg4FssKnADzn+JNlTt6
+b9P65xUQErut8hz9YdLtfZ096iwe8eEpsMOQwCNdKNXVCcNjQWkOwRaU+0awHoH1
+4mArvF7yyvJxqzkNaR03BPqXAHPIAPu6xdfA19+HVIiz6bLEZ1mfCM6edXByCWZu
+K8o54OZph71r15ncv4DVd+cnBjNvBvfdlJSeGjSreFkUo5NkfAwqdmLfZx6CedHI
+sLx7X8vPYolQnR4UEvaX6yeNN0gs8Dd6ePMqOEiwWFVASD+cbpcUrp09uzlDStGV
+1DPx/9J2kw8eXPMqOSGThkLWuUMUFojyh7bNlL16oYmEeZW6/OOXCOXzAQgJ7NIs
+DA1/H2w1HMHWgSfF4y+Es2CiqcgVFOIU/07b31Edw4v56pjx1CUpRpJZjDA1JJNo
+A4YCnpA6JWTxzUTmv21fEYyY+poA3CuzvCfZ80z9h/UFW98oM9GawGvK0i2pLudS
+RaZXWeil08cCAwEAATANBgkqhkiG9w0BAQsFAAOCAgEAj2gpn/IpAHQLDlI52WwL
+IDc5uzlf1BGseLZ8M8uuMiwvN00nOjunQQZEIbhH7+03GYyMzRhTTI3nWwmX4Fnq
+vC5sR68yNlu9gOAMXaAHo/Rw73ak7sv8xGbb2FeQsHaMKDQ2nqxP17SWdQ0xWa1u
+5qNurPOdAPOw77noZcT7yYX7lcrOKxPIekPJxyeOlp4bQSmabSRgYr70B7GybPlv
+K1gkgCBxl5RiVjVxLo+7ESHSAaGLy0S7F2v6PJ9oj15TovWQ0py2iBKZ6HReB7s/
+umnQqkwXDLudlNmoXIsgIYn8vKFTYpy1GSNJqhRSLfvLR6NtuU0iCTvg/X7oPmS1
+dWUdjVeO7ZVvIpO3gLLEe4maBEYF2sOlt3bRmzIHydORJtkfTt5tiZ4wR9RfJbkj
+iBiDbNiX010bZPTAXmgMbuJzQXZEXCBy0qKeS1cHwf9M8FDoiLajXepfZIp+6syt
+D4lZk4eAV141JL5PfABfdZWwT3cTgFIqCYpqrMQJIu+GHEjUwD2yNPi0I1/ydFCW
+CPDnzWjYCi6yVB8hss3ZFbvhfyJzdm3LivNVbLGK0+TG0EOAz6d2aQ0UjESgMD1A
+U8hLzQt7MiFSG0bt2cVx6SgCHeYUqMntbFELEAURWrhAfPLMJtAvFgKbEiZEAkkW
+pdDVh603aIp4LjVCfTYp/mQ=
+-----END CERTIFICATE-----
diff --git a/thermal/2.0/default/apex/file_contexts b/thermal/2.0/default/apex/file_contexts
new file mode 100644
index 0000000..e0d87c7
--- /dev/null
+++ b/thermal/2.0/default/apex/file_contexts
@@ -0,0 +1,5 @@
+(/.*)? u:object_r:vendor_file:s0
+# Permission XMLs
+/etc/permissions(/.*)? u:object_r:vendor_configs_file:s0
+# binary
+/bin/hw/android\.hardware\.thermal@2\.0-service\.mock u:object_r:hal_thermal_default_exec:s0
diff --git a/thermal/2.0/default/apex/manifest.json b/thermal/2.0/default/apex/manifest.json
new file mode 100644
index 0000000..ee44dc1
--- /dev/null
+++ b/thermal/2.0/default/apex/manifest.json
@@ -0,0 +1,4 @@
+{
+ "name": "com.android.hardware.thermal.mock",
+ "version": 1
+}
diff --git a/tv/tuner/aidl/Android.bp b/tv/tuner/aidl/Android.bp
index c33572d..63f91ac 100644
--- a/tv/tuner/aidl/Android.bp
+++ b/tv/tuner/aidl/Android.bp
@@ -19,7 +19,6 @@
backend: {
java: {
sdk_version: "module_current",
- srcs_available: true,
},
cpp: {
enabled: false,
diff --git a/tv/tuner/aidl/default/Frontend.cpp b/tv/tuner/aidl/default/Frontend.cpp
index 056d014..3f7797c 100644
--- a/tv/tuner/aidl/default/Frontend.cpp
+++ b/tv/tuner/aidl/default/Frontend.cpp
@@ -393,6 +393,13 @@
{
FrontendScanMessage msg;
+ msg.set<FrontendScanMessage::Tag::isLocked>(false);
+ mCallback->onScanMessage(FrontendScanMessageType::LOCKED, msg);
+ mIsLocked = false;
+ }
+
+ {
+ FrontendScanMessage msg;
msg.set<FrontendScanMessage::Tag::isLocked>(true);
mCallback->onScanMessage(FrontendScanMessageType::LOCKED, msg);
mIsLocked = true;
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
similarity index 82%
copy from uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl
copy to uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
index 0d53431..bc73b89 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
@@ -33,14 +33,14 @@
package android.hardware.uwb.fira_android;
@Backing(type="int") @VintfStability
-enum UwbVendorSessionSetAppConfigCmdParams {
- CCC_HOP_MODE_KEY = 160,
- CCC_UWB_TIME0 = 161,
- CCC_RANGING_PROTOCOL_VER = 163,
- CCC_UWB_CONFIG_ID = 164,
- CCC_PULSESHAPE_COMBO = 165,
- CCC_URSK_TTL = 166,
- NB_OF_RANGE_MEASUREMENTS = 227,
- NB_OF_AZIMUTH_MEASUREMENTS = 228,
- NB_OF_ELEVATION_MEASUREMENTS = 229,
+enum UwbVendorCapabilityTlvTypes {
+ CCC_SUPPORTED_VERSIONS = 160,
+ CCC_SUPPORTED_UWB_CONFIGS = 161,
+ CCC_SUPPORTED_PULSE_SHAPE_COMBOS = 162,
+ CCC_SUPPORTED_RAN_MULTIPLIER = 163,
+ CCC_SUPPORTED_CHAPS_PER_SLOT = 164,
+ CCC_SUPPORTED_SYNC_CODES = 165,
+ CCC_SUPPORTED_CHANNELS = 166,
+ CCC_SUPPORTED_HOPPING_SEQUENCES = 167,
+ CCC_SUPPORTED_HOPPING_CONFIG_MODES = 168,
}
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
similarity index 75%
copy from uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl
copy to uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
index 0d53431..ee47a13 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
@@ -32,15 +32,23 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.uwb.fira_android;
-@Backing(type="int") @VintfStability
-enum UwbVendorSessionSetAppConfigCmdParams {
- CCC_HOP_MODE_KEY = 160,
- CCC_UWB_TIME0 = 161,
- CCC_RANGING_PROTOCOL_VER = 163,
- CCC_UWB_CONFIG_ID = 164,
- CCC_PULSESHAPE_COMBO = 165,
- CCC_URSK_TTL = 166,
- NB_OF_RANGE_MEASUREMENTS = 227,
- NB_OF_AZIMUTH_MEASUREMENTS = 228,
- NB_OF_ELEVATION_MEASUREMENTS = 229,
+@Backing(type="long") @VintfStability
+enum UwbVendorCapabilityTlvValues {
+ UWB_CONFIG_0 = 0,
+ UWB_CONFIG_1 = 1,
+ PULSE_SHAPE_SYMMETRICAL_ROOT_RAISED_COSINE = 1,
+ PULSE_SHAPE_PRECURSOR_FREE = 2,
+ PULSE_SHAPE_PRECURSOR_FREE_SPECIAL = 3,
+ CHAPS_PER_SLOT_3 = 3,
+ CHAPS_PER_SLOT_4 = 4,
+ CHAPS_PER_SLOT_6 = 6,
+ CHAPS_PER_SLOT_8 = 8,
+ CHAPS_PER_SLOT_9 = 9,
+ CHAPS_PER_SLOT_12 = 12,
+ CHAPS_PER_SLOT_24 = 24,
+ HOPPING_SEQUENCE_DEFAULT = 0,
+ HOPPING_SEQUENCE_AES = 1,
+ HOPPING_CONFIG_MODE_NONE = 0,
+ HOPPING_CONFIG_MODE_CONTINUOUS = 1,
+ HOPPING_CONFIG_MODE_ADAPTIVE = 2,
}
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl
similarity index 97%
rename from uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl
rename to uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl
index 0d53431..d35728f 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl
@@ -33,7 +33,7 @@
package android.hardware.uwb.fira_android;
@Backing(type="int") @VintfStability
-enum UwbVendorSessionSetAppConfigCmdParams {
+enum UwbVendorSessionAppConfigTlvTypes {
CCC_HOP_MODE_KEY = 160,
CCC_UWB_TIME0 = 161,
CCC_RANGING_PROTOCOL_VER = 163,
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
new file mode 100644
index 0000000..968cd17
--- /dev/null
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
@@ -0,0 +1,94 @@
+/*
+ * 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.uwb.fira_android;
+
+/**
+ * Android specific capability TLV types in UCI command:
+ * GID: 0000b (UWB Core Group)
+ * OID: 000011b (CORE_GET_CAPS_INFO_CMD)
+ *
+ * For FIRA params, please refer to params mentioned in CR 287.
+ *
+ * Values expected for each type are mentioned in the docs below and the constants
+ * used are defined in UwbVendorCapabilityTlvValues enum.
+ */
+@VintfStability
+@Backing(type="int")
+enum UwbVendorCapabilityTlvTypes {
+ /*********************************************
+ * CCC specific
+ ********************************************/
+
+ /**
+ * 2 byte tuple {major_version (1 byte), minor_version (1 byte)} array with list of supported
+ * CCC versions
+ */
+ CCC_SUPPORTED_VERSIONS = 0xA0,
+ /**
+ * byte array with a list of supported UWB configs
+ * Values:
+ * UWB_CONFIG_0 = 0
+ * UWB_CONFIG_1 = 1
+ */
+ CCC_SUPPORTED_UWB_CONFIGS = 0xA1,
+ /**
+ * 1 byte tuple {initiator_tx (4 bits), responder_tx (4 bits)} array with list of supported
+ * pulse shape combos
+ * Values:
+ * PULSE_SHAPE_SYMMETRICAL_ROOT_RAISED_COSINE = 1
+ * PULSE_SHAPE_PRECURSOR_FREE = 2
+ * PULSE_SHAPE_PRECURSOR_FREE_SPECIAL = 3
+ */
+ /** */
+ CCC_SUPPORTED_PULSE_SHAPE_COMBOS = 0xA2,
+ /** Int value for indicating supported ran multiplier */
+ CCC_SUPPORTED_RAN_MULTIPLIER = 0xA3,
+ /**
+ * byte array with a list of supported chaps per slot
+ * Values:
+ * CHAPS_PER_SLOT_3 = 3
+ * CHAPS_PER_SLOT_4 = 4
+ * CHAPS_PER_SLOT_6 = 6
+ * CHAPS_PER_SLOT_8 = 8
+ * CHAPS_PER_SLOT_9 = 9
+ * CHAPS_PER_SLOT_12 = 12
+ * CHAPS_PER_SLOT_24 = 24
+ */
+ CCC_SUPPORTED_CHAPS_PER_SLOT = 0xA4,
+ /**
+ * byte array with a list of supported sync codes
+ * Values: 1 - 32
+ */
+ CCC_SUPPORTED_SYNC_CODES = 0xA5,
+ /** byte array with list of supported channels */
+ CCC_SUPPORTED_CHANNELS = 0xA6,
+ /**
+ * byte array with a list of supported hopping sequences
+ * Values:
+ HOPPING_SEQUENCE_DEFAULT = 0
+ HOPPING_SEQUENCE_AES = 1
+ */
+ CCC_SUPPORTED_HOPPING_SEQUENCES = 0xA7,
+ /**
+ * byte array with a list of supported hopping config modes
+ * Values:
+ * HOPPING_CONFIG_MODE_NONE = 0
+ * HOPPING_CONFIG_MODE_CONTINUOUS = 1
+ * HOPPING_CONFIG_MODE_ADAPTIVE = 2
+ */
+ CCC_SUPPORTED_HOPPING_CONFIG_MODES = 0xA8,
+}
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
new file mode 100644
index 0000000..380089f
--- /dev/null
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
@@ -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.
+ */
+
+package android.hardware.uwb.fira_android;
+
+/**
+ * Android specific capability TLV values expected in UCI command:
+ * GID: 0000b (UWB Core Group),
+ * OID: 000011b (CORE_GET_CAPS_INFO_CMD),
+ */
+@VintfStability
+@Backing(type="long")
+enum UwbVendorCapabilityTlvValues {
+ /*********************************************
+ * CCC specific
+ ********************************************/
+ UWB_CONFIG_0 = 0,
+ UWB_CONFIG_1 = 1,
+
+ PULSE_SHAPE_SYMMETRICAL_ROOT_RAISED_COSINE = 1,
+ PULSE_SHAPE_PRECURSOR_FREE = 2,
+ PULSE_SHAPE_PRECURSOR_FREE_SPECIAL = 3,
+
+ CHAPS_PER_SLOT_3 = 3,
+ CHAPS_PER_SLOT_4 = 4,
+ CHAPS_PER_SLOT_6 = 6,
+ CHAPS_PER_SLOT_8 = 8,
+ CHAPS_PER_SLOT_9 = 9,
+ CHAPS_PER_SLOT_12 = 12,
+ CHAPS_PER_SLOT_24 = 24,
+
+ HOPPING_SEQUENCE_DEFAULT = 0,
+ HOPPING_SEQUENCE_AES = 1,
+
+ HOPPING_CONFIG_MODE_NONE = 0,
+ HOPPING_CONFIG_MODE_CONTINUOUS = 1,
+ HOPPING_CONFIG_MODE_ADAPTIVE = 2,
+}
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl
similarity index 92%
rename from uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl
rename to uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl
index eb1f5ac..b770ee0 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl
@@ -17,16 +17,17 @@
package android.hardware.uwb.fira_android;
/**
- * Android specific vendor app params set in UCI command:
+ * Android specific vendor app params set/expected in UCI command:
* GID: 0001b (UWB Session config Group)
* OID: 000011b (SESSION_SET_APP_CONFIG_CMD)
+ * OID: 000100b (SESSION_GET_APP_CONFIG_CMD)
*
* Note: Refer to Table 34 of the UCI specification for the other params
* expected in this command.
*/
@VintfStability
@Backing(type="int")
-enum UwbVendorSessionSetAppConfigCmdParams {
+enum UwbVendorSessionAppConfigTlvTypes {
/** CCC params for ranging start */
/**
diff --git a/wifi/1.6/IWifiChip.hal b/wifi/1.6/IWifiChip.hal
index eaa2400..555ec91 100644
--- a/wifi/1.6/IWifiChip.hal
+++ b/wifi/1.6/IWifiChip.hal
@@ -99,4 +99,35 @@
getUsableChannels_1_6(WifiBand band, bitfield<WifiIfaceMode> ifaceModeMask,
bitfield<UsableChannelFilter> filterMask)
generates (WifiStatus status, vec<WifiUsableChannel> channels);
+
+ /**
+ * Retrieve the list of all the possible radio combinations supported by this
+ * chip.
+ *
+ * @return status WifiStatus of the operation.
+ * Possible status codes:
+ * |WifiStatusCode.SUCCESS|,
+ * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
+ * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
+ * |WifiStatusCode.FAILURE_UNKNOWN|
+ * @return radioCombinationMatrix
+ * A list of all the possible radio combinations represented by
+ * |WifiRadioCombinationMatrix|.
+ * For Example in case of a chip which has two radios, where one radio is
+ * capable of 2.4GHz 2X2 only and another radio which is capable of either
+ * 5GHz or 6GHz 2X2, number of possible radio combinations in this case
+ * are 5 and possible combinations are
+ * {{{2G 2X2}}, //Standalone 2G
+ * {{5G 2X2}}, //Standalone 5G
+ * {{6G 2X2}}, //Standalone 6G
+ * {{2G 2X2}, {5G 2X2}}, //2G+5G DBS
+ * {{2G 2X2}, {6G 2X2}}} //2G+6G DBS
+ * Note: Since this chip doesn’t support 5G+6G simultaneous operation
+ * as there is only one radio which can support both bands, So it can only
+ * do MCC 5G+6G. This table should not get populated with possible MCC
+ * configurations. This is only for simultaneous radio configurations
+ * (such as standalone, multi band simultaneous or single band simultaneous).
+ */
+ getSupportedRadioCombinationsMatrix()
+ generates (WifiStatus status, WifiRadioCombinationMatrix radioCombinationMatrix);
};
diff --git a/wifi/1.6/default/hidl_callback_util.h b/wifi/1.6/default/hidl_callback_util.h
index 3ac54c1..aab0ae5 100644
--- a/wifi/1.6/default/hidl_callback_util.h
+++ b/wifi/1.6/default/hidl_callback_util.h
@@ -20,6 +20,7 @@
#include <set>
#include <hidl/HidlSupport.h>
+#include <hidl/HidlTransportSupport.h>
namespace {
// Type of callback invoked by the death handler.
@@ -68,9 +69,11 @@
// (callback proxy's raw pointer) to track the death of individual
// clients.
uint64_t cookie = reinterpret_cast<uint64_t>(cb.get());
- if (cb_set_.find(cb) != cb_set_.end()) {
- LOG(WARNING) << "Duplicate death notification registration";
- return true;
+ for (const auto& s : cb_set_) {
+ if (interfacesEqual(cb, s)) {
+ LOG(ERROR) << "Duplicate death notification registration";
+ return true;
+ }
}
if (!cb->linkToDeath(death_handler_, cookie)) {
LOG(ERROR) << "Failed to register death notification";
diff --git a/wifi/1.6/default/hidl_struct_util.cpp b/wifi/1.6/default/hidl_struct_util.cpp
index 71f98b9..45459e2 100644
--- a/wifi/1.6/default/hidl_struct_util.cpp
+++ b/wifi/1.6/default/hidl_struct_util.cpp
@@ -367,6 +367,21 @@
}
}
+V1_5::WifiBand convertLegacyMacBandToHidlWifiBand(uint32_t band) {
+ switch (band) {
+ case legacy_hal::WLAN_MAC_2_4_BAND:
+ return V1_5::WifiBand::BAND_24GHZ;
+ case legacy_hal::WLAN_MAC_5_0_BAND:
+ return V1_5::WifiBand::BAND_5GHZ;
+ case legacy_hal::WLAN_MAC_6_0_BAND:
+ return V1_5::WifiBand::BAND_6GHZ;
+ case legacy_hal::WLAN_MAC_60_0_BAND:
+ return V1_5::WifiBand::BAND_60GHZ;
+ default:
+ return V1_5::WifiBand::BAND_UNSPECIFIED;
+ }
+}
+
uint32_t convertHidlWifiIfaceModeToLegacy(uint32_t hidl_iface_mask) {
uint32_t legacy_iface_mask = 0;
if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_STA) {
@@ -2905,6 +2920,85 @@
return true;
}
+V1_6::WifiAntennaMode convertLegacyAntennaConfigurationToHidl(uint32_t antenna_cfg) {
+ switch (antenna_cfg) {
+ case legacy_hal::WIFI_ANTENNA_1X1:
+ return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_1X1;
+ case legacy_hal::WIFI_ANTENNA_2X2:
+ return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_2X2;
+ case legacy_hal::WIFI_ANTENNA_3X3:
+ return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_3X3;
+ case legacy_hal::WIFI_ANTENNA_4X4:
+ return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_4X4;
+ default:
+ return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_UNSPECIFIED;
+ }
+}
+
+bool convertLegacyWifiRadioConfigurationToHidl(
+ legacy_hal::wifi_radio_configuration* radio_configuration,
+ V1_6::WifiRadioConfiguration* hidl_radio_configuration) {
+ if (!hidl_radio_configuration) {
+ return false;
+ }
+ *hidl_radio_configuration = {};
+ hidl_radio_configuration->bandInfo =
+ hidl_struct_util::convertLegacyMacBandToHidlWifiBand(radio_configuration->band);
+ if (hidl_radio_configuration->bandInfo == V1_5::WifiBand::BAND_UNSPECIFIED) {
+ LOG(ERROR) << "Unspecified band";
+ return false;
+ }
+ hidl_radio_configuration->antennaMode =
+ hidl_struct_util::convertLegacyAntennaConfigurationToHidl(
+ radio_configuration->antenna_cfg);
+ return true;
+}
+
+bool convertLegacyRadioCombinationsMatrixToHidl(
+ legacy_hal::wifi_radio_combination_matrix* legacy_matrix,
+ WifiRadioCombinationMatrix* hidl_matrix) {
+ if (!hidl_matrix || !legacy_matrix) {
+ return false;
+ }
+ *hidl_matrix = {};
+
+ int num_combinations = legacy_matrix->num_radio_combinations;
+ std::vector<V1_6::WifiRadioCombination> radio_combinations_vec;
+ if (!num_combinations) {
+ LOG(ERROR) << "zero radio combinations";
+ return false;
+ }
+ wifi_radio_combination* l_radio_combinations_ptr = legacy_matrix->radio_combinations;
+ for (int i = 0; i < num_combinations; i++) {
+ int num_configurations = l_radio_combinations_ptr->num_radio_configurations;
+ WifiRadioCombination radioCombination;
+ std::vector<V1_6::WifiRadioConfiguration> radio_configurations_vec;
+ if (!num_configurations) {
+ LOG(ERROR) << "zero radio configurations";
+ return false;
+ }
+ for (int j = 0; j < num_configurations; j++) {
+ WifiRadioConfiguration radioConfiguration;
+ wifi_radio_configuration* l_radio_configurations_ptr =
+ &l_radio_combinations_ptr->radio_configurations[j];
+ if (!hidl_struct_util::convertLegacyWifiRadioConfigurationToHidl(
+ l_radio_configurations_ptr, &radioConfiguration)) {
+ LOG(ERROR) << "Error converting wifi radio configuration";
+ return false;
+ }
+ radio_configurations_vec.push_back(radioConfiguration);
+ }
+ radioCombination.radioConfigurations = radio_configurations_vec;
+ radio_combinations_vec.push_back(radioCombination);
+ l_radio_combinations_ptr =
+ (wifi_radio_combination*)((u8*)l_radio_combinations_ptr +
+ sizeof(wifi_radio_combination) +
+ (sizeof(wifi_radio_configuration) * num_configurations));
+ }
+ hidl_matrix->radioCombinations = radio_combinations_vec;
+ return true;
+}
+
} // namespace hidl_struct_util
} // namespace implementation
} // namespace V1_6
diff --git a/wifi/1.6/default/hidl_struct_util.h b/wifi/1.6/default/hidl_struct_util.h
index 26a6ebc..2d4a5f1 100644
--- a/wifi/1.6/default/hidl_struct_util.h
+++ b/wifi/1.6/default/hidl_struct_util.h
@@ -74,6 +74,11 @@
bool convertHidlVectorOfCoexUnsafeChannelToLegacy(
const std::vector<V1_5::IWifiChip::CoexUnsafeChannel>& hidl_unsafe_channels,
std::vector<legacy_hal::wifi_coex_unsafe_channel>* legacy_unsafe_channels);
+bool convertLegacyRadioCombinationsMatrixToHidl(
+ legacy_hal::wifi_radio_combination_matrix* legacy_matrix,
+ V1_6::WifiRadioCombinationMatrix* hidl_matrix);
+V1_5::WifiBand convertLegacyMacBandToHidlWifiBand(uint32_t band);
+V1_6::WifiAntennaMode convertLegacyAntennaConfigurationToHidl(uint32_t antenna_cfg);
// STA iface conversion methods.
bool convertLegacyFeaturesToHidlStaCapabilities(uint64_t legacy_feature_set,
diff --git a/wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp b/wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp
index 077c6cc..0dd0aa1 100644
--- a/wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp
+++ b/wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp
@@ -377,6 +377,108 @@
HidlChipCaps::SET_LATENCY_MODE | HidlChipCaps::DEBUG_MEMORY_DRIVER_DUMP,
hidle_caps);
}
+
+void insertRadioCombination(legacy_hal::wifi_radio_combination* dst_radio_combination_ptr,
+ int num_radio_configurations,
+ legacy_hal::wifi_radio_configuration* radio_configuration) {
+ dst_radio_combination_ptr->num_radio_configurations = num_radio_configurations;
+ memcpy(dst_radio_combination_ptr->radio_configurations, radio_configuration,
+ num_radio_configurations * sizeof(legacy_hal::wifi_radio_configuration));
+}
+
+void verifyRadioCombination(WifiRadioCombination* radioCombination, size_t num_radio_configurations,
+ legacy_hal::wifi_radio_configuration* radio_configuration) {
+ EXPECT_EQ(num_radio_configurations, radioCombination->radioConfigurations.size());
+ for (size_t i = 0; i < num_radio_configurations; i++) {
+ EXPECT_EQ(hidl_struct_util::convertLegacyMacBandToHidlWifiBand(radio_configuration->band),
+ radioCombination->radioConfigurations[i].bandInfo);
+ EXPECT_EQ(hidl_struct_util::convertLegacyAntennaConfigurationToHidl(
+ radio_configuration->antenna_cfg),
+ radioCombination->radioConfigurations[i].antennaMode);
+ radio_configuration++;
+ }
+}
+
+TEST_F(HidlStructUtilTest, canConvertLegacyRadioCombinationsMatrixToHidl) {
+ legacy_hal::wifi_radio_configuration radio_configurations_array1[] = {
+ {.band = legacy_hal::WLAN_MAC_2_4_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_1X1},
+ };
+ legacy_hal::wifi_radio_configuration radio_configurations_array2[] = {
+ {.band = legacy_hal::WLAN_MAC_2_4_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_2X2},
+ {.band = legacy_hal::WLAN_MAC_5_0_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_3X3},
+ };
+ legacy_hal::wifi_radio_configuration radio_configurations_array3[] = {
+ {.band = legacy_hal::WLAN_MAC_2_4_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_2X2},
+ {.band = legacy_hal::WLAN_MAC_6_0_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_1X1},
+ {.band = legacy_hal::WLAN_MAC_5_0_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_4X4},
+ };
+
+ int num_radio_configs = 0;
+ int num_combinations = 0;
+ std::array<char, 256> buffer;
+ buffer.fill(0);
+ legacy_hal::wifi_radio_combination_matrix* legacy_matrix =
+ reinterpret_cast<wifi_radio_combination_matrix*>(buffer.data());
+ legacy_hal::wifi_radio_combination* radio_combinations;
+
+ // Prepare a legacy wifi_radio_combination_matrix
+ legacy_matrix->num_radio_combinations = 3;
+ // Insert first combination
+ radio_combinations =
+ (legacy_hal::wifi_radio_combination*)((char*)legacy_matrix->radio_combinations);
+ insertRadioCombination(
+ radio_combinations,
+ sizeof(radio_configurations_array1) / sizeof(radio_configurations_array1[0]),
+ radio_configurations_array1);
+ num_combinations++;
+ num_radio_configs +=
+ sizeof(radio_configurations_array1) / sizeof(radio_configurations_array1[0]);
+
+ // Insert second combination
+ radio_combinations =
+ (legacy_hal::wifi_radio_combination*)((char*)legacy_matrix->radio_combinations +
+ (num_combinations *
+ sizeof(legacy_hal::wifi_radio_combination)) +
+ (num_radio_configs *
+ sizeof(wifi_radio_configuration)));
+ insertRadioCombination(
+ radio_combinations,
+ sizeof(radio_configurations_array2) / sizeof(radio_configurations_array2[0]),
+ radio_configurations_array2);
+ num_combinations++;
+ num_radio_configs +=
+ sizeof(radio_configurations_array2) / sizeof(radio_configurations_array2[0]);
+
+ // Insert third combination
+ radio_combinations =
+ (legacy_hal::wifi_radio_combination*)((char*)legacy_matrix->radio_combinations +
+ (num_combinations *
+ sizeof(legacy_hal::wifi_radio_combination)) +
+ (num_radio_configs *
+ sizeof(wifi_radio_configuration)));
+ insertRadioCombination(
+ radio_combinations,
+ sizeof(radio_configurations_array3) / sizeof(radio_configurations_array3[0]),
+ radio_configurations_array3);
+
+ V1_6::WifiRadioCombinationMatrix converted_matrix{};
+ hidl_struct_util::convertLegacyRadioCombinationsMatrixToHidl(legacy_matrix, &converted_matrix);
+
+ // Verify the conversion
+ EXPECT_EQ(legacy_matrix->num_radio_combinations, converted_matrix.radioCombinations.size());
+ verifyRadioCombination(
+ &converted_matrix.radioCombinations[0],
+ sizeof(radio_configurations_array1) / sizeof(radio_configurations_array1[0]),
+ radio_configurations_array1);
+ verifyRadioCombination(
+ &converted_matrix.radioCombinations[1],
+ sizeof(radio_configurations_array2) / sizeof(radio_configurations_array2[0]),
+ radio_configurations_array2);
+ verifyRadioCombination(
+ &converted_matrix.radioCombinations[2],
+ sizeof(radio_configurations_array3) / sizeof(radio_configurations_array3[0]),
+ radio_configurations_array3);
+}
} // namespace implementation
} // namespace V1_6
} // namespace wifi
diff --git a/wifi/1.6/default/wifi_chip.cpp b/wifi/1.6/default/wifi_chip.cpp
index a185724..4fff770 100644
--- a/wifi/1.6/default/wifi_chip.cpp
+++ b/wifi/1.6/default/wifi_chip.cpp
@@ -722,6 +722,12 @@
filterMask);
}
+Return<void> WifiChip::getSupportedRadioCombinationsMatrix(
+ getSupportedRadioCombinationsMatrix_cb hidl_status_cb) {
+ return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
+ &WifiChip::getSupportedRadioCombinationsMatrixInternal, hidl_status_cb);
+}
+
void WifiChip::invalidateAndRemoveAllIfaces() {
invalidateAndClearBridgedApAll();
invalidateAndClearAll(ap_ifaces_);
@@ -1461,6 +1467,28 @@
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_usable_channels};
}
+std::pair<WifiStatus, V1_6::WifiRadioCombinationMatrix>
+WifiChip::getSupportedRadioCombinationsMatrixInternal() {
+ legacy_hal::wifi_error legacy_status;
+ legacy_hal::wifi_radio_combination_matrix* legacy_matrix;
+
+ std::tie(legacy_status, legacy_matrix) =
+ legacy_hal_.lock()->getSupportedRadioCombinationsMatrix();
+ if (legacy_status != legacy_hal::WIFI_SUCCESS) {
+ LOG(ERROR) << "Failed to get SupportedRadioCombinations matrix from legacy HAL: "
+ << legacyErrorToString(legacy_status);
+ return {createWifiStatusFromLegacyError(legacy_status), {}};
+ }
+
+ V1_6::WifiRadioCombinationMatrix hidl_matrix;
+ if (!hidl_struct_util::convertLegacyRadioCombinationsMatrixToHidl(legacy_matrix,
+ &hidl_matrix)) {
+ LOG(ERROR) << "Failed convertLegacyRadioCombinationsMatrixToHidl() ";
+ return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), {}};
+ }
+ return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_matrix};
+}
+
WifiStatus WifiChip::handleChipConfiguration(
/* NONNULL */ std::unique_lock<std::recursive_mutex>* lock, ChipModeId mode_id) {
// If the chip is already configured in a different mode, stop
diff --git a/wifi/1.6/default/wifi_chip.h b/wifi/1.6/default/wifi_chip.h
index 61ac03d..13d62fb 100644
--- a/wifi/1.6/default/wifi_chip.h
+++ b/wifi/1.6/default/wifi_chip.h
@@ -160,6 +160,8 @@
hidl_bitfield<V1_5::WifiIfaceMode> ifaceModeMask,
hidl_bitfield<UsableChannelFilter> filterMask,
getUsableChannels_1_6_cb _hidl_cb) override;
+ Return<void> getSupportedRadioCombinationsMatrix(
+ getSupportedRadioCombinationsMatrix_cb hidl_status_cb) override;
private:
void invalidateAndRemoveAllIfaces();
@@ -267,6 +269,7 @@
const sp<IWifiIface>& bound_iface);
std::pair<WifiStatus, std::vector<V1_6::WifiUsableChannel>> getUsableChannelsInternal_1_6(
WifiBand band, uint32_t ifaceModeMask, uint32_t filterMask);
+ std::pair<WifiStatus, WifiRadioCombinationMatrix> getSupportedRadioCombinationsMatrixInternal();
ChipId chip_id_;
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
diff --git a/wifi/1.6/default/wifi_legacy_hal.cpp b/wifi/1.6/default/wifi_legacy_hal.cpp
index 64dde95..8a75fd8 100644
--- a/wifi/1.6/default/wifi_legacy_hal.cpp
+++ b/wifi/1.6/default/wifi_legacy_hal.cpp
@@ -37,6 +37,7 @@
static constexpr uint32_t kMaxWakeReasonStatsArraySize = 32;
static constexpr uint32_t kMaxRingBuffers = 10;
static constexpr uint32_t kMaxWifiUsableChannels = 256;
+static constexpr uint32_t kMaxSupportedRadioCombinationsMatrixLength = 256;
// need a long timeout (1000ms) for chips that unload their driver.
static constexpr uint32_t kMaxStopCompleteWaitMs = 1000;
static constexpr char kDriverPropName[] = "wlan.driver.status";
@@ -356,6 +357,15 @@
}
}
+// Callback to report current CHRE NAN state
+std::function<void(chre_nan_rtt_state)> on_chre_nan_rtt_internal_callback;
+void onAsyncChreNanRttState(chre_nan_rtt_state state) {
+ const auto lock = hidl_sync_util::acquireGlobalLock();
+ if (on_chre_nan_rtt_internal_callback) {
+ on_chre_nan_rtt_internal_callback(state);
+ }
+}
+
// End of the free-standing "C" style callbacks.
WifiLegacyHal::WifiLegacyHal(const std::weak_ptr<wifi_system::InterfaceTool> iface_tool,
@@ -1537,6 +1547,43 @@
return global_func_table_.wifi_set_indoor_state(global_handle_, isIndoor);
}
+std::pair<wifi_error, wifi_radio_combination_matrix*>
+WifiLegacyHal::getSupportedRadioCombinationsMatrix() {
+ std::array<char, kMaxSupportedRadioCombinationsMatrixLength> buffer;
+ buffer.fill(0);
+ uint32_t size = 0;
+ wifi_radio_combination_matrix* radio_combination_matrix_ptr =
+ reinterpret_cast<wifi_radio_combination_matrix*>(buffer.data());
+ wifi_error status = global_func_table_.wifi_get_supported_radio_combinations_matrix(
+ global_handle_, buffer.size(), &size, radio_combination_matrix_ptr);
+ CHECK(size >= 0 && size <= kMaxSupportedRadioCombinationsMatrixLength);
+ return {status, radio_combination_matrix_ptr};
+}
+
+wifi_error WifiLegacyHal::chreNanRttRequest(const std::string& iface_name, bool enable) {
+ if (enable)
+ return global_func_table_.wifi_nan_rtt_chre_enable_request(0, getIfaceHandle(iface_name),
+ NULL);
+ else
+ return global_func_table_.wifi_nan_rtt_chre_disable_request(0, getIfaceHandle(iface_name));
+}
+
+wifi_error WifiLegacyHal::chreRegisterHandler(const std::string& iface_name,
+ const ChreCallbackHandlers& handler) {
+ if (on_chre_nan_rtt_internal_callback) {
+ return WIFI_ERROR_NOT_AVAILABLE;
+ }
+
+ on_chre_nan_rtt_internal_callback = handler.on_wifi_chre_nan_rtt_state;
+
+ wifi_error status = global_func_table_.wifi_chre_register_handler(getIfaceHandle(iface_name),
+ {onAsyncChreNanRttState});
+ if (status != WIFI_SUCCESS) {
+ on_chre_nan_rtt_internal_callback = nullptr;
+ }
+ return status;
+}
+
void WifiLegacyHal::invalidate() {
global_handle_ = nullptr;
iface_name_to_handle_.clear();
@@ -1572,6 +1619,7 @@
on_twt_event_teardown_completion_callback = nullptr;
on_twt_event_info_frame_received_callback = nullptr;
on_twt_event_device_notify_callback = nullptr;
+ on_chre_nan_rtt_internal_callback = nullptr;
}
} // namespace legacy_hal
diff --git a/wifi/1.6/default/wifi_legacy_hal.h b/wifi/1.6/default/wifi_legacy_hal.h
index 1d85d2e..ab21e8e 100644
--- a/wifi/1.6/default/wifi_legacy_hal.h
+++ b/wifi/1.6/default/wifi_legacy_hal.h
@@ -36,6 +36,7 @@
namespace legacy_hal {
// Import all the types defined inside the legacy HAL header files into this
// namespace.
+using ::chre_nan_rtt_state;
using ::frame_info;
using ::frame_type;
using ::FRAME_TYPE_80211_MGMT;
@@ -204,6 +205,11 @@
using ::WIFI_AC_BK;
using ::WIFI_AC_VI;
using ::WIFI_AC_VO;
+using ::WIFI_ANTENNA_1X1;
+using ::WIFI_ANTENNA_2X2;
+using ::WIFI_ANTENNA_3X3;
+using ::WIFI_ANTENNA_4X4;
+using ::WIFI_ANTENNA_UNSPECIFIED;
using ::wifi_band;
using ::WIFI_BAND_A;
using ::WIFI_BAND_A_DFS;
@@ -281,6 +287,9 @@
using ::WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF;
using ::WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON;
using ::WIFI_POWER_SCENARIO_VOICE_CALL;
+using ::wifi_radio_combination;
+using ::wifi_radio_combination_matrix;
+using ::wifi_radio_configuration;
using ::wifi_rate;
using ::wifi_request_id;
using ::wifi_ring_buffer_status;
@@ -450,6 +459,12 @@
std::function<void(const TwtDeviceNotify&)> on_device_notify;
};
+// CHRE response and event callbacks struct.
+struct ChreCallbackHandlers {
+ // Callback for CHRE NAN RTT
+ std::function<void(chre_nan_rtt_state)> on_wifi_chre_nan_rtt_state;
+};
+
/**
* Class that encapsulates all legacy HAL interactions.
* This class manages the lifetime of the event loop thread used by legacy HAL.
@@ -660,6 +675,14 @@
wifi_error setIndoorState(bool isIndoor);
+ std::pair<wifi_error, wifi_radio_combination_matrix*> getSupportedRadioCombinationsMatrix();
+
+ // CHRE NAN RTT function
+ wifi_error chreNanRttRequest(const std::string& iface_name, bool enable);
+
+ wifi_error chreRegisterHandler(const std::string& iface_name,
+ const ChreCallbackHandlers& handler);
+
private:
// Retrieve interface handles for all the available interfaces.
wifi_error retrieveIfaceHandles();
diff --git a/wifi/1.6/default/wifi_legacy_hal_stubs.cpp b/wifi/1.6/default/wifi_legacy_hal_stubs.cpp
index 7e66fab..5ad22f5 100644
--- a/wifi/1.6/default/wifi_legacy_hal_stubs.cpp
+++ b/wifi/1.6/default/wifi_legacy_hal_stubs.cpp
@@ -162,6 +162,10 @@
populateStubFor(&hal_fn->wifi_get_usable_channels);
populateStubFor(&hal_fn->wifi_trigger_subsystem_restart);
populateStubFor(&hal_fn->wifi_set_indoor_state);
+ populateStubFor(&hal_fn->wifi_get_supported_radio_combinations_matrix);
+ populateStubFor(&hal_fn->wifi_nan_rtt_chre_enable_request);
+ populateStubFor(&hal_fn->wifi_nan_rtt_chre_disable_request);
+ populateStubFor(&hal_fn->wifi_chre_register_handler);
return true;
}
} // namespace legacy_hal
diff --git a/wifi/1.6/types.hal b/wifi/1.6/types.hal
index ef6965d..80fdbd1 100644
--- a/wifi/1.6/types.hal
+++ b/wifi/1.6/types.hal
@@ -46,6 +46,7 @@
import @1.4::RttPreamble;
import @1.4::WifiRatePreamble;
import @1.5::NanConfigRequestSupplemental;
+import @1.5::WifiBand;
import @1.5::StaLinkLayerIfaceContentionTimeStats;
import @1.5::WifiIfaceMode;
@@ -87,6 +88,17 @@
};
/**
+ * Antenna configuration
+ */
+enum WifiAntennaMode : uint32_t {
+ WIFI_ANTENNA_MODE_UNSPECIFIED = 0,
+ WIFI_ANTENNA_MODE_1X1 = 1,
+ WIFI_ANTENNA_MODE_2X2 = 2,
+ WIFI_ANTENNA_MODE_3X3 = 3,
+ WIFI_ANTENNA_MODE_4X4 = 4,
+};
+
+/**
* Channel information.
*/
struct WifiChannelInfo {
@@ -1262,3 +1274,41 @@
*/
bool instantCommunicationModeSupportFlag;
};
+
+/**
+ * Wifi radio configuration
+ */
+struct WifiRadioConfiguration {
+ /**
+ * Band on which this radio chain is operating.
+ * Valid values of bandInfo are: BAND_24GHZ, BAND_5GHZ, BAND_6GHZ and
+ * BAND_60GHZ.
+ *
+ */
+ WifiBand bandInfo;
+
+ /**
+ * Wifi Antenna configuration.
+ */
+ WifiAntennaMode antennaMode;
+};
+
+/**
+ * Wifi radio combination
+ */
+struct WifiRadioCombination {
+ /**
+ * A list of radio configurations in this combination.
+ */
+ vec<WifiRadioConfiguration> radioConfigurations;
+};
+
+/**
+ * Wifi radio combinations matrix retrieved via |getSupportedRadioCombinationsMatrix|.
+ */
+struct WifiRadioCombinationMatrix {
+ /**
+ * A list of all the possible radio combinations that the chip can operate.
+ */
+ vec<WifiRadioCombination> radioCombinations;
+};
diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/EncryptionType.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/EncryptionType.aidl
index cec0c14..ae3dccb 100644
--- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/EncryptionType.aidl
+++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/EncryptionType.aidl
@@ -39,4 +39,5 @@
WPA2 = 2,
WPA3_SAE_TRANSITION = 3,
WPA3_SAE = 4,
+ OWE_TRANSITION = 5,
}
diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/EncryptionType.aidl b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/EncryptionType.aidl
index bfc634d..a8f3252 100644
--- a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/EncryptionType.aidl
+++ b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/EncryptionType.aidl
@@ -29,4 +29,5 @@
WPA2,
WPA3_SAE_TRANSITION,
WPA3_SAE,
+ OWE_TRANSITION,
}
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
index 114fe4f..086166a 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
@@ -69,37 +69,6 @@
// disable.
bool waitForSupplicantStop() { return waitForSupplicantState(false); }
-// Helper function to initialize the driver and firmware to STA mode
-// using the vendor HAL HIDL interface.
-void initilializeDriverAndFirmware(const std::string& wifi_instance_name) {
- // Skip if wifi instance is not set.
- if (wifi_instance_name == "") {
- return;
- }
- if (getWifi(wifi_instance_name) != nullptr) {
- sp<IWifiChip> wifi_chip = getWifiChip(wifi_instance_name);
- ChipModeId mode_id;
- EXPECT_TRUE(configureChipToSupportIfaceType(
- wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::STA, &mode_id));
- } else {
- LOG(WARNING) << __func__ << ": Vendor HAL not supported";
- }
-}
-
-// Helper function to deinitialize the driver and firmware
-// using the vendor HAL HIDL interface.
-void deInitilializeDriverAndFirmware(const std::string& wifi_instance_name) {
- // Skip if wifi instance is not set.
- if (wifi_instance_name == "") {
- return;
- }
- if (getWifi(wifi_instance_name) != nullptr) {
- stopWifi(wifi_instance_name);
- } else {
- LOG(WARNING) << __func__ << ": Vendor HAL not supported";
- }
-}
-
// Helper function to find any iface of the desired type exposed.
bool findIfaceOfType(sp<ISupplicant> supplicant, IfaceType desired_type,
ISupplicant::IfaceInfo* out_info) {
@@ -156,14 +125,46 @@
SupplicantManager supplicant_manager;
ASSERT_TRUE(supplicant_manager.StopSupplicant());
- deInitilializeDriverAndFirmware(wifi_instance_name);
+ deInitializeDriverAndFirmware(wifi_instance_name);
ASSERT_FALSE(supplicant_manager.IsSupplicantRunning());
}
+// Helper function to initialize the driver and firmware to STA mode
+// using the vendor HAL HIDL interface.
+void initializeDriverAndFirmware(const std::string& wifi_instance_name) {
+ // Skip if wifi instance is not set.
+ if (wifi_instance_name == "") {
+ return;
+ }
+ if (getWifi(wifi_instance_name) != nullptr) {
+ sp<IWifiChip> wifi_chip = getWifiChip(wifi_instance_name);
+ ChipModeId mode_id;
+ EXPECT_TRUE(configureChipToSupportIfaceType(
+ wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::STA,
+ &mode_id));
+ } else {
+ LOG(WARNING) << __func__ << ": Vendor HAL not supported";
+ }
+}
+
+// Helper function to deinitialize the driver and firmware
+// using the vendor HAL HIDL interface.
+void deInitializeDriverAndFirmware(const std::string& wifi_instance_name) {
+ // Skip if wifi instance is not set.
+ if (wifi_instance_name == "") {
+ return;
+ }
+ if (getWifi(wifi_instance_name) != nullptr) {
+ stopWifi(wifi_instance_name);
+ } else {
+ LOG(WARNING) << __func__ << ": Vendor HAL not supported";
+ }
+}
+
void startSupplicantAndWaitForHidlService(
const std::string& wifi_instance_name,
const std::string& supplicant_instance_name) {
- initilializeDriverAndFirmware(wifi_instance_name);
+ initializeDriverAndFirmware(wifi_instance_name);
SupplicantManager supplicant_manager;
ASSERT_TRUE(supplicant_manager.StartSupplicant());
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.h b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.h
index 22cea8c..7228623 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.h
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.h
@@ -42,6 +42,11 @@
const std::string& wifi_instance_name,
const std::string& supplicant_instance_name);
+// Used to initialize/deinitialize the driver and firmware at the
+// beginning and end of each test.
+void initializeDriverAndFirmware(const std::string& wifi_instance_name);
+void deInitializeDriverAndFirmware(const std::string& wifi_instance_name);
+
// Helper functions to obtain references to the various HIDL interface objects.
// Note: We only have a single instance of each of these objects currently.
// These helper functions should be modified to return vectors if we support
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
index f1332d9..f709aef 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
@@ -93,4 +93,6 @@
String startWpsPinDisplay(in String groupIfName, in byte[] bssid);
void startWpsPinKeypad(in String groupIfName, in String pin);
void stopFind();
+ void findOnSocialChannels(in int timeoutInSec);
+ void findOnSpecificFrequency(in int freqInHz, in int timeoutInSec);
}
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
index ca40379..5c0aacd 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
@@ -61,6 +61,9 @@
void reassociate();
void reconnect();
void registerCallback(in android.hardware.wifi.supplicant.ISupplicantStaIfaceCallback callback);
+ void setQosPolicyFeatureEnabled(in boolean enable);
+ void sendQosPolicyResponse(in boolean morePolicies, in android.hardware.wifi.supplicant.QosPolicyStatus[] qosPolicyStatusList);
+ void removeAllQosPolicies();
void removeDppUri(in int id);
void removeExtRadioWork(in int id);
void removeNetwork(in int id);
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl
index 37b34cf..c17c624 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl
@@ -60,4 +60,6 @@
oneway void onWpsEventFail(in byte[] bssid, in android.hardware.wifi.supplicant.WpsConfigError configError, in android.hardware.wifi.supplicant.WpsErrorIndication errorInd);
oneway void onWpsEventPbcOverlap();
oneway void onWpsEventSuccess();
+ oneway void onQosPolicyReset();
+ oneway void onQosPolicyRequest(in android.hardware.wifi.supplicant.QosPolicyData[] qosPolicyData);
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/IpVersion.aidl
similarity index 89%
copy from radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
copy to wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/IpVersion.aidl
index 4f29c0b..f571b44 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/IpVersion.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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.radio.network;
-@VintfStability
-parcelable NeighboringCell {
- String cid;
- int rssi;
+package android.hardware.wifi.supplicant;
+@Backing(type="byte") @VintfStability
+enum IpVersion {
+ VERSION_4 = 0,
+ VERSION_6 = 1,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PortRange.aidl
similarity index 90%
copy from radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
copy to wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PortRange.aidl
index 4f29c0b..b2004f2 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PortRange.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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.radio.network;
+package android.hardware.wifi.supplicant;
@VintfStability
-parcelable NeighboringCell {
- String cid;
- int rssi;
+parcelable PortRange {
+ int startPort;
+ int endPort;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ProtocolNextHeader.aidl
similarity index 88%
copy from radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
copy to wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ProtocolNextHeader.aidl
index 4f29c0b..8fb91d0 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ProtocolNextHeader.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,10 @@
// 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.radio.network;
-@VintfStability
-parcelable NeighboringCell {
- String cid;
- int rssi;
+package android.hardware.wifi.supplicant;
+@Backing(type="byte") @VintfStability
+enum ProtocolNextHeader {
+ TCP = 6,
+ UDP = 17,
+ ESP = 50,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl
similarity index 76%
copy from radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
copy to wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl
index 4f29c0b..8bf5fd8 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,16 @@
// 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.radio.network;
+package android.hardware.wifi.supplicant;
@VintfStability
-parcelable NeighboringCell {
- String cid;
- int rssi;
+parcelable QosPolicyClassifierParams {
+ android.hardware.wifi.supplicant.IpVersion ipVersion;
+ android.hardware.wifi.supplicant.QosPolicyClassifierParamsMask classifierParamMask;
+ byte[] srcIp;
+ byte[] dstIp;
+ int srcPort;
+ android.hardware.wifi.supplicant.PortRange dstPortRange;
+ android.hardware.wifi.supplicant.ProtocolNextHeader protocolNextHdr;
+ byte[] flowLabelIpv6;
+ String domainName;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/UssdModeType.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl
similarity index 85%
copy from radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/UssdModeType.aidl
copy to wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl
index 5395b11..280ddbe 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/UssdModeType.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,13 +31,14 @@
// 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.radio.messaging;
+package android.hardware.wifi.supplicant;
@Backing(type="int") @VintfStability
-enum UssdModeType {
- NOTIFY = 0,
- REQUEST = 1,
- NW_RELEASE = 2,
- LOCAL_CLIENT = 3,
- NOT_SUPPORTED = 4,
- NW_TIMEOUT = 5,
+enum QosPolicyClassifierParamsMask {
+ SRC_IP = 1,
+ DST_IP = 2,
+ SRC_PORT = 4,
+ DST_PORT_RANGE = 8,
+ PROTOCOL_NEXT_HEADER = 16,
+ FLOW_LABEL = 32,
+ DOMAIN_NAME = 64,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyData.aidl
similarity index 83%
copy from radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
copy to wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyData.aidl
index 4f29c0b..1719565 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyData.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,11 @@
// 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.radio.network;
+package android.hardware.wifi.supplicant;
@VintfStability
-parcelable NeighboringCell {
- String cid;
- int rssi;
+parcelable QosPolicyData {
+ byte policyId;
+ android.hardware.wifi.supplicant.QosPolicyRequestType requestType;
+ byte dscp;
+ android.hardware.wifi.supplicant.QosPolicyClassifierParams classifierParams;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyRequestType.aidl
similarity index 87%
copy from radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
copy to wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyRequestType.aidl
index 4f29c0b..4c1e4fa 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyRequestType.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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.radio.network;
-@VintfStability
-parcelable NeighboringCell {
- String cid;
- int rssi;
+package android.hardware.wifi.supplicant;
+@Backing(type="byte") @VintfStability
+enum QosPolicyRequestType {
+ QOS_POLICY_ADD = 0,
+ QOS_POLICY_REMOVE = 1,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyStatus.aidl
similarity index 88%
copy from radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
copy to wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyStatus.aidl
index 4f29c0b..61278c5 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyStatus.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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.radio.network;
+package android.hardware.wifi.supplicant;
@VintfStability
-parcelable NeighboringCell {
- String cid;
- int rssi;
+parcelable QosPolicyStatus {
+ byte policyId;
+ android.hardware.wifi.supplicant.QosPolicyStatusCode status;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyStatusCode.aidl
similarity index 83%
copy from radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
copy to wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyStatusCode.aidl
index 4f29c0b..4d40edc 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NeighboringCell.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyStatusCode.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,11 @@
// 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.radio.network;
-@VintfStability
-parcelable NeighboringCell {
- String cid;
- int rssi;
+package android.hardware.wifi.supplicant;
+@Backing(type="byte") @VintfStability
+enum QosPolicyStatusCode {
+ QOS_POLICY_SUCCESS = 0,
+ QOS_POLICY_REQUEST_DECLINED = 1,
+ QOS_POLICY_CLASSIFIER_NOT_SUPPORTED = 2,
+ QOS_POLICY_INSUFFICIENT_RESOURCES = 3,
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
index 11cdc8b..7588c74 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
@@ -237,7 +237,7 @@
* Initiate a P2P service discovery with an optional timeout.
*
* @param timeoutInSec Max time to be spent is performing discovery.
- * Set to 0 to indefinely continue discovery until an explicit
+ * Set to 0 to indefinitely continue discovery until an explicit
* |stopFind| is sent.
* @throws ServiceSpecificException with one of the following values:
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
@@ -778,4 +778,36 @@
* |SupplicantStatusCode.FAILURE_IFACE_DISABLED|
*/
void stopFind();
+
+ /**
+ * Initiate a P2P device discovery only on social channels.
+ *
+ * Full P2P discovery is performed through |ISupplicantP2pIface.find| method.
+ *
+ * @param timeoutInSec The maximum amount of time that should be spent in performing device
+ * discovery.
+ * Set to 0 to indefinitely continue discovery until an explicit
+ * |stopFind| is sent.
+ * @throws ServiceSpecificException with one of the following values:
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ * |SupplicantStatusCode.FAILURE_IFACE_DISABLED|
+ */
+ void findOnSocialChannels(in int timeoutInSec);
+
+ /**
+ * Initiate a P2P device discovery on a specific frequency.
+ *
+ * Full P2P discovery is performed through |ISupplicantP2pIface.find| method.
+ *
+ * @param freqInHz the frequency to be scanned.
+ * @param timeoutInSec Max time to be spent is performing discovery.
+ * Set to 0 to indefinitely continue discovery until an explicit
+ * |stopFind| is sent.
+ * @throws ServiceSpecificException with one of the following values:
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ * |SupplicantStatusCode.FAILURE_IFACE_DISABLED|
+ */
+ void findOnSpecificFrequency(in int freqInHz, in int timeoutInSec);
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
index b48fa04..a48a991 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
@@ -28,6 +28,7 @@
import android.hardware.wifi.supplicant.ISupplicantStaNetwork;
import android.hardware.wifi.supplicant.IfaceType;
import android.hardware.wifi.supplicant.KeyMgmtMask;
+import android.hardware.wifi.supplicant.QosPolicyStatus;
import android.hardware.wifi.supplicant.RxFilterType;
import android.hardware.wifi.supplicant.WpaDriverCapabilitiesMask;
import android.hardware.wifi.supplicant.WpsConfigMethods;
@@ -377,6 +378,37 @@
void registerCallback(in ISupplicantStaIfaceCallback callback);
/**
+ * Enable/disable QoS policy feature.
+ * @param enable true to enable, false to disable.
+ * @throws ServiceSpecificException with one of the following values:
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|
+ */
+ void setQosPolicyFeatureEnabled(in boolean enable);
+
+ /**
+ * Send a DSCP policy response to the AP. If a DSCP request is ongoing,
+ * sends a solicited (uses the ongoing DSCP request as dialog token) DSCP
+ * response. Otherwise, sends an unsolicited DSCP response.
+ *
+ * @param morePolicies Flag to indicate more QoS policies can be accommodated.
+ * @param qosPolicyStatusList QoS policy status info for each QoS policy id.
+ * @throws ServiceSpecificException with one of the following values:
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_UNSUPPORTED|
+ */
+ void sendQosPolicyResponse(in boolean morePolicies, in QosPolicyStatus[] qosPolicyStatusList);
+
+ /**
+ * Indicate removal of all active QoS policies configured by the AP.
+ *
+ * @throws ServiceSpecificException with one of the following values:
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_UNSUPPORTED|
+ */
+ void removeAllQosPolicies();
+
+ /**
* Remove a DPP peer URI.
*
* @param id The ID of the URI, as returned by |addDppPeerUri|.
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl
index 594fef9..ca63f5c 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl
@@ -26,6 +26,7 @@
import android.hardware.wifi.supplicant.DppProgressCode;
import android.hardware.wifi.supplicant.Hs20AnqpData;
import android.hardware.wifi.supplicant.OsuMethod;
+import android.hardware.wifi.supplicant.QosPolicyData;
import android.hardware.wifi.supplicant.StaIfaceCallbackState;
import android.hardware.wifi.supplicant.StaIfaceReasonCode;
import android.hardware.wifi.supplicant.WpsConfigError;
@@ -275,4 +276,17 @@
* Used to indicate the success of a WPS connection attempt.
*/
oneway void onWpsEventSuccess();
+
+ /**
+ * Used to indicate that the AP has cleared all DSCP requests
+ * associated with this device.
+ */
+ oneway void onQosPolicyReset();
+
+ /**
+ * Used to indicate a DSCP request was received from the AP.
+ *
+ * @param qosPolicyData QoS policies info requested by the AP.
+ */
+ oneway void onQosPolicyRequest(in QosPolicyData[] qosPolicyData);
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/IpVersion.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/IpVersion.aidl
new file mode 100644
index 0000000..ad83fd7
--- /dev/null
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/IpVersion.aidl
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.supplicant;
+
+/**
+ * Enum values for IP version.
+ */
+@VintfStability
+@Backing(type="byte")
+enum IpVersion {
+ VERSION_4,
+ VERSION_6,
+}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/PortRange.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/PortRange.aidl
new file mode 100644
index 0000000..0b8385e
--- /dev/null
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/PortRange.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.supplicant;
+
+/**
+ * Port range to indicate start port and end port number.
+ */
+@VintfStability
+parcelable PortRange {
+ int startPort;
+ int endPort;
+}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ProtocolNextHeader.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ProtocolNextHeader.aidl
new file mode 100644
index 0000000..643405b
--- /dev/null
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ProtocolNextHeader.aidl
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.supplicant;
+
+/**
+ * Enum values for Protocol/Next Header.
+ */
+@VintfStability
+@Backing(type="byte")
+enum ProtocolNextHeader {
+ TCP = 6,
+ UDP = 17,
+ ESP = 50,
+}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl
new file mode 100644
index 0000000..d95d18d
--- /dev/null
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.supplicant;
+
+import android.hardware.wifi.supplicant.IpVersion;
+import android.hardware.wifi.supplicant.PortRange;
+import android.hardware.wifi.supplicant.ProtocolNextHeader;
+import android.hardware.wifi.supplicant.QosPolicyClassifierParamsMask;
+
+/**
+ * QoS policy classifier parameters. Refer section 5.4 of the
+ * WFA (WiFi Alliance) QoS Management Specification v2.0.
+ */
+@VintfStability
+parcelable QosPolicyClassifierParams {
+ IpVersion ipVersion;
+
+ /**
+ * Classifier bit mask to identify filled fields. Setting a bit
+ * in the mask to 1 means the corresponding field in this struct
+ * has a value. Otherwise, that field should be ignored.
+ */
+ QosPolicyClassifierParamsMask classifierParamMask;
+
+ /** Source IP address. */
+ byte[] srcIp;
+
+ /** Destination IP address. */
+ byte[] dstIp;
+
+ /** Source port. */
+ int srcPort;
+
+ /**
+ * Destination port range. In the case of a single destination port,
+ * both startPort and endPort will have the same values.
+ */
+ PortRange dstPortRange;
+
+ /** Represents protocol for IPv4 and Next Header for IPv6. */
+ ProtocolNextHeader protocolNextHdr;
+
+ /** Applicable only for IPv6. */
+ byte[/* 3 */] flowLabelIpv6;
+
+ /**
+ * Domain Name encoded and formatted in accordance with the rules for
+ * "reg-name" in RFC 3986.
+ */
+ String domainName;
+}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl
new file mode 100644
index 0000000..51bc14c
--- /dev/null
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.supplicant;
+
+/**
+ * Enum values for QoS policy classifier params mask bits.
+ */
+@VintfStability
+@Backing(type="int")
+enum QosPolicyClassifierParamsMask {
+ SRC_IP = 1 << 0,
+ DST_IP = 1 << 1,
+ SRC_PORT = 1 << 2,
+ DST_PORT_RANGE = 1 << 3,
+ PROTOCOL_NEXT_HEADER = 1 << 4,
+ FLOW_LABEL = 1 << 5,
+ DOMAIN_NAME = 1 << 6,
+}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyData.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyData.aidl
new file mode 100644
index 0000000..0ae0def
--- /dev/null
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyData.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.supplicant;
+
+import android.hardware.wifi.supplicant.QosPolicyClassifierParams;
+import android.hardware.wifi.supplicant.QosPolicyRequestType;
+
+/**
+ * QoS policy information in DSCP request.
+ */
+@VintfStability
+parcelable QosPolicyData {
+ /** QoS Policy identifier. */
+ byte policyId;
+
+ QosPolicyRequestType requestType;
+
+ /**
+ * DSCP value to be set for uplink traffic streams matched with
+ * |classifierParams|. Applicable only when |requestType| is
+ * |QOS_POLICY_ADD|.
+ */
+ byte dscp;
+
+ /**
+ * QoS policy classifier params. Applicable only when |requestType|
+ * is |QOS_POLICY_ADD|.
+ */
+ QosPolicyClassifierParams classifierParams;
+}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyRequestType.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyRequestType.aidl
new file mode 100644
index 0000000..fd9a8d0
--- /dev/null
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyRequestType.aidl
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.supplicant;
+
+/**
+ * Enum values for QoS Policy request type.
+ */
+@VintfStability
+@Backing(type="byte")
+enum QosPolicyRequestType {
+ /**
+ * If an Add request includes an existing policy,
+ * it should be considered an update request by the handler.
+ */
+ QOS_POLICY_ADD,
+ QOS_POLICY_REMOVE,
+}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyStatus.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyStatus.aidl
new file mode 100644
index 0000000..9087048
--- /dev/null
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyStatus.aidl
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.supplicant;
+
+import android.hardware.wifi.supplicant.QosPolicyStatusCode;
+
+/**
+ * QoS policy status tuple.
+ */
+@VintfStability
+parcelable QosPolicyStatus {
+ byte policyId;
+ QosPolicyStatusCode status;
+}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyStatusCode.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyStatusCode.aidl
new file mode 100644
index 0000000..8ab60ad
--- /dev/null
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyStatusCode.aidl
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.supplicant;
+
+/**
+ * Enum values for QoS policy response status.
+ */
+@VintfStability
+@Backing(type="byte")
+enum QosPolicyStatusCode {
+ QOS_POLICY_SUCCESS,
+ QOS_POLICY_REQUEST_DECLINED,
+ QOS_POLICY_CLASSIFIER_NOT_SUPPORTED,
+ QOS_POLICY_INSUFFICIENT_RESOURCES,
+}
diff --git a/wifi/supplicant/aidl/vts/functional/Android.bp b/wifi/supplicant/aidl/vts/functional/Android.bp
index 65f9652..8e142ec 100644
--- a/wifi/supplicant/aidl/vts/functional/Android.bp
+++ b/wifi/supplicant/aidl/vts/functional/Android.bp
@@ -33,11 +33,23 @@
shared_libs: [
"libbinder",
"libbinder_ndk",
+ "libvndksupport",
],
static_libs: [
+ "android.hardware.wifi@1.0",
+ "android.hardware.wifi@1.1",
+ "android.hardware.wifi@1.2",
+ "android.hardware.wifi@1.3",
+ "android.hardware.wifi@1.4",
+ "android.hardware.wifi@1.5",
+ "android.hardware.wifi.supplicant@1.0",
+ "android.hardware.wifi.supplicant@1.1",
"android.hardware.wifi.supplicant-V1-ndk",
"libwifi-system",
"libwifi-system-iface",
+ "VtsHalWifiV1_0TargetTestUtil",
+ "VtsHalWifiV1_5TargetTestUtil",
+ "VtsHalWifiSupplicantV1_0TargetTestUtil",
],
test_suites: [
"general-tests",
@@ -55,11 +67,23 @@
shared_libs: [
"libbinder",
"libbinder_ndk",
+ "libvndksupport",
],
static_libs: [
+ "android.hardware.wifi@1.0",
+ "android.hardware.wifi@1.1",
+ "android.hardware.wifi@1.2",
+ "android.hardware.wifi@1.3",
+ "android.hardware.wifi@1.4",
+ "android.hardware.wifi@1.5",
+ "android.hardware.wifi.supplicant@1.0",
+ "android.hardware.wifi.supplicant@1.1",
"android.hardware.wifi.supplicant-V1-ndk",
"libwifi-system",
"libwifi-system-iface",
+ "VtsHalWifiV1_0TargetTestUtil",
+ "VtsHalWifiV1_5TargetTestUtil",
+ "VtsHalWifiSupplicantV1_0TargetTestUtil",
],
test_suites: [
"general-tests",
@@ -77,11 +101,23 @@
shared_libs: [
"libbinder",
"libbinder_ndk",
+ "libvndksupport",
],
static_libs: [
+ "android.hardware.wifi@1.0",
+ "android.hardware.wifi@1.1",
+ "android.hardware.wifi@1.2",
+ "android.hardware.wifi@1.3",
+ "android.hardware.wifi@1.4",
+ "android.hardware.wifi@1.5",
+ "android.hardware.wifi.supplicant@1.0",
+ "android.hardware.wifi.supplicant@1.1",
"android.hardware.wifi.supplicant-V1-ndk",
"libwifi-system",
"libwifi-system-iface",
+ "VtsHalWifiV1_0TargetTestUtil",
+ "VtsHalWifiV1_5TargetTestUtil",
+ "VtsHalWifiSupplicantV1_0TargetTestUtil",
],
test_suites: [
"general-tests",
diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp
index 10aab4d..90ca215 100644
--- a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp
+++ b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp
@@ -169,8 +169,7 @@
public:
void SetUp() override {
initializeService();
- supplicant_ = ISupplicant::fromBinder(ndk::SpAIBinder(
- AServiceManager_waitForService(GetParam().c_str())));
+ supplicant_ = getSupplicant(GetParam().c_str());
ASSERT_NE(supplicant_, nullptr);
ASSERT_TRUE(supplicant_
->setDebugParams(DebugLevel::EXCESSIVE,
@@ -184,13 +183,13 @@
GTEST_SKIP() << "Wi-Fi Direct is not supported, skip this test.";
}
- EXPECT_TRUE(supplicant_->addP2pInterface(getP2pIfaceName(), &p2p_iface_)
+ EXPECT_TRUE(supplicant_->getP2pInterface(getP2pIfaceName(), &p2p_iface_)
.isOk());
ASSERT_NE(p2p_iface_, nullptr);
}
void TearDown() override {
- stopSupplicant();
+ stopSupplicantService();
startWifiFramework();
}
@@ -481,6 +480,20 @@
}
/*
+ * FindSocialChannelsOnly
+ */
+TEST_P(SupplicantP2pIfaceAidlTest, FindSocialChannelsOnly) {
+ EXPECT_TRUE(p2p_iface_->findOnSocialChannels(kTestFindTimeout).isOk());
+}
+
+/*
+ * FindSpecificFrequency
+ */
+TEST_P(SupplicantP2pIfaceAidlTest, FindSpecificFrequency) {
+ EXPECT_TRUE(p2p_iface_->findOnSpecificFrequency(2412, kTestFindTimeout).isOk());
+}
+
+/*
* StopFind
*/
TEST_P(SupplicantP2pIfaceAidlTest, StopFind) {
diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp
index 6e6955f..c163864 100644
--- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp
+++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp
@@ -191,27 +191,32 @@
::ndk::ScopedAStatus onWpsEventSuccess() override {
return ndk::ScopedAStatus::ok();
}
+ ::ndk::ScopedAStatus onQosPolicyReset() override { return ndk::ScopedAStatus::ok(); }
+ ::ndk::ScopedAStatus onQosPolicyRequest(
+ const std::vector<::aidl::android::hardware::wifi::supplicant ::
+ QosPolicyData /* qosPolicyData */>&) override {
+ return ndk::ScopedAStatus::ok();
+ }
};
class SupplicantStaIfaceAidlTest : public testing::TestWithParam<std::string> {
public:
void SetUp() override {
initializeService();
- supplicant_ = ISupplicant::fromBinder(ndk::SpAIBinder(
- AServiceManager_waitForService(GetParam().c_str())));
+ supplicant_ = getSupplicant(GetParam().c_str());
ASSERT_NE(supplicant_, nullptr);
ASSERT_TRUE(supplicant_
->setDebugParams(DebugLevel::EXCESSIVE,
true, // show timestamps
true)
.isOk());
- EXPECT_TRUE(supplicant_->addStaInterface(getStaIfaceName(), &sta_iface_)
+ EXPECT_TRUE(supplicant_->getStaInterface(getStaIfaceName(), &sta_iface_)
.isOk());
ASSERT_NE(sta_iface_, nullptr);
}
void TearDown() override {
- stopSupplicant();
+ stopSupplicantService();
startWifiFramework();
}
diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp
index c6dd981..b3f70da 100644
--- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp
+++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp
@@ -105,15 +105,14 @@
public:
void SetUp() override {
initializeService();
- supplicant_ = ISupplicant::fromBinder(ndk::SpAIBinder(
- AServiceManager_waitForService(GetParam().c_str())));
+ supplicant_ = getSupplicant(GetParam().c_str());
ASSERT_NE(supplicant_, nullptr);
ASSERT_TRUE(supplicant_
->setDebugParams(DebugLevel::EXCESSIVE,
true, // show timestamps
true)
.isOk());
- EXPECT_TRUE(supplicant_->addStaInterface(getStaIfaceName(), &sta_iface_)
+ EXPECT_TRUE(supplicant_->getStaInterface(getStaIfaceName(), &sta_iface_)
.isOk());
ASSERT_NE(sta_iface_, nullptr);
EXPECT_TRUE(sta_iface_->addNetwork(&sta_network_).isOk());
@@ -121,7 +120,7 @@
}
void TearDown() override {
- stopSupplicant();
+ stopSupplicantService();
startWifiFramework();
}
diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h b/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h
index b7e1a80..17e0394 100644
--- a/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h
+++ b/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h
@@ -19,8 +19,14 @@
#include <VtsCoreUtil.h>
#include <android-base/logging.h>
+#include <android/hardware/wifi/1.0/IWifi.h>
+#include <hidl/ServiceManagement.h>
+#include <supplicant_hidl_test_utils.h>
#include <wifi_system/supplicant_manager.h>
+using aidl::android::hardware::wifi::supplicant::IfaceInfo;
+using aidl::android::hardware::wifi::supplicant::ISupplicant;
+using aidl::android::hardware::wifi::supplicant::ISupplicantP2pIface;
using aidl::android::hardware::wifi::supplicant::ISupplicantStaIface;
using aidl::android::hardware::wifi::supplicant::KeyMgmtMask;
using android::wifi_system::SupplicantManager;
@@ -37,6 +43,14 @@
return std::string(buffer.data());
}
+std::string getWifiInstanceName() {
+ const std::vector<std::string> instances =
+ android::hardware::getAllHalInstanceNames(
+ ::android::hardware::wifi::V1_0::IWifi::descriptor);
+ EXPECT_NE(0, instances.size());
+ return instances.size() != 0 ? instances[0] : "";
+}
+
bool keyMgmtSupported(std::shared_ptr<ISupplicantStaIface> iface,
KeyMgmtMask expected) {
KeyMgmtMask caps;
@@ -53,60 +67,44 @@
return keyMgmtSupported(iface, filsMask);
}
-bool waitForSupplicantState(bool is_running) {
+void startSupplicant() {
+ initializeDriverAndFirmware(getWifiInstanceName());
SupplicantManager supplicant_manager;
- int count = 50; /* wait at most 5 seconds for completion */
- while (count-- > 0) {
- if (supplicant_manager.IsSupplicantRunning() == is_running) {
- return true;
- }
- usleep(100000);
- }
- LOG(ERROR) << "Supplicant not " << (is_running ? "running" : "stopped");
- return false;
+ ASSERT_TRUE(supplicant_manager.StartSupplicant());
+ ASSERT_TRUE(supplicant_manager.IsSupplicantRunning());
}
-bool waitForFrameworkReady() {
- int waitCount = 15;
- do {
- // Check whether package service is ready or not.
- if (!testing::checkSubstringInCommandOutput(
- "/system/bin/service check package", ": not found")) {
- return true;
- }
- LOG(INFO) << "Framework is not ready";
- sleep(1);
- } while (waitCount-- > 0);
- return false;
-}
-
-bool waitForSupplicantStart() { return waitForSupplicantState(true); }
-
-bool waitForSupplicantStop() { return waitForSupplicantState(false); }
-
-void stopSupplicant() {
- SupplicantManager supplicant_manager;
- ASSERT_TRUE(supplicant_manager.StopSupplicant());
- ASSERT_FALSE(supplicant_manager.IsSupplicantRunning());
-}
-
-bool startWifiFramework() {
- std::system("svc wifi enable");
- std::system("cmd wifi set-scan-always-available enabled");
- return waitForSupplicantStart();
-}
-
-bool stopWifiFramework() {
- std::system("svc wifi disable");
- std::system("cmd wifi set-scan-always-available disabled");
- return waitForSupplicantStop();
-}
+// Wrapper around the implementation in supplicant_hidl_test_util.
+void stopSupplicantService() { stopSupplicant(getWifiInstanceName()); }
void initializeService() {
ASSERT_TRUE(stopWifiFramework());
std::system("/system/bin/start");
ASSERT_TRUE(waitForFrameworkReady());
- stopSupplicant();
+ stopSupplicantService();
+ startSupplicant();
+}
+
+void addStaIface(const std::shared_ptr<ISupplicant> supplicant) {
+ ASSERT_TRUE(supplicant.get());
+ std::shared_ptr<ISupplicantStaIface> iface;
+ ASSERT_TRUE(supplicant->addStaInterface(getStaIfaceName(), &iface).isOk());
+}
+
+void addP2pIface(const std::shared_ptr<ISupplicant> supplicant) {
+ ASSERT_TRUE(supplicant.get());
+ std::shared_ptr<ISupplicantP2pIface> iface;
+ ASSERT_TRUE(supplicant->addP2pInterface(getP2pIfaceName(), &iface).isOk());
+}
+
+std::shared_ptr<ISupplicant> getSupplicant(const char* supplicant_name) {
+ std::shared_ptr<ISupplicant> supplicant = ISupplicant::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(supplicant_name)));
+ addStaIface(supplicant);
+ if (testing::deviceSupportsFeature("android.hardware.wifi.direct")) {
+ addP2pIface(supplicant);
+ }
+ return supplicant;
}
#endif // SUPPLICANT_TEST_UTILS_H
\ No newline at end of file