Merge "Add Parcelable AidlComposer commands"
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnss.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnss.aidl
new file mode 100644
index 0000000..f02e08c
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnss.aidl
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@VintfStability
+interface IAGnss {
+ void setCallback(in android.hardware.gnss.IAGnssCallback callback);
+ void dataConnClosed();
+ void dataConnFailed();
+ void setServer(in android.hardware.gnss.IAGnssCallback.AGnssType type, in String hostname, in int port);
+ void dataConnOpen(in long networkHandle, in String apn, in android.hardware.gnss.IAGnss.ApnIpType apnIpType);
+ @Backing(type="int") @VintfStability
+ enum ApnIpType {
+ INVALID = 0,
+ IPV4 = 1,
+ IPV6 = 2,
+ IPV4V6 = 3,
+ }
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssCallback.aidl
new file mode 100644
index 0000000..2a46f61
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssCallback.aidl
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@VintfStability
+interface IAGnssCallback {
+ void agnssStatusCb(in android.hardware.gnss.IAGnssCallback.AGnssType type, in android.hardware.gnss.IAGnssCallback.AGnssStatusValue status);
+ @Backing(type="int") @VintfStability
+ enum AGnssType {
+ SUPL = 1,
+ C2K = 2,
+ SUPL_EIMS = 3,
+ SUPL_IMS = 4,
+ }
+ @Backing(type="int") @VintfStability
+ enum AGnssStatusValue {
+ REQUEST_AGNSS_DATA_CONN = 1,
+ RELEASE_AGNSS_DATA_CONN = 2,
+ AGNSS_DATA_CONNECTED = 3,
+ AGNSS_DATA_CONN_DONE = 4,
+ AGNSS_DATA_CONN_FAILED = 5,
+ }
+}
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 9bd04a0..ea98030 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
@@ -43,6 +43,7 @@
@nullable android.hardware.gnss.IGnssBatching getExtensionGnssBatching();
@nullable android.hardware.gnss.IGnssGeofence getExtensionGnssGeofence();
@nullable android.hardware.gnss.IGnssNavigationMessageInterface getExtensionGnssNavigationMessage();
+ android.hardware.gnss.IAGnss getExtensionAGnss();
const int ERROR_INVALID_ARGUMENT = 1;
const int ERROR_ALREADY_INIT = 2;
const int ERROR_GENERIC = 3;
diff --git a/gnss/aidl/android/hardware/gnss/IAGnss.aidl b/gnss/aidl/android/hardware/gnss/IAGnss.aidl
new file mode 100644
index 0000000..3e256e2
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/IAGnss.aidl
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss;
+
+import android.hardware.gnss.IAGnssCallback;
+import android.hardware.gnss.IAGnssCallback.AGnssType;
+
+/** Extended interface for Assisted GNSS support. */
+@VintfStability
+interface IAGnss {
+ /** Access point name IP type */
+ @VintfStability
+ @Backing(type="int")
+ enum ApnIpType {
+ INVALID = 0,
+ IPV4 = 1,
+ IPV6 = 2,
+ IPV4V6 = 3,
+ }
+
+ /**
+ * Opens the AGNSS interface and provides the callback routines to the
+ * implementation of this interface.
+ *
+ * If setCallback is not called, this interface will not respond to any
+ * other method calls.
+ *
+ * @param callback Handle to the AGNSS status callback interface.
+ */
+ void setCallback(in IAGnssCallback callback);
+
+ /**
+ * Notifies that the AGNSS data connection has been closed.
+ */
+ void dataConnClosed();
+
+ /**
+ * Notifies that a data connection is not available for AGNSS.
+ */
+ void dataConnFailed();
+
+ /**
+ * Sets the hostname and port for the AGNSS server.
+ *
+ * @param type Specifies if SUPL or C2K.
+ * @param hostname Hostname of the AGNSS server.
+ * @param port Port number associated with the server.
+ */
+ void setServer(in AGnssType type, in String hostname, in int port);
+
+ /**
+ * Notifies GNSS that a data connection is available and sets the network handle,
+ * name of the APN, and its IP type to be used for SUPL connections.
+ *
+ * The HAL implementation must use the network handle to set the network for the
+ * SUPL connection sockets using the android_setsocknetwork function. This will ensure
+ * that there is a network path to the SUPL server. The network handle can also be used
+ * to get the IP address of SUPL FQDN using the android_getaddrinfofornetwork() function.
+ *
+ * @param networkHandle Handle representing the network for use with the NDK API.
+ * @param apn Access Point Name (follows regular APN naming convention).
+ * @param apnIpType Specifies IP type of APN.
+ */
+ void dataConnOpen(in long networkHandle, in String apn, in ApnIpType apnIpType);
+}
diff --git a/gnss/aidl/android/hardware/gnss/IAGnssCallback.aidl b/gnss/aidl/android/hardware/gnss/IAGnssCallback.aidl
new file mode 100644
index 0000000..7c25937
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/IAGnssCallback.aidl
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss;
+
+/** Callback structure for the AGNSS interface. */
+@VintfStability
+interface IAGnssCallback {
+ /** AGNSS service type */
+ @VintfStability
+ @Backing(type="int")
+ enum AGnssType {
+ SUPL = 1,
+ C2K = 2,
+ SUPL_EIMS = 3,
+ SUPL_IMS = 4,
+ }
+
+ /** AGNSS status value */
+ @VintfStability
+ @Backing(type="int")
+ enum AGnssStatusValue {
+ /** GNSS requests data connection for AGNSS. */
+ REQUEST_AGNSS_DATA_CONN = 1,
+
+ /** GNSS releases the AGNSS data connection. */
+ RELEASE_AGNSS_DATA_CONN = 2,
+
+ /** AGNSS data connection initiated */
+ AGNSS_DATA_CONNECTED = 3,
+
+ /** AGNSS data connection completed */
+ AGNSS_DATA_CONN_DONE = 4,
+
+ /** AGNSS data connection failed */
+ AGNSS_DATA_CONN_FAILED = 5,
+ }
+
+ /**
+ * Callback with AGNSS status information.
+ *
+ * The GNSS HAL implementation must use this method to request the framework to setup
+ * network connection for the specified AGNSS service and to update the connection
+ * status so that the framework can release the resources.
+ *
+ * @param type Type of AGNSS service.
+ * @parama status Status of the data connection.
+ */
+ void agnssStatusCb(in AGnssType type, in AGnssStatusValue status);
+}
diff --git a/gnss/aidl/android/hardware/gnss/IGnss.aidl b/gnss/aidl/android/hardware/gnss/IGnss.aidl
index 42cc496..91403ca 100644
--- a/gnss/aidl/android/hardware/gnss/IGnss.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnss.aidl
@@ -16,6 +16,7 @@
package android.hardware.gnss;
+import android.hardware.gnss.IAGnss;
import android.hardware.gnss.IGnssBatching;
import android.hardware.gnss.IGnssCallback;
import android.hardware.gnss.IGnssConfiguration;
@@ -75,7 +76,7 @@
/**
* This method returns the IGnssPsds interface.
*
- * @return Handle to the IGnssPsds interface.
+ * @return The IGnssPsds interface.
*/
@nullable IGnssPsds getExtensionPsds();
@@ -84,7 +85,7 @@
*
* This method must return non-null.
*
- * @return Handle to the IGnssConfiguration interface.
+ * @return The IGnssConfiguration interface.
*/
IGnssConfiguration getExtensionGnssConfiguration();
@@ -93,7 +94,7 @@
*
* This method must return non-null.
*
- * @return Handle to the IGnssMeasurementInterface interface.
+ * @return The IGnssMeasurementInterface interface.
*/
IGnssMeasurementInterface getExtensionGnssMeasurement();
@@ -102,28 +103,35 @@
*
* This method must return non-null.
*
- * @return Handle to the IGnssPowerIndication interface.
+ * @return The IGnssPowerIndication interface.
*/
IGnssPowerIndication getExtensionGnssPowerIndication();
/**
* This method returns the IGnssBatching interface.
*
- * @return Handle to the IGnssBatching interface.
+ * @return The IGnssBatching interface.
*/
@nullable IGnssBatching getExtensionGnssBatching();
/**
* This method returns the IGnssGeofence interface.
*
- * @return Handle to the IGnssGeofence interface.
+ * @return The IGnssGeofence interface.
*/
@nullable IGnssGeofence getExtensionGnssGeofence();
/**
* This method returns the IGnssNavigationMessageInterface.
*
- * @return Handle to the IGnssNavigationMessageInterface.
+ * @return The IGnssNavigationMessageInterface.
*/
@nullable IGnssNavigationMessageInterface getExtensionGnssNavigationMessage();
+
+ /**
+ * This method returns the IAGnss interface.
+ *
+ * @return The IAGnss interface.
+ */
+ IAGnss getExtensionAGnss();
}
diff --git a/gnss/aidl/default/AGnss.cpp b/gnss/aidl/default/AGnss.cpp
new file mode 100644
index 0000000..e8d5ef7
--- /dev/null
+++ b/gnss/aidl/default/AGnss.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "AGnssAidl"
+
+#include "AGnss.h"
+#include <inttypes.h>
+#include <log/log.h>
+
+namespace aidl::android::hardware::gnss {
+
+std::shared_ptr<IAGnssCallback> AGnss::sCallback = nullptr;
+
+ndk::ScopedAStatus AGnss::setCallback(const std::shared_ptr<IAGnssCallback>& callback) {
+ ALOGD("AGnss::setCallback");
+ std::unique_lock<std::mutex> lock(mMutex);
+ sCallback = callback;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AGnss::setServer(AGnssType type, const std::string& hostname, int port) {
+ ALOGD("AGnss::setServer: type: %s, hostname: %s, port: %d", toString(type).c_str(),
+ hostname.c_str(), port);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AGnss::dataConnOpen(int64_t networkHandle, const std::string& apn,
+ ApnIpType apnIpType) {
+ ALOGD("AGnss::dataConnOpen: networkHandle:%" PRId64 ", apn: %s, apnIpType %s", networkHandle,
+ apn.c_str(), toString(apnIpType).c_str());
+ return ndk::ScopedAStatus::ok();
+}
+
+} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/AGnss.h b/gnss/aidl/default/AGnss.h
new file mode 100644
index 0000000..cd973e1
--- /dev/null
+++ b/gnss/aidl/default/AGnss.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/gnss/BnAGnss.h>
+
+namespace aidl::android::hardware::gnss {
+
+using AGnssType = IAGnssCallback::AGnssType;
+
+struct AGnss : public BnAGnss {
+ public:
+ ndk::ScopedAStatus setCallback(const std::shared_ptr<IAGnssCallback>& callback) override;
+ ndk::ScopedAStatus dataConnClosed() override { return ndk::ScopedAStatus::ok(); }
+ ndk::ScopedAStatus dataConnFailed() override { return ndk::ScopedAStatus::ok(); }
+ ndk::ScopedAStatus setServer(AGnssType type, const std::string& hostname, int port) override;
+ ndk::ScopedAStatus dataConnOpen(int64_t networkHandle, const std::string& apn,
+ ApnIpType apnIpType) override;
+
+ private:
+ // Synchronization lock for sCallback
+ mutable std::mutex mMutex;
+ // Guarded by mMutex
+ static std::shared_ptr<IAGnssCallback> sCallback;
+};
+
+} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/Android.bp b/gnss/aidl/default/Android.bp
index b6df895..1236714 100644
--- a/gnss/aidl/default/Android.bp
+++ b/gnss/aidl/default/Android.bp
@@ -55,6 +55,7 @@
"android.hardware.gnss-V2-ndk",
],
srcs: [
+ "AGnss.cpp",
"Gnss.cpp",
"GnssBatching.cpp",
"GnssGeofence.cpp",
diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp
index 8d58a20..0e3cdd3 100644
--- a/gnss/aidl/default/Gnss.cpp
+++ b/gnss/aidl/default/Gnss.cpp
@@ -18,6 +18,7 @@
#include "Gnss.h"
#include <log/log.h>
+#include "AGnss.h"
#include "GnssBatching.h"
#include "GnssConfiguration.h"
#include "GnssGeofence.h"
@@ -56,6 +57,12 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus Gnss::getExtensionAGnss(std::shared_ptr<IAGnss>* iAGnss) {
+ ALOGD("Gnss::getExtensionAGnss");
+ *iAGnss = SharedRefBase::make<AGnss>();
+ return ndk::ScopedAStatus::ok();
+}
+
ndk::ScopedAStatus Gnss::getExtensionPsds(std::shared_ptr<IGnssPsds>* iGnssPsds) {
ALOGD("Gnss::getExtensionPsds");
*iGnssPsds = SharedRefBase::make<GnssPsds>();
diff --git a/gnss/aidl/default/Gnss.h b/gnss/aidl/default/Gnss.h
index 128a6c1..4feb781 100644
--- a/gnss/aidl/default/Gnss.h
+++ b/gnss/aidl/default/Gnss.h
@@ -16,6 +16,7 @@
#pragma once
+#include <aidl/android/hardware/gnss/BnAGnss.h>
#include <aidl/android/hardware/gnss/BnGnss.h>
#include <aidl/android/hardware/gnss/BnGnssBatching.h>
#include <aidl/android/hardware/gnss/BnGnssConfiguration.h>
@@ -44,6 +45,7 @@
std::shared_ptr<IGnssGeofence>* iGnssGeofence) override;
ndk::ScopedAStatus getExtensionGnssNavigationMessage(
std::shared_ptr<IGnssNavigationMessageInterface>* iGnssNavigationMessage) override;
+ ndk::ScopedAStatus getExtensionAGnss(std::shared_ptr<IAGnss>* iAGnss) override;
std::shared_ptr<GnssConfiguration> mGnssConfiguration;
std::shared_ptr<GnssPowerIndication> mGnssPowerIndication;
diff --git a/gnss/aidl/vts/AGnssCallbackAidl.cpp b/gnss/aidl/vts/AGnssCallbackAidl.cpp
new file mode 100644
index 0000000..3327835
--- /dev/null
+++ b/gnss/aidl/vts/AGnssCallbackAidl.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "AGnssCallbackAidl.h"
+#include <log/log.h>
+
+android::binder::Status AGnssCallbackAidl::agnssStatusCb(const AGnssType type,
+ const AGnssStatusValue status) {
+ ALOGI("agnssStatusCb type %d status %d", type, status);
+ return android::binder::Status::ok();
+}
diff --git a/gnss/aidl/vts/AGnssCallbackAidl.h b/gnss/aidl/vts/AGnssCallbackAidl.h
new file mode 100644
index 0000000..6173e85
--- /dev/null
+++ b/gnss/aidl/vts/AGnssCallbackAidl.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <android/hardware/gnss/BnAGnssCallback.h>
+
+using AGnssType = android::hardware::gnss::IAGnssCallback::AGnssType;
+using AGnssStatusValue = android::hardware::gnss::IAGnssCallback::AGnssStatusValue;
+
+/** Implementation for IAGnssCallback. */
+class AGnssCallbackAidl : public android::hardware::gnss::BnAGnssCallback {
+ public:
+ AGnssCallbackAidl(){};
+ ~AGnssCallbackAidl(){};
+ android::binder::Status agnssStatusCb(const AGnssType type,
+ const AGnssStatusValue status) override;
+};
diff --git a/gnss/aidl/vts/Android.bp b/gnss/aidl/vts/Android.bp
index 4d81519..041d579 100644
--- a/gnss/aidl/vts/Android.bp
+++ b/gnss/aidl/vts/Android.bp
@@ -30,6 +30,7 @@
srcs: [
"gnss_hal_test.cpp",
"gnss_hal_test_cases.cpp",
+ "AGnssCallbackAidl.cpp",
"GnssBatchingCallback.cpp",
"GnssCallbackAidl.cpp",
"GnssGeofenceCallback.cpp",
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 830922c..970d1cb 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -16,12 +16,14 @@
#define LOG_TAG "GnssHalTestCases"
+#include <android/hardware/gnss/IAGnss.h>
#include <android/hardware/gnss/IGnss.h>
#include <android/hardware/gnss/IGnssBatching.h>
#include <android/hardware/gnss/IGnssMeasurementCallback.h>
#include <android/hardware/gnss/IGnssMeasurementInterface.h>
#include <android/hardware/gnss/IGnssPowerIndication.h>
#include <android/hardware/gnss/IGnssPsds.h>
+#include "AGnssCallbackAidl.h"
#include "GnssBatchingCallback.h"
#include "GnssGeofenceCallback.h"
#include "GnssMeasurementCallbackAidl.h"
@@ -36,6 +38,7 @@
using android::hardware::gnss::GnssData;
using android::hardware::gnss::GnssMeasurement;
using android::hardware::gnss::GnssPowerStats;
+using android::hardware::gnss::IAGnss;
using android::hardware::gnss::IGnss;
using android::hardware::gnss::IGnssBatching;
using android::hardware::gnss::IGnssBatchingCallback;
@@ -793,3 +796,24 @@
ASSERT_TRUE(status.isOk());
}
}
+
+/*
+ * TestAGnssExtension:
+ * 1. Gets the IAGnss extension.
+ * 2. Sets AGnssCallback.
+ * 3. Sets SUPL server host/port.
+ */
+TEST_P(GnssHalTest, TestAGnssExtension) {
+ sp<IAGnss> iAGnss;
+ auto status = aidl_gnss_hal_->getExtensionAGnss(&iAGnss);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_TRUE(iAGnss != nullptr);
+
+ auto agnssCallback = sp<AGnssCallbackAidl>::make();
+ status = iAGnss->setCallback(agnssCallback);
+ ASSERT_TRUE(status.isOk());
+
+ // Set SUPL server host/port
+ status = iAGnss->setServer(AGnssType::SUPL, String16("supl.google.com"), 7275);
+ ASSERT_TRUE(status.isOk());
+}
diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PixelFormat.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PixelFormat.aidl
index 04a863b..512fecb 100644
--- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PixelFormat.aidl
+++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PixelFormat.aidl
@@ -63,4 +63,5 @@
STENCIL_8 = 53,
YCBCR_P010 = 54,
HSV_888 = 55,
+ R_8 = 56,
}
diff --git a/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl b/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl
index eb87f8d..4e891f6 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl
@@ -498,4 +498,11 @@
* interpretation is defined by the dataspace.
*/
HSV_888 = 0x37,
+
+ /**
+ * 8 bit format with a single 8-bit component.
+ *
+ * The component values are unsigned normalized to the range [0, 1].
+ */
+ R_8 = 0x38,
}
diff --git a/health/aidl/Android.bp b/health/aidl/Android.bp
index fae7592..6e2f1d4 100644
--- a/health/aidl/Android.bp
+++ b/health/aidl/Android.bp
@@ -25,6 +25,7 @@
name: "android.hardware.health",
vendor_available: true,
recovery_available: true,
+ host_supported: true,
srcs: ["android/hardware/health/*.aidl"],
stability: "vintf",
backend: {
@@ -48,6 +49,7 @@
name: "android.hardware.health-translate-ndk",
vendor_available: true,
recovery_available: true,
+ host_supported: true,
srcs: ["android/hardware/health/translate-ndk.cpp"],
shared_libs: [
"libbinder_ndk",
@@ -61,6 +63,9 @@
"android.hardware.health@2.0",
"android.hardware.health@2.1",
],
+ defaults: [
+ "libbinder_ndk_host_user",
+ ],
}
java_library {
diff --git a/health/aidl/android/hardware/health/translate-ndk.cpp b/health/aidl/android/hardware/health/translate-ndk.cpp
index 7fe6ced..78880cc 100644
--- a/health/aidl/android/hardware/health/translate-ndk.cpp
+++ b/health/aidl/android/hardware/health/translate-ndk.cpp
@@ -106,36 +106,41 @@
}
__attribute__((warn_unused_result)) bool translate(
+ const ::android::hardware::health::V2_0::HealthInfo& in,
+ aidl::android::hardware::health::HealthInfo* out) {
+ out->chargerAcOnline = static_cast<bool>(in.legacy.chargerAcOnline);
+ out->chargerUsbOnline = static_cast<bool>(in.legacy.chargerUsbOnline);
+ out->chargerWirelessOnline = static_cast<bool>(in.legacy.chargerWirelessOnline);
+ out->maxChargingCurrentMicroamps = static_cast<int32_t>(in.legacy.maxChargingCurrent);
+ out->maxChargingVoltageMicrovolts = static_cast<int32_t>(in.legacy.maxChargingVoltage);
+ out->batteryStatus =
+ static_cast<aidl::android::hardware::health::BatteryStatus>(in.legacy.batteryStatus);
+ out->batteryHealth =
+ static_cast<aidl::android::hardware::health::BatteryHealth>(in.legacy.batteryHealth);
+ out->batteryPresent = static_cast<bool>(in.legacy.batteryPresent);
+ out->batteryLevel = static_cast<int32_t>(in.legacy.batteryLevel);
+ out->batteryVoltageMillivolts = static_cast<int32_t>(in.legacy.batteryVoltage);
+ out->batteryTemperatureTenthsCelsius = static_cast<int32_t>(in.legacy.batteryTemperature);
+ out->batteryCurrentMicroamps = static_cast<int32_t>(in.legacy.batteryCurrent);
+ out->batteryCycleCount = static_cast<int32_t>(in.legacy.batteryCycleCount);
+ out->batteryFullChargeUah = static_cast<int32_t>(in.legacy.batteryFullCharge);
+ out->batteryChargeCounterUah = static_cast<int32_t>(in.legacy.batteryChargeCounter);
+ out->batteryTechnology = in.legacy.batteryTechnology;
+ out->batteryCurrentAverageMicroamps = static_cast<int32_t>(in.batteryCurrentAverage);
+ out->diskStats.clear();
+ out->diskStats.resize(in.diskStats.size());
+ for (size_t i = 0; i < in.diskStats.size(); ++i)
+ if (!translate(in.diskStats[i], &out->diskStats[i])) return false;
+ out->storageInfos.clear();
+ out->storageInfos.resize(in.storageInfos.size());
+ for (size_t i = 0; i < in.storageInfos.size(); ++i)
+ if (!translate(in.storageInfos[i], &out->storageInfos[i])) return false;
+ return true;
+}
+__attribute__((warn_unused_result)) bool translate(
const ::android::hardware::health::V2_1::HealthInfo& in,
aidl::android::hardware::health::HealthInfo* out) {
- out->chargerAcOnline = static_cast<bool>(in.legacy.legacy.chargerAcOnline);
- out->chargerUsbOnline = static_cast<bool>(in.legacy.legacy.chargerUsbOnline);
- out->chargerWirelessOnline = static_cast<bool>(in.legacy.legacy.chargerWirelessOnline);
- out->maxChargingCurrentMicroamps = static_cast<int32_t>(in.legacy.legacy.maxChargingCurrent);
- out->maxChargingVoltageMicrovolts = static_cast<int32_t>(in.legacy.legacy.maxChargingVoltage);
- out->batteryStatus = static_cast<aidl::android::hardware::health::BatteryStatus>(
- in.legacy.legacy.batteryStatus);
- out->batteryHealth = static_cast<aidl::android::hardware::health::BatteryHealth>(
- in.legacy.legacy.batteryHealth);
- out->batteryPresent = static_cast<bool>(in.legacy.legacy.batteryPresent);
- out->batteryLevel = static_cast<int32_t>(in.legacy.legacy.batteryLevel);
- out->batteryVoltageMillivolts = static_cast<int32_t>(in.legacy.legacy.batteryVoltage);
- out->batteryTemperatureTenthsCelsius =
- static_cast<int32_t>(in.legacy.legacy.batteryTemperature);
- out->batteryCurrentMicroamps = static_cast<int32_t>(in.legacy.legacy.batteryCurrent);
- out->batteryCycleCount = static_cast<int32_t>(in.legacy.legacy.batteryCycleCount);
- out->batteryFullChargeUah = static_cast<int32_t>(in.legacy.legacy.batteryFullCharge);
- out->batteryChargeCounterUah = static_cast<int32_t>(in.legacy.legacy.batteryChargeCounter);
- out->batteryTechnology = in.legacy.legacy.batteryTechnology;
- out->batteryCurrentAverageMicroamps = static_cast<int32_t>(in.legacy.batteryCurrentAverage);
- out->diskStats.clear();
- out->diskStats.resize(in.legacy.diskStats.size());
- for (size_t i = 0; i < in.legacy.diskStats.size(); ++i)
- if (!translate(in.legacy.diskStats[i], &out->diskStats[i])) return false;
- out->storageInfos.clear();
- out->storageInfos.resize(in.legacy.storageInfos.size());
- for (size_t i = 0; i < in.legacy.storageInfos.size(); ++i)
- if (!translate(in.legacy.storageInfos[i], &out->storageInfos[i])) return false;
+ if (!translate(in.legacy, out)) return false;
out->batteryCapacityLevel = static_cast<aidl::android::hardware::health::BatteryCapacityLevel>(
in.batteryCapacityLevel);
out->batteryChargeTimeToFullNowSeconds =
diff --git a/health/aidl/include/android/hardware/health/translate-ndk.h b/health/aidl/include/android/hardware/health/translate-ndk.h
index 2f8fe04..91add42 100644
--- a/health/aidl/include/android/hardware/health/translate-ndk.h
+++ b/health/aidl/include/android/hardware/health/translate-ndk.h
@@ -33,6 +33,9 @@
const ::android::hardware::health::V2_0::DiskStats& in,
aidl::android::hardware::health::DiskStats* out);
__attribute__((warn_unused_result)) bool translate(
+ const ::android::hardware::health::V2_0::HealthInfo& in,
+ aidl::android::hardware::health::HealthInfo* out);
+__attribute__((warn_unused_result)) bool translate(
const ::android::hardware::health::V2_1::HealthInfo& in,
aidl::android::hardware::health::HealthInfo* out);
diff --git a/health/utils/libhealthshim/Android.bp b/health/utils/libhealthshim/Android.bp
new file mode 100644
index 0000000..311e951
--- /dev/null
+++ b/health/utils/libhealthshim/Android.bp
@@ -0,0 +1,78 @@
+// 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 {
+ // 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_defaults {
+ name: "libhealthshim_defaults",
+ host_supported: true, // for testing
+ defaults: [
+ "libbinder_ndk_host_user",
+ ],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+ static_libs: [
+ "android.hardware.health-V1-ndk",
+ "android.hardware.health-translate-ndk",
+ "android.hardware.health@1.0",
+ "android.hardware.health@2.0",
+ ],
+ shared_libs: [
+ // These can be expected from the device or from host.
+ "libbase",
+ "libbinder_ndk",
+ "libcutils",
+ "libhidlbase",
+ "liblog",
+ "libutils",
+ ],
+}
+
+// Shim library that wraps a HIDL IHealth object into an AIDL IHealth object.
+cc_library_static {
+ name: "libhealthshim",
+ defaults: ["libhealthshim_defaults"],
+ recovery_available: true,
+ srcs: [
+ "shim.cpp",
+ ],
+ export_include_dirs: [
+ "include",
+ ],
+}
+
+cc_test {
+ name: "libhealthshim_test",
+ defaults: ["libhealthshim_defaults"],
+ static_libs: [
+ "libhealthshim",
+ "libgmock",
+ ],
+ srcs: [
+ "test.cpp",
+ ],
+ test_suites: ["general-tests"],
+ test_options: {
+ unit_test: true,
+ },
+}
diff --git a/health/utils/libhealthshim/include/health-shim/shim.h b/health/utils/libhealthshim/include/health-shim/shim.h
new file mode 100644
index 0000000..f36fa5d
--- /dev/null
+++ b/health/utils/libhealthshim/include/health-shim/shim.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <map>
+
+#include <aidl/android/hardware/health/BnHealth.h>
+#include <android/hardware/health/2.0/IHealth.h>
+
+namespace aidl::android::hardware::health {
+
+// Shim that wraps HIDL IHealth with an AIDL BnHealth.
+// The wrapper always have isRemote() == false because it is BnHealth.
+class HealthShim : public BnHealth {
+ using HidlHealth = ::android::hardware::health::V2_0::IHealth;
+ using HidlHealthInfoCallback = ::android::hardware::health::V2_0::IHealthInfoCallback;
+
+ public:
+ explicit HealthShim(const ::android::sp<HidlHealth>& service);
+
+ ndk::ScopedAStatus registerCallback(
+ const std::shared_ptr<IHealthInfoCallback>& in_callback) override;
+ ndk::ScopedAStatus unregisterCallback(
+ const std::shared_ptr<IHealthInfoCallback>& in_callback) override;
+ ndk::ScopedAStatus update() override;
+ ndk::ScopedAStatus getChargeCounterUah(int32_t* _aidl_return) override;
+ ndk::ScopedAStatus getCurrentNowMicroamps(int32_t* _aidl_return) override;
+ ndk::ScopedAStatus getCurrentAverageMicroamps(int32_t* _aidl_return) override;
+ ndk::ScopedAStatus getCapacity(int32_t* _aidl_return) override;
+ ndk::ScopedAStatus getEnergyCounterNwh(int64_t* _aidl_return) override;
+ ndk::ScopedAStatus getChargeStatus(BatteryStatus* _aidl_return) override;
+ ndk::ScopedAStatus getStorageInfo(std::vector<StorageInfo>* _aidl_return) override;
+ ndk::ScopedAStatus getDiskStats(std::vector<DiskStats>* _aidl_return) override;
+ ndk::ScopedAStatus getHealthInfo(HealthInfo* _aidl_return) override;
+
+ private:
+ ::android::sp<HidlHealth> service_;
+ std::map<std::shared_ptr<IHealthInfoCallback>, ::android::sp<HidlHealthInfoCallback>>
+ callback_map_;
+};
+
+} // namespace aidl::android::hardware::health
diff --git a/health/utils/libhealthshim/shim.cpp b/health/utils/libhealthshim/shim.cpp
new file mode 100644
index 0000000..1329679
--- /dev/null
+++ b/health/utils/libhealthshim/shim.cpp
@@ -0,0 +1,220 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android-base/logging.h>
+#include <android/hardware/health/translate-ndk.h>
+#include <health-shim/shim.h>
+
+using ::android::sp;
+using ::android::h2a::translate;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::health::V2_0::Result;
+using ::android::hardware::health::V2_0::toString;
+using ::ndk::ScopedAStatus;
+using HidlHealth = ::android::hardware::health::V2_0::IHealth;
+using HidlHealthInfoCallback = ::android::hardware::health::V2_0::IHealthInfoCallback;
+using HidlHealthInfo = ::android::hardware::health::V2_0::HealthInfo;
+
+namespace aidl::android::hardware::health {
+
+namespace {
+
+class HealthInfoCallbackShim : public HidlHealthInfoCallback {
+ using AidlHealthInfoCallback = ::aidl::android::hardware::health::IHealthInfoCallback;
+ using AidlHealthInfo = ::aidl::android::hardware::health::HealthInfo;
+
+ public:
+ explicit HealthInfoCallbackShim(const std::shared_ptr<AidlHealthInfoCallback>& impl)
+ : impl_(impl) {}
+ Return<void> healthInfoChanged(const HidlHealthInfo& info) override {
+ AidlHealthInfo aidl_info;
+ // translate() should always return true.
+ CHECK(translate(info, &aidl_info));
+ // This is a oneway function, so we can't (and shouldn't) check for errors.
+ (void)impl_->healthInfoChanged(aidl_info);
+ return Void();
+ }
+
+ private:
+ std::shared_ptr<AidlHealthInfoCallback> impl_;
+};
+
+ScopedAStatus ResultToStatus(Result result) {
+ switch (result) {
+ case Result::SUCCESS:
+ return ScopedAStatus::ok();
+ case Result::NOT_SUPPORTED:
+ return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ case Result::UNKNOWN:
+ return ScopedAStatus::fromServiceSpecificError(IHealth::STATUS_UNKNOWN);
+ case Result::NOT_FOUND:
+ return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+ case Result::CALLBACK_DIED:
+ return ScopedAStatus::fromServiceSpecificError(IHealth::STATUS_CALLBACK_DIED);
+ }
+ return ScopedAStatus::fromServiceSpecificErrorWithMessage(
+ IHealth::STATUS_UNKNOWN, ("Unrecognized result value " + toString(result)).c_str());
+}
+
+template <typename T>
+ScopedAStatus ReturnAndResultToStatus(const Return<T>& ret, Result result) {
+ if (ret.isOk()) {
+ return ResultToStatus(result);
+ }
+ if (ret.isDeadObject()) {
+ return ScopedAStatus::fromStatus(STATUS_DEAD_OBJECT);
+ }
+ return ScopedAStatus::fromServiceSpecificErrorWithMessage(IHealth::STATUS_UNKNOWN,
+ ret.description().c_str());
+}
+
+ScopedAStatus ReturnResultToStatus(const Return<Result>& return_result) {
+ return ReturnAndResultToStatus(return_result, return_result.isOk()
+ ? static_cast<Result>(return_result)
+ : Result::UNKNOWN);
+}
+
+} // namespace
+
+HealthShim::HealthShim(const sp<HidlHealth>& service) : service_(service) {}
+
+ScopedAStatus HealthShim::registerCallback(
+ const std::shared_ptr<IHealthInfoCallback>& in_callback) {
+ sp<HidlHealthInfoCallback> shim(new HealthInfoCallbackShim(in_callback));
+ callback_map_.emplace(in_callback, shim);
+ return ReturnResultToStatus(service_->registerCallback(shim));
+}
+
+ScopedAStatus HealthShim::unregisterCallback(
+ const std::shared_ptr<IHealthInfoCallback>& in_callback) {
+ auto it = callback_map_.find(in_callback);
+ if (it == callback_map_.end()) {
+ return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+ }
+ sp<HidlHealthInfoCallback> shim = it->second;
+ callback_map_.erase(it);
+ return ReturnResultToStatus(service_->unregisterCallback(shim));
+}
+
+ScopedAStatus HealthShim::update() {
+ return ReturnResultToStatus(service_->update());
+}
+
+ScopedAStatus HealthShim::getChargeCounterUah(int32_t* out) {
+ Result out_result = Result::UNKNOWN;
+ auto ret = service_->getChargeCounter([out, &out_result](auto result, auto value) {
+ out_result = result;
+ if (out_result != Result::SUCCESS) return;
+ *out = value;
+ });
+ return ReturnAndResultToStatus(ret, out_result);
+}
+
+ScopedAStatus HealthShim::getCurrentNowMicroamps(int32_t* out) {
+ Result out_result = Result::UNKNOWN;
+ auto ret = service_->getCurrentNow([out, &out_result](auto result, auto value) {
+ out_result = result;
+ if (out_result != Result::SUCCESS) return;
+ *out = value;
+ });
+ return ReturnAndResultToStatus(ret, out_result);
+}
+
+ScopedAStatus HealthShim::getCurrentAverageMicroamps(int32_t* out) {
+ Result out_result = Result::UNKNOWN;
+ auto ret = service_->getCurrentAverage([out, &out_result](auto result, auto value) {
+ out_result = result;
+ if (out_result != Result::SUCCESS) return;
+ *out = value;
+ });
+ return ReturnAndResultToStatus(ret, out_result);
+}
+
+ScopedAStatus HealthShim::getCapacity(int32_t* out) {
+ Result out_result = Result::UNKNOWN;
+ auto ret = service_->getCapacity([out, &out_result](auto result, auto value) {
+ out_result = result;
+ if (out_result != Result::SUCCESS) return;
+ *out = value;
+ });
+ return ReturnAndResultToStatus(ret, out_result);
+}
+
+ScopedAStatus HealthShim::getEnergyCounterNwh(int64_t* out) {
+ Result out_result = Result::UNKNOWN;
+ auto ret = service_->getEnergyCounter([out, &out_result](auto result, auto value) {
+ out_result = result;
+ if (out_result != Result::SUCCESS) return;
+ *out = value;
+ });
+ return ReturnAndResultToStatus(ret, out_result);
+}
+
+ScopedAStatus HealthShim::getChargeStatus(BatteryStatus* out) {
+ Result out_result = Result::UNKNOWN;
+ auto ret = service_->getChargeStatus([out, &out_result](auto result, auto value) {
+ out_result = result;
+ if (out_result != Result::SUCCESS) return;
+ *out = static_cast<BatteryStatus>(value);
+ });
+ return ReturnAndResultToStatus(ret, out_result);
+}
+
+ScopedAStatus HealthShim::getStorageInfo(std::vector<StorageInfo>* out) {
+ Result out_result = Result::UNKNOWN;
+ auto ret = service_->getStorageInfo([out, &out_result](auto result, const auto& value) {
+ out_result = result;
+ if (out_result != Result::SUCCESS) return;
+ out->clear();
+ out->reserve(value.size());
+ for (const auto& hidl_info : value) {
+ auto& aidl_info = out->emplace_back();
+ // translate() should always return true.
+ CHECK(translate(hidl_info, &aidl_info));
+ }
+ });
+ return ReturnAndResultToStatus(ret, out_result);
+}
+
+ScopedAStatus HealthShim::getDiskStats(std::vector<DiskStats>* out) {
+ Result out_result = Result::UNKNOWN;
+ auto ret = service_->getDiskStats([out, &out_result](auto result, const auto& value) {
+ out_result = result;
+ if (out_result != Result::SUCCESS) return;
+ out->clear();
+ out->reserve(value.size());
+ for (const auto& hidl_info : value) {
+ auto& aidl_info = out->emplace_back();
+ // translate() should always return true.
+ CHECK(translate(hidl_info, &aidl_info));
+ }
+ });
+ return ReturnAndResultToStatus(ret, out_result);
+}
+
+ScopedAStatus HealthShim::getHealthInfo(HealthInfo* out) {
+ Result out_result = Result::UNKNOWN;
+ auto ret = service_->getHealthInfo([out, &out_result](auto result, const auto& value) {
+ out_result = result;
+ if (out_result != Result::SUCCESS) return;
+ // translate() should always return true.
+ CHECK(translate(value, out));
+ });
+ return ReturnAndResultToStatus(ret, out_result);
+}
+
+} // namespace aidl::android::hardware::health
diff --git a/health/utils/libhealthshim/test.cpp b/health/utils/libhealthshim/test.cpp
new file mode 100644
index 0000000..d1dfb8b
--- /dev/null
+++ b/health/utils/libhealthshim/test.cpp
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <health-shim/shim.h>
+
+#include <android/hardware/health/translate-ndk.h>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+using HidlHealth = android::hardware::health::V2_0::IHealth;
+using HidlHealthInfoCallback = android::hardware::health::V2_0::IHealthInfoCallback;
+using HidlStorageInfo = android::hardware::health::V2_0::StorageInfo;
+using HidlDiskStats = android::hardware::health::V2_0::DiskStats;
+using HidlHealthInfo = android::hardware::health::V2_0::HealthInfo;
+using HidlBatteryStatus = android::hardware::health::V1_0::BatteryStatus;
+using android::sp;
+using android::hardware::Return;
+using android::hardware::Void;
+using android::hardware::health::V2_0::Result;
+using ndk::SharedRefBase;
+using testing::Invoke;
+using testing::NiceMock;
+
+namespace aidl::android::hardware::health {
+MATCHER(IsOk, "") {
+ *result_listener << "status is " << arg.getDescription();
+ return arg.isOk();
+}
+
+MATCHER_P(ExceptionIs, exception_code, "") {
+ *result_listener << "status is " << arg.getDescription();
+ return arg.getExceptionCode() == exception_code;
+}
+
+class MockHidlHealth : public HidlHealth {
+ public:
+ MOCK_METHOD(Return<Result>, registerCallback, (const sp<HidlHealthInfoCallback>& callback),
+ (override));
+ MOCK_METHOD(Return<Result>, unregisterCallback, (const sp<HidlHealthInfoCallback>& callback),
+ (override));
+ MOCK_METHOD(Return<Result>, update, (), (override));
+ MOCK_METHOD(Return<void>, getChargeCounter, (getChargeCounter_cb _hidl_cb), (override));
+ MOCK_METHOD(Return<void>, getCurrentNow, (getCurrentNow_cb _hidl_cb), (override));
+ MOCK_METHOD(Return<void>, getCurrentAverage, (getCurrentAverage_cb _hidl_cb), (override));
+ MOCK_METHOD(Return<void>, getCapacity, (getCapacity_cb _hidl_cb), (override));
+ MOCK_METHOD(Return<void>, getEnergyCounter, (getEnergyCounter_cb _hidl_cb), (override));
+ MOCK_METHOD(Return<void>, getChargeStatus, (getChargeStatus_cb _hidl_cb), (override));
+ MOCK_METHOD(Return<void>, getStorageInfo, (getStorageInfo_cb _hidl_cb), (override));
+ MOCK_METHOD(Return<void>, getDiskStats, (getDiskStats_cb _hidl_cb), (override));
+ MOCK_METHOD(Return<void>, getHealthInfo, (getHealthInfo_cb _hidl_cb), (override));
+};
+
+class HealthShimTest : public ::testing::Test {
+ public:
+ void SetUp() override {
+ hidl = new NiceMock<MockHidlHealth>();
+ shim = SharedRefBase::make<HealthShim>(hidl);
+ }
+ sp<MockHidlHealth> hidl;
+ std::shared_ptr<IHealth> shim;
+};
+
+#define ADD_TEST(name, aidl_name, AidlValueType, hidl_value, not_supported_hidl_value) \
+ TEST_F(HealthShimTest, name) { \
+ ON_CALL(*hidl, name).WillByDefault(Invoke([](auto cb) { \
+ cb(Result::SUCCESS, hidl_value); \
+ return Void(); \
+ })); \
+ AidlValueType value; \
+ ASSERT_THAT(shim->aidl_name(&value), IsOk()); \
+ ASSERT_EQ(value, static_cast<AidlValueType>(hidl_value)); \
+ } \
+ \
+ TEST_F(HealthShimTest, name##Unsupported) { \
+ ON_CALL(*hidl, name).WillByDefault(Invoke([](auto cb) { \
+ cb(Result::NOT_SUPPORTED, not_supported_hidl_value); \
+ return Void(); \
+ })); \
+ AidlValueType value; \
+ ASSERT_THAT(shim->aidl_name(&value), ExceptionIs(EX_UNSUPPORTED_OPERATION)); \
+ }
+
+ADD_TEST(getChargeCounter, getChargeCounterUah, int32_t, 0xFEEDBEEF, 0)
+ADD_TEST(getCurrentNow, getCurrentNowMicroamps, int32_t, 0xC0FFEE, 0)
+ADD_TEST(getCurrentAverage, getCurrentAverageMicroamps, int32_t, 0xA2D401D, 0)
+ADD_TEST(getCapacity, getCapacity, int32_t, 77, 0)
+ADD_TEST(getEnergyCounter, getEnergyCounterNwh, int64_t, 0x1234567887654321, 0)
+ADD_TEST(getChargeStatus, getChargeStatus, BatteryStatus, HidlBatteryStatus::CHARGING,
+ HidlBatteryStatus::UNKNOWN)
+
+#undef ADD_TEST
+
+template <typename AidlValueType, typename HidlValueType>
+bool Translate(const HidlValueType& hidl_value, AidlValueType* aidl_value) {
+ return ::android::h2a::translate(hidl_value, aidl_value);
+}
+
+template <typename AidlValueType, typename HidlValueType>
+bool Translate(const std::vector<HidlValueType>& hidl_vec, std::vector<AidlValueType>* aidl_vec) {
+ aidl_vec->clear();
+ aidl_vec->reserve(hidl_vec.size());
+ for (const auto& hidl_value : hidl_vec) {
+ auto& aidl_value = aidl_vec->emplace_back();
+ if (!Translate(hidl_value, &aidl_value)) return false;
+ }
+ return true;
+}
+
+#define ADD_INFO_TEST(name, AidlValueType, hidl_value) \
+ TEST_F(HealthShimTest, name) { \
+ AidlValueType expected_aidl_value; \
+ ASSERT_TRUE(Translate(hidl_value, &expected_aidl_value)); \
+ ON_CALL(*hidl, name).WillByDefault(Invoke([&](auto cb) { \
+ cb(Result::SUCCESS, hidl_value); \
+ return Void(); \
+ })); \
+ AidlValueType aidl_value; \
+ ASSERT_THAT(shim->name(&aidl_value), IsOk()); \
+ ASSERT_EQ(aidl_value, expected_aidl_value); \
+ } \
+ \
+ TEST_F(HealthShimTest, name##Unsupported) { \
+ ON_CALL(*hidl, name).WillByDefault(Invoke([](auto cb) { \
+ cb(Result::NOT_SUPPORTED, {}); \
+ return Void(); \
+ })); \
+ AidlValueType aidl_value; \
+ ASSERT_THAT(shim->name(&aidl_value), ExceptionIs(EX_UNSUPPORTED_OPERATION)); \
+ }
+
+ADD_INFO_TEST(getStorageInfo, std::vector<StorageInfo>,
+ (std::vector<HidlStorageInfo>{{
+ .lifetimeA = 15,
+ .lifetimeB = 18,
+ }}))
+
+ADD_INFO_TEST(getDiskStats, std::vector<DiskStats>,
+ (std::vector<HidlDiskStats>{{
+ .reads = 100,
+ .writes = 200,
+ }}))
+
+ADD_INFO_TEST(getHealthInfo, HealthInfo,
+ (HidlHealthInfo{
+ .batteryCurrentAverage = 999,
+ }))
+
+#undef ADD_INFO_TEST
+
+} // namespace aidl::android::hardware::health
diff --git a/keymaster/4.0/vts/functional/Android.bp b/keymaster/4.0/vts/functional/Android.bp
index a7be660..8e5a0ff 100644
--- a/keymaster/4.0/vts/functional/Android.bp
+++ b/keymaster/4.0/vts/functional/Android.bp
@@ -41,6 +41,10 @@
"general-tests",
"vts",
],
+ sanitize: {
+ cfi: false,
+ },
+
}
cc_test_library {
diff --git a/radio/1.6/vts/functional/radio_hidl_hal_api.cpp b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
index c167a6d..9f530b3 100644
--- a/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
@@ -645,6 +645,10 @@
if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) {
ALOGI("Skipping emergencyDial because voice call is not supported in device");
return;
+ } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) &&
+ !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) {
+ ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device");
+ return;
} else {
ALOGI("Running emergencyDial because voice call is supported in device");
}
@@ -699,6 +703,10 @@
if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) {
ALOGI("Skipping emergencyDial because voice call is not supported in device");
return;
+ } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) &&
+ !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) {
+ ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device");
+ return;
} else {
ALOGI("Running emergencyDial because voice call is supported in device");
}
@@ -752,6 +760,10 @@
if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) {
ALOGI("Skipping emergencyDial because voice call is not supported in device");
return;
+ } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) &&
+ !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) {
+ ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device");
+ return;
} else {
ALOGI("Running emergencyDial because voice call is supported in device");
}
diff --git a/usb/1.0/default/Android.bp b/usb/1.0/default/Android.bp
index 5f56fe0..4bed2c7 100644
--- a/usb/1.0/default/Android.bp
+++ b/usb/1.0/default/Android.bp
@@ -21,11 +21,21 @@
default_applicable_licenses: ["hardware_interfaces_license"],
}
+filegroup {
+ name: "android.hardware.usb@1.0-service.xml",
+ srcs: ["android.hardware.usb@1.0-service.xml"],
+}
+
+filegroup {
+ name: "android.hardware.usb@1.0-service.rc",
+ srcs: ["android.hardware.usb@1.0-service.rc"],
+}
+
cc_binary {
name: "android.hardware.usb@1.0-service",
defaults: ["hidl_defaults"],
- init_rc: ["android.hardware.usb@1.0-service.rc"],
- vintf_fragments: ["android.hardware.usb@1.0-service.xml"],
+ init_rc: [":android.hardware.usb@1.0-service.rc"],
+ vintf_fragments: [":android.hardware.usb@1.0-service.xml"],
relative_install_path: "hw",
vendor: true,
srcs: [
diff --git a/usb/1.0/default/apex/Android.bp b/usb/1.0/default/apex/Android.bp
new file mode 100644
index 0000000..ee50fdf
--- /dev/null
+++ b/usb/1.0/default/apex/Android.bp
@@ -0,0 +1,59 @@
+// Copyright (C) 2021 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package {
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+apex_key {
+ name: "com.android.hardware.usb.key",
+ public_key: "com.android.hardware.usb.avbpubkey",
+ private_key: "com.android.hardware.usb.pem",
+}
+
+android_app_certificate {
+ name: "com.android.hardware.usb.certificate",
+ certificate: "com.android.hardware.usb",
+}
+
+genrule {
+ name: "com.android.hardware.usb.rc-gen",
+ srcs: [":android.hardware.usb@1.0-service.rc"],
+ out: ["com.android.hardware.usb.rc"],
+ cmd: "sed -E 's/\\/vendor/\\/apex\\/com.android.hardware.usb/' $(in) > $(out)",
+}
+
+prebuilt_etc {
+ name: "com.android.hardware.usb.rc",
+ src: ":com.android.hardware.usb.rc-gen",
+ installable: false,
+}
+
+apex {
+ name: "com.android.hardware.usb",
+ manifest: "manifest.json",
+ file_contexts: "file_contexts",
+ key: "com.android.hardware.usb.key",
+ certificate: ":com.android.hardware.usb.certificate",
+ updatable: false,
+ soc_specific: true,
+ use_vndk_as_stable: true,
+ binaries: ["android.hardware.usb@1.0-service"],
+ prebuilts: [
+ "com.android.hardware.usb.rc",
+ "android.hardware.usb.accessory.prebuilt.xml",
+ "android.hardware.usb.host.prebuilt.xml",
+ ],
+ vintf_fragments: [":android.hardware.usb@1.0-service.xml"],
+}
diff --git a/usb/1.0/default/apex/com.android.hardware.usb.avbpubkey b/usb/1.0/default/apex/com.android.hardware.usb.avbpubkey
new file mode 100644
index 0000000..0302d63
--- /dev/null
+++ b/usb/1.0/default/apex/com.android.hardware.usb.avbpubkey
Binary files differ
diff --git a/usb/1.0/default/apex/com.android.hardware.usb.pem b/usb/1.0/default/apex/com.android.hardware.usb.pem
new file mode 100644
index 0000000..e1e57da
--- /dev/null
+++ b/usb/1.0/default/apex/com.android.hardware.usb.pem
@@ -0,0 +1,51 @@
+-----BEGIN RSA PRIVATE KEY-----
+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
+-----END RSA PRIVATE KEY-----
diff --git a/usb/1.0/default/apex/com.android.hardware.usb.pk8 b/usb/1.0/default/apex/com.android.hardware.usb.pk8
new file mode 100644
index 0000000..9f3f39b
--- /dev/null
+++ b/usb/1.0/default/apex/com.android.hardware.usb.pk8
Binary files differ
diff --git a/usb/1.0/default/apex/com.android.hardware.usb.x509.pem b/usb/1.0/default/apex/com.android.hardware.usb.x509.pem
new file mode 100644
index 0000000..210c30d
--- /dev/null
+++ b/usb/1.0/default/apex/com.android.hardware.usb.x509.pem
@@ -0,0 +1,34 @@
+-----BEGIN CERTIFICATE-----
+MIIF1TCCA70CFFEdsyLGoTRk+VIzqb6aDl1tXeuZMA0GCSqGSIb3DQEBCwUAMIGl
+MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91
+bnRhaW4gVmlldzEQMA4GA1UECgwHQW5kcm9pZDEQMA4GA1UECwwHQW5kcm9pZDEi
+MCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTEhMB8GA1UEAwwYY29t
+LmFuZHJvaWQuaGFyZHdhcmUudXNiMCAXDTIxMTExNzIyMzAwM1oYDzQ3NTkxMDE0
+MjIzMDAzWjCBpTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAU
+BgNVBAcMDU1vdW50YWluIFZpZXcxEDAOBgNVBAoMB0FuZHJvaWQxEDAOBgNVBAsM
+B0FuZHJvaWQxIjAgBgkqhkiG9w0BCQEWE2FuZHJvaWRAYW5kcm9pZC5jb20xITAf
+BgNVBAMMGGNvbS5hbmRyb2lkLmhhcmR3YXJlLnVzYjCCAiIwDQYJKoZIhvcNAQEB
+BQADggIPADCCAgoCggIBAM2E0E9ubNU/or7r9UIcFrC4l7CeM0HwtwSjTUKV1Z9K
+7rPFoUPE3cQ+cResnWQay8IGnomLYptAIMe8sLCC83LwU1ucTihxX87qq2W3V14w
+U4AkqDzNvYqKiD3yz9WofKxcu7ut8+1O4Pvp11X8UXuy5kNzf8WGpGB04k6U6KtA
+q8+U8+4h9h1Uvhaa0AeG9Yp22LzRLTb3J+eCoGHJnjoXYsd9T/gvedyXKkuf0lWB
+b3Aor3/CQrpdCW2/iJbuASdBdfilpQShaagxy2wmQsYxnT8ZWf+tIDYjg3xqqVPl
+GChFwCQBdaTuLI/k9gbaXkSxuzRkp5wc/ELhYbkhIS25yefAF2C6num++AHQBh1+
+qO0fHztsK80c5cVoDPWu17/nP7y3QloRyLFUrL3hVW1RQaFwE2Hmv4H0UwVAsleU
+ZIsz2ifTjiSl/tnkFTx0I6BVk7T87QhO3WXN4v6VDYZKeD4gQYS0NfwplahejrFw
+s3EcwKgt6f0KlIpzoEQBmNQBXxsRgL31GWCwCszb7+VrTMzgUpO41R3PyewbeaZk
+S/SHyEOwyf0WIvnZhZ/5CNd9qirClu6jS8kdLvwC2qA25VqSPw126EX1e2xUqm02
+C/6c7JDVocuQhvsJOnnpZt68Iwgw9g/xLCLA9RszH9ccRctZqRnzHB1AjTrBOq0P
+AgMBAAEwDQYJKoZIhvcNAQELBQADggIBAELbSot2Io/JZIYLTxgeReI4lk1KUzf8
+fGlDNlRm+goxOHXWQgvXgiftwM9IOB+H+EtNHAA9Q6ojAmfRe6rZC4p0ZxWOamtR
+V+pQj0c6Zvx8HJPMQdyoHx538iNXM093s2wnf+QuACb3BnvkK7uuLGAlIzWdImtL
+DKKFN05nppViY04tGP5HgT57b7YGwdkEp6euCJcyWIKjlyEH/bwTWM8ws/Px6uhw
++5W2K7KrBsdRKPBF7qwXoS8Ak8pS5de9Xd7mbGBLaUtjsZ0pJbq0aFpuT0GbLWUm
+wiD5Ljq3ea/2GZxbHGiXQ2yNjFSd/jpuxDnnm99t7+HGw1v5Jld+hUVqXXfVNhWe
+hUKIv5TOk1nttNdsaLyDtxyt22JX7NnoPM0MqrkYwA8Xqrbv0VC8D/CVjiBC9Tce
+crhpCISNfQSkdEn/c+q/naFUvQy8oYqXkg1TjeGlcxwJOpGliYbbYT6VAwuI/ssI
+yX3Fkr8f5KhfN2aFnOpidknmLp9EyL2j5bxAtSD9xAHtczMn10uCUdLELjRB1L4f
+1qY+EjpIgK0NIFuEt9K5uZXirXq3K3eixKeJFNji3x/X8NgDALSdnT8JIlSg4DMg
+iWupLrQ9CSHMlgh5P43ALamiRIHQNqEwgj8OIGzsvQTSLbRjbPWYcDZa+Q1hosiA
+Fv7vjDI6oySM
+-----END CERTIFICATE-----
diff --git a/usb/1.0/default/apex/file_contexts b/usb/1.0/default/apex/file_contexts
new file mode 100644
index 0000000..bc84ac4
--- /dev/null
+++ b/usb/1.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\.usb@1\.0-service u:object_r:hal_usb_default_exec:s0
\ No newline at end of file
diff --git a/usb/1.0/default/apex/manifest.json b/usb/1.0/default/apex/manifest.json
new file mode 100644
index 0000000..6a1095f
--- /dev/null
+++ b/usb/1.0/default/apex/manifest.json
@@ -0,0 +1,4 @@
+{
+ "name": "com.android.hardware.usb",
+ "version": 1
+}
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbAndroidCapabilities.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbAndroidCapabilities.aidl
index 774133e..7e3be56 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbAndroidCapabilities.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbAndroidCapabilities.aidl
@@ -35,4 +35,5 @@
@Backing(type="long") @VintfStability
enum UwbAndroidCapabilities {
POWER_STATS_QUERY = 1,
+ ANTENNAE_INTERLEAVING = 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/UwbVendorSessionSetAppConfigCmdParams.aidl
index 37b7efb..f449c60 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/UwbVendorSessionSetAppConfigCmdParams.aidl
@@ -38,4 +38,7 @@
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,
}
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbAndroidCapabilities.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbAndroidCapabilities.aidl
index 3486d5a..0af99e0 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbAndroidCapabilities.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbAndroidCapabilities.aidl
@@ -26,6 +26,6 @@
@VintfStability
@Backing(type="long")
enum UwbAndroidCapabilities {
- /** TODO: Change the name if necessary when the corresponding vendor commands are added */
POWER_STATS_QUERY = 0x1,
+ ANTENNAE_INTERLEAVING = 0x2,
}
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl
index 850e2da..f5e02c0 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionSetAppConfigCmdParams.aidl
@@ -29,9 +29,29 @@
enum UwbVendorSessionSetAppConfigCmdParams {
/** CCC params for ranging start */
- /** Added in vendor version 0. */
+ /**
+ * Added in vendor version 0.
+ * Range 0xA0 - 0xDF reserved for CCC use.
+ */
CCC_RANGING_PROTOCOL_VER = 0xA3,
CCC_UWB_CONFIG_ID = 0xA4,
CCC_PULSESHAPE_COMBO = 0xA5,
CCC_URSK_TTL = 0xA6,
+
+ /**
+ * Range 0xE3 - 0xFF is reserved for proprietary use in the FIRA spec.
+ * In Android, this range is reserved by the Android platform for Android-specific
+ * app config cmd params.
+ * Vendors must not define additional app config cmd params in this range.
+ */
+
+ /**
+ * Added in vendor version 0.
+ * Interleaving ratio if AOA_RESULT_REQ is set to 0xF0.
+ * Supported only if the value returned by getSupportedAndroidCapabilities()
+ * has the bit of UwbAndroidCapabilities.ANTENNAE_INTERLEAVING set to 1.
+ */
+ NB_OF_RANGE_MEASUREMENTS = 0xE3,
+ NB_OF_AZIMUTH_MEASUREMENTS = 0xE4,
+ NB_OF_ELEVATION_MEASUREMENTS = 0xE5,
}