Merge "Clarify getHardwareInfo() beavhior"
diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp b/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
index 54e82d1..8090d26 100644
--- a/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
+++ b/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
@@ -131,6 +131,8 @@
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
LOG(INFO) << __func__ << " - allowed " << allowed;
+ BluetoothAudioSessionReport::ReportLowLatencyModeAllowedChanged(
+ session_type_, allowed);
return ndk::ScopedAStatus::ok();
}
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp
index dd29011..967b6f3 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp
@@ -416,6 +416,22 @@
}
}
+void BluetoothAudioSession::ReportLowLatencyModeAllowedChanged(bool allowed) {
+ std::lock_guard<std::recursive_mutex> guard(mutex_);
+ if (observers_.empty()) {
+ LOG(WARNING) << __func__ << " - SessionType=" << toString(session_type_)
+ << " has NO port state observer";
+ return;
+ }
+ for (auto& observer : observers_) {
+ uint16_t cookie = observer.first;
+ std::shared_ptr<PortStatusCallbacks> callback = observer.second;
+ LOG(INFO) << __func__ << " - allowed="
+ << allowed ? " allowed" : " disallowed";
+ callback->low_latency_mode_allowed_cb_(cookie, allowed);
+ }
+}
+
bool BluetoothAudioSession::GetPresentationPosition(
PresentationPosition& presentation_position) {
std::lock_guard<std::recursive_mutex> guard(mutex_);
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h
index 5adc0e2..7725331 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h
@@ -92,6 +92,15 @@
* @param: cookie - indicates which bluetooth_audio output should handle
***/
std::function<void(uint16_t cookie)> audio_configuration_changed_cb_;
+ /***
+ * low_latency_mode_allowed_cb_ - when the Bluetooth stack low latency mode
+ * allowed or disallowed, the BluetoothAudioProvider will invoke
+ * this callback to report to the bluetooth_audio module.
+ * @param: cookie - indicates which bluetooth_audio output should handle
+ * @param: allowed - indicates if low latency mode is allowed
+ ***/
+ std::function<void(uint16_t cookie, bool allowed)>
+ low_latency_mode_allowed_cb_;
};
class BluetoothAudioSession {
@@ -156,6 +165,13 @@
void ReportAudioConfigChanged(const AudioConfiguration& audio_config);
/***
+ * The report function is used to report that the Bluetooth stack has notified
+ * the low latency mode allowed changed, and will invoke
+ * low_latency_mode_allowed_changed_cb to notify registered bluetooth_audio
+ * outputs
+ ***/
+ void ReportLowLatencyModeAllowedChanged(bool allowed);
+ /***
* Those control functions are for the bluetooth_audio module to start,
* suspend, stop stream, to check position, and to update metadata.
***/
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionReport.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionReport.h
index 18569c3..03776b5 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionReport.h
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionReport.h
@@ -78,6 +78,18 @@
session_ptr->ReportAudioConfigChanged(audio_config);
}
}
+ /***
+ * The API reports the Bluetooth stack has replied the changed of the low
+ * latency audio allowed, and will inform registered bluetooth_audio outputs
+ ***/
+ static void ReportLowLatencyModeAllowedChanged(
+ const SessionType& session_type, bool allowed) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ session_ptr->ReportLowLatencyModeAllowedChanged(allowed);
+ }
+ }
};
} // namespace audio
diff --git a/camera/common/aidl/Android.bp b/camera/common/aidl/Android.bp
index eca70aa..39857ef 100644
--- a/camera/common/aidl/Android.bp
+++ b/camera/common/aidl/Android.bp
@@ -1,3 +1,12 @@
+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.camera.common",
vendor_available: true,
diff --git a/camera/device/aidl/Android.bp b/camera/device/aidl/Android.bp
index b6cbea4..b6f4c58 100644
--- a/camera/device/aidl/Android.bp
+++ b/camera/device/aidl/Android.bp
@@ -1,3 +1,12 @@
+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.camera.device",
vendor_available: true,
diff --git a/camera/metadata/aidl/Android.bp b/camera/metadata/aidl/Android.bp
index 05f280c..c5f16e6 100644
--- a/camera/metadata/aidl/Android.bp
+++ b/camera/metadata/aidl/Android.bp
@@ -1,3 +1,12 @@
+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.camera.metadata",
vendor_available: true,
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 18b3885..2390f9d 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -222,10 +222,6 @@
<name>android.hardware.drm</name>
<version>1</version>
<interface>
- <name>ICryptoFactory</name>
- <regex-instance>.*</regex-instance>
- </interface>
- <interface>
<name>IDrmFactory</name>
<regex-instance>.*</regex-instance>
</interface>
@@ -833,14 +829,6 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.wifi.hostapd</name>
- <version>1.0-3</version>
- <interface>
- <name>IHostapd</name>
- <instance>default</instance>
- </interface>
- </hal>
<hal format="aidl" optional="true">
<name>android.hardware.wifi.hostapd</name>
<version>1</version>
@@ -849,14 +837,6 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.wifi.supplicant</name>
- <version>1.2-4</version>
- <interface>
- <name>ISupplicant</name>
- <instance>default</instance>
- </interface>
- </hal>
<hal format="aidl" optional="true">
<name>android.hardware.wifi.supplicant</name>
<interface>
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/BufferType.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/BufferType.aidl
deleted file mode 100644
index b6ec34d..0000000
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/BufferType.aidl
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// 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.drm;
-@Backing(type="int") @VintfStability
-enum BufferType {
- SHARED_MEMORY = 0,
- NATIVE_HANDLE = 1,
-}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/CryptoSchemes.aidl
similarity index 87%
rename from drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl
rename to drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/CryptoSchemes.aidl
index d2b48d2..ea736cf 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/CryptoSchemes.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.
@@ -33,7 +33,9 @@
package android.hardware.drm;
@VintfStability
-parcelable DecryptResult {
- int bytesWritten;
- String detailedError;
+parcelable CryptoSchemes {
+ List<android.hardware.drm.Uuid> uuids;
+ android.hardware.drm.SecurityLevel minLevel;
+ android.hardware.drm.SecurityLevel maxLevel;
+ List<String> mimeTypes;
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoFactory.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptArgs.aidl
similarity index 82%
rename from drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoFactory.aidl
rename to drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptArgs.aidl
index 0d4296e..9c574a4 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoFactory.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptArgs.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.
@@ -33,7 +33,14 @@
package android.hardware.drm;
@VintfStability
-interface ICryptoFactory {
- @nullable android.hardware.drm.ICryptoPlugin createPlugin(in android.hardware.drm.Uuid uuid, in byte[] initData);
- boolean isCryptoSchemeSupported(in android.hardware.drm.Uuid uuid);
+parcelable DecryptArgs {
+ boolean secure;
+ byte[] keyId;
+ byte[] iv;
+ android.hardware.drm.Mode mode;
+ android.hardware.drm.Pattern pattern;
+ android.hardware.drm.SubSample[] subSamples;
+ android.hardware.drm.SharedBuffer source;
+ long offset;
+ android.hardware.drm.DestinationBuffer destination;
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DestinationBuffer.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DestinationBuffer.aidl
index 4f2d133..8c3ba7d 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DestinationBuffer.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DestinationBuffer.aidl
@@ -33,8 +33,7 @@
package android.hardware.drm;
@VintfStability
-parcelable DestinationBuffer {
- android.hardware.drm.BufferType type;
+union DestinationBuffer {
android.hardware.drm.SharedBuffer nonsecureMemory;
android.hardware.common.NativeHandle secureMemory;
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoPlugin.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoPlugin.aidl
index 2224795..31c45e0 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoPlugin.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoPlugin.aidl
@@ -34,10 +34,10 @@
package android.hardware.drm;
@VintfStability
interface ICryptoPlugin {
- android.hardware.drm.DecryptResult decrypt(in boolean secure, in byte[] keyId, in byte[] iv, in android.hardware.drm.Mode mode, in android.hardware.drm.Pattern pattern, in android.hardware.drm.SubSample[] subSamples, in android.hardware.drm.SharedBuffer source, in long offset, in android.hardware.drm.DestinationBuffer destination);
+ int decrypt(in android.hardware.drm.DecryptArgs args);
List<android.hardware.drm.LogMessage> getLogMessages();
void notifyResolution(in int width, in int height);
boolean requiresSecureDecoderComponent(in String mime);
void setMediaDrmSession(in byte[] sessionId);
- void setSharedBufferBase(in android.hardware.common.Ashmem base, in int bufferId);
+ void setSharedBufferBase(in android.hardware.drm.SharedBuffer base);
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmFactory.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmFactory.aidl
index af48737..82efbb7 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmFactory.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmFactory.aidl
@@ -34,8 +34,7 @@
package android.hardware.drm;
@VintfStability
interface IDrmFactory {
- @nullable android.hardware.drm.IDrmPlugin createPlugin(in android.hardware.drm.Uuid uuid, in String appPackageName);
- List<android.hardware.drm.Uuid> getSupportedCryptoSchemes();
- boolean isContentTypeSupported(in String mimeType);
- boolean isCryptoSchemeSupported(in android.hardware.drm.Uuid uuid, in String mimeType, in android.hardware.drm.SecurityLevel securityLevel);
+ @nullable android.hardware.drm.IDrmPlugin createDrmPlugin(in android.hardware.drm.Uuid uuid, in String appPackageName);
+ @nullable android.hardware.drm.ICryptoPlugin createCryptoPlugin(in android.hardware.drm.Uuid uuid, in byte[] initData);
+ android.hardware.drm.CryptoSchemes getSupportedCryptoSchemes();
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmPlugin.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmPlugin.aidl
index 5f839d7..ae10062 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmPlugin.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmPlugin.aidl
@@ -63,7 +63,6 @@
void removeOfflineLicense(in android.hardware.drm.KeySetId keySetId);
void removeSecureStop(in android.hardware.drm.SecureStopId secureStopId);
boolean requiresSecureDecoder(in String mime, in android.hardware.drm.SecurityLevel level);
- boolean requiresSecureDecoderDefault(in String mime);
void restoreKeys(in byte[] sessionId, in android.hardware.drm.KeySetId keySetId);
void setCipherAlgorithm(in byte[] sessionId, in String algorithm);
void setListener(in android.hardware.drm.IDrmPluginListener listener);
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatusType.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatusType.aidl
index e88d388..261516f 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatusType.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatusType.aidl
@@ -36,8 +36,8 @@
enum KeyStatusType {
USABLE = 0,
EXPIRED = 1,
- OUTPUTNOTALLOWED = 2,
- STATUSPENDING = 3,
- INTERNALERROR = 4,
- USABLEINFUTURE = 5,
+ OUTPUT_NOT_ALLOWED = 2,
+ STATUS_PENDING = 3,
+ INTERNAL_ERROR = 4,
+ USABLE_IN_FUTURE = 5,
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SharedBuffer.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SharedBuffer.aidl
index 973ef0d..314fe7c 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SharedBuffer.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SharedBuffer.aidl
@@ -37,4 +37,5 @@
int bufferId;
long offset;
long size;
+ android.hardware.common.NativeHandle handle;
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Uuid.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Uuid.aidl
index ec2eb16..3c2cfa20 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Uuid.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Uuid.aidl
@@ -34,5 +34,5 @@
package android.hardware.drm;
@VintfStability
parcelable Uuid {
- byte[] uuid;
+ byte[16] uuid;
}
diff --git a/drm/aidl/android/hardware/drm/BufferType.aidl b/drm/aidl/android/hardware/drm/BufferType.aidl
deleted file mode 100644
index 089c950..0000000
--- a/drm/aidl/android/hardware/drm/BufferType.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.drm;
-
-@VintfStability
-@Backing(type="int")
-enum BufferType {
- SHARED_MEMORY = 0,
- NATIVE_HANDLE = 1,
-}
diff --git a/drm/aidl/android/hardware/drm/CryptoSchemes.aidl b/drm/aidl/android/hardware/drm/CryptoSchemes.aidl
new file mode 100644
index 0000000..b4b34ec
--- /dev/null
+++ b/drm/aidl/android/hardware/drm/CryptoSchemes.aidl
@@ -0,0 +1,45 @@
+/*
+ * 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.drm;
+
+import android.hardware.drm.SecurityLevel;
+import android.hardware.drm.Uuid;
+
+@VintfStability
+parcelable CryptoSchemes {
+
+ /**
+ * Supported crypto schemes
+ */
+ List<Uuid> uuids;
+
+ /**
+ * Minimum supported security level (inclusive)
+ */
+ SecurityLevel minLevel;
+
+ /**
+ * Maximum supported security level (inclusive)
+ */
+ SecurityLevel maxLevel;
+
+ /**
+ * Supported mime types
+ */
+ List<String> mimeTypes;
+
+}
diff --git a/drm/aidl/android/hardware/drm/DecryptArgs.aidl b/drm/aidl/android/hardware/drm/DecryptArgs.aidl
new file mode 100644
index 0000000..5ec1b71
--- /dev/null
+++ b/drm/aidl/android/hardware/drm/DecryptArgs.aidl
@@ -0,0 +1,87 @@
+/*
+ * 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.drm;
+
+import android.hardware.drm.DestinationBuffer;
+import android.hardware.drm.KeyStatusType;
+import android.hardware.drm.Mode;
+import android.hardware.drm.Pattern;
+import android.hardware.drm.SharedBuffer;
+import android.hardware.drm.SubSample;
+
+/**
+ * Arguments to ICryptoPlugin decrypt
+ */
+@VintfStability
+parcelable DecryptArgs {
+
+ /**
+ * A flag to indicate if a secure decoder is being used.
+ *
+ * This enables the plugin to configure buffer modes to work consistently
+ * with a secure decoder.
+ */
+ boolean secure;
+
+ /**
+ * The keyId for the key that is used to do the decryption.
+ *
+ * The keyId refers to a key in the associated MediaDrm instance.
+ */
+ byte[] keyId;
+
+ /**
+ * The initialization vector
+ */
+ byte[] iv;
+
+ /**
+ * Crypto mode
+ */
+ Mode mode;
+
+ /**
+ * Crypto pattern
+ */
+ Pattern pattern;
+
+ /**
+ * A vector of subsamples indicating the number of clear and encrypted
+ * bytes to process.
+ *
+ * This allows the decrypt call to operate on a range of subsamples in a
+ * single call
+ */
+ SubSample[] subSamples;
+
+ /**
+ * Input buffer for the decryption
+ */
+ SharedBuffer source;
+
+ /**
+ * The offset of the first byte of encrypted data from the base of the
+ * source buffer
+ */
+ long offset;
+
+ /**
+ * Output buffer for the decryption
+ */
+ DestinationBuffer destination;
+
+}
diff --git a/drm/aidl/android/hardware/drm/DecryptResult.aidl b/drm/aidl/android/hardware/drm/DecryptResult.aidl
deleted file mode 100644
index 17e939b..0000000
--- a/drm/aidl/android/hardware/drm/DecryptResult.aidl
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.drm;
-
-/**
- * The DecryptResult parcelable contains the result of
- * ICryptoPlugin decrypt method.
- */
-@VintfStability
-parcelable DecryptResult {
- /** The number of decrypted bytes. */
- int bytesWritten;
-
- /**
- * Vendor-specific error message if provided by the vendor's
- * crypto HAL.
- */
- String detailedError;
-}
diff --git a/drm/aidl/android/hardware/drm/DestinationBuffer.aidl b/drm/aidl/android/hardware/drm/DestinationBuffer.aidl
index 0f1e3f5..7fc61e1 100644
--- a/drm/aidl/android/hardware/drm/DestinationBuffer.aidl
+++ b/drm/aidl/android/hardware/drm/DestinationBuffer.aidl
@@ -17,29 +17,24 @@
package android.hardware.drm;
import android.hardware.common.NativeHandle;
-import android.hardware.drm.BufferType;
import android.hardware.drm.SharedBuffer;
/**
* A decrypt destination buffer can be either normal user-space shared
* memory for the non-secure decrypt case, or it can be a secure buffer
- * which is referenced by a native-handle. The native handle is allocated
- * by the vendor's buffer allocator.
+ * which is referenced by a native-handle.
+ *
+ * The native handle is allocated by the vendor's buffer allocator.
*/
@VintfStability
-parcelable DestinationBuffer {
+union DestinationBuffer {
/**
- * The type of the buffer
- */
- BufferType type;
- /**
- * If type == SHARED_MEMORY, the decrypted data must be written
- * to user-space non-secure shared memory.
+ * decrypted data written to user-space non-secure shared memory.
*/
SharedBuffer nonsecureMemory;
/**
- * If type == NATIVE_HANDLE, the decrypted data must be written
- * to secure memory referenced by the vendor's buffer allocator.
+ * decrypted data written to secure memory referenced by the vendor's
+ * buffer allocator.
*/
NativeHandle secureMemory;
}
diff --git a/drm/aidl/android/hardware/drm/ICryptoFactory.aidl b/drm/aidl/android/hardware/drm/ICryptoFactory.aidl
deleted file mode 100644
index 202bd3d..0000000
--- a/drm/aidl/android/hardware/drm/ICryptoFactory.aidl
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.drm;
-
-import android.hardware.drm.Uuid;
-
-/**
- * ICryptoFactory is the main entry point for interacting with a vendor's
- * crypto HAL to create crypto plugins.
-
- * Crypto plugins create crypto sessions which are used by a codec to decrypt
- * protected video content.
- */
-@VintfStability
-interface ICryptoFactory {
- /**
- * Create a crypto plugin for the specified uuid and scheme-specific
- * initialization data.
- *
- * @param uuid uniquely identifies the drm scheme. See
- * http://dashif.org/identifiers/protection for uuid assignments
- *
- * @param initData scheme-specific init data.
- *
- * @return A crypto plugin instance if successful, or null if not created.
- */
- @nullable android.hardware.drm.ICryptoPlugin createPlugin(
- in Uuid uuid, in byte[] initData);
-
- /**
- * Determine if a crypto scheme is supported by this HAL.
- *
- * @param uuid identifies the crypto scheme in question
- * @return must be true only if the scheme is supported
- */
- boolean isCryptoSchemeSupported(in Uuid uuid);
-}
diff --git a/drm/aidl/android/hardware/drm/ICryptoPlugin.aidl b/drm/aidl/android/hardware/drm/ICryptoPlugin.aidl
index 80a63df..d344b62 100644
--- a/drm/aidl/android/hardware/drm/ICryptoPlugin.aidl
+++ b/drm/aidl/android/hardware/drm/ICryptoPlugin.aidl
@@ -17,7 +17,7 @@
package android.hardware.drm;
import android.hardware.common.Ashmem;
-import android.hardware.drm.DecryptResult;
+import android.hardware.drm.DecryptArgs;
import android.hardware.drm.DestinationBuffer;
import android.hardware.drm.LogMessage;
import android.hardware.drm.Mode;
@@ -38,23 +38,7 @@
* Decrypt an array of subsamples from the source memory buffer to the
* destination memory buffer.
*
- * @param secure a flag to indicate if a secure decoder is being used.
- * This enables the plugin to configure buffer modes to work
- * consistently with a secure decoder.
- * @param the keyId for the key that is used to do the decryption. The
- * keyId refers to a key in the associated MediaDrm instance.
- * @param iv the initialization vector to use
- * @param mode the crypto mode to use
- * @param pattern the crypto pattern to use
- * @param subSamples a vector of subsamples indicating the number
- * of clear and encrypted bytes to process. This allows the decrypt
- * call to operate on a range of subsamples in a single call
- * @param source the input buffer for the decryption
- * @param offset the offset of the first byte of encrypted data from
- * the base of the source buffer
- * @param destination the output buffer for the decryption
- *
- * @return DecryptResult parcelable
+ * @return number of decrypted bytes
* Implicit error codes:
* + ERROR_DRM_CANNOT_HANDLE in other failure cases
* + ERROR_DRM_DECRYPT if the decrypt operation fails
@@ -74,9 +58,7 @@
* + ERROR_DRM_SESSION_NOT_OPENED if the decrypt session is not
* opened
*/
- DecryptResult decrypt(in boolean secure, in byte[] keyId, in byte[] iv, in Mode mode,
- in Pattern pattern, in SubSample[] subSamples, in SharedBuffer source, in long offset,
- in DestinationBuffer destination);
+ int decrypt(in DecryptArgs args);
/**
* Get OEMCrypto or plugin error messages.
@@ -129,10 +111,8 @@
* There can be multiple shared buffers per crypto plugin. The buffers
* are distinguished by the bufferId.
*
- * @param base the base of the memory buffer identified by
- * bufferId
- * @param bufferId identifies the specific shared buffer for which
- * the base is being set.
+ * @param base the base of the memory buffer abstracted by
+ * SharedBuffer parcelable (bufferId, size, handle)
*/
- void setSharedBufferBase(in Ashmem base, in int bufferId);
+ void setSharedBufferBase(in SharedBuffer base);
}
diff --git a/drm/aidl/android/hardware/drm/IDrmFactory.aidl b/drm/aidl/android/hardware/drm/IDrmFactory.aidl
index b9622a4..86c3f21 100644
--- a/drm/aidl/android/hardware/drm/IDrmFactory.aidl
+++ b/drm/aidl/android/hardware/drm/IDrmFactory.aidl
@@ -16,6 +16,7 @@
package android.hardware.drm;
+import android.hardware.drm.CryptoSchemes;
import android.hardware.drm.SecurityLevel;
import android.hardware.drm.Uuid;
@@ -40,37 +41,30 @@
* Implicit error codes:
* + ERROR_DRM_CANNOT_HANDLE if the plugin cannot be created.
*/
- @nullable android.hardware.drm.IDrmPlugin createPlugin(
+ @nullable android.hardware.drm.IDrmPlugin createDrmPlugin(
in Uuid uuid, in String appPackageName);
/**
+ * Create a crypto plugin for the specified uuid and scheme-specific
+ * initialization data.
+ *
+ * @param uuid uniquely identifies the drm scheme. See
+ * http://dashif.org/identifiers/protection for uuid assignments
+ *
+ * @param initData scheme-specific init data.
+ *
+ * @return A crypto plugin instance if successful, or null if not created.
+ */
+ @nullable android.hardware.drm.ICryptoPlugin createCryptoPlugin(
+ in Uuid uuid, in byte[] initData);
+
+ /**
* Return vector of uuids identifying crypto schemes supported by
* this HAL.
*
* @return List of uuids for which isCryptoSchemeSupported is true;
* each uuid can be used as input to createPlugin.
*/
- List<Uuid> getSupportedCryptoSchemes();
+ CryptoSchemes getSupportedCryptoSchemes();
- /**
- * Determine if the HAL factory is able to construct plugins that
- * support a given media container format specified by mimeType
- *
- * @param mimeType identifies the mime type in question
- *
- * @return must be true only if the scheme is supported
- */
- boolean isContentTypeSupported(in String mimeType);
-
- /**
- * Determine if a specific security level is supported by the device.
- *
- * @param uuid identifies the crypto scheme in question
- * @param mimeType identifies the mime type in question
- * @param securityLevel specifies the security level required
- *
- * @return must be true only if the scheme is supported
- */
- boolean isCryptoSchemeSupported(
- in Uuid uuid, in String mimeType, in SecurityLevel securityLevel);
}
diff --git a/drm/aidl/android/hardware/drm/IDrmPlugin.aidl b/drm/aidl/android/hardware/drm/IDrmPlugin.aidl
index e649f26..11ca8b6 100644
--- a/drm/aidl/android/hardware/drm/IDrmPlugin.aidl
+++ b/drm/aidl/android/hardware/drm/IDrmPlugin.aidl
@@ -577,17 +577,6 @@
boolean requiresSecureDecoder(in String mime, in SecurityLevel level);
/**
- * Check if the specified mime-type requires a secure decoder component
- * at the highest security level supported on the device.
- *
- * @param mime The content mime-type
- *
- * @return must be true if and only if a secure decoder is required
- * for the specified mime-type
- */
- boolean requiresSecureDecoderDefault(in String mime);
-
- /**
* Restore persisted offline keys into a new session
*
* @param sessionId the session id the call applies to
diff --git a/drm/aidl/android/hardware/drm/KeyStatusType.aidl b/drm/aidl/android/hardware/drm/KeyStatusType.aidl
index 6902d87..6c3c6a2 100644
--- a/drm/aidl/android/hardware/drm/KeyStatusType.aidl
+++ b/drm/aidl/android/hardware/drm/KeyStatusType.aidl
@@ -32,20 +32,20 @@
* The key is not currently usable to decrypt media data because its output
* requirements cannot currently be met.
*/
- OUTPUTNOTALLOWED,
+ OUTPUT_NOT_ALLOWED,
/**
* The status of the key is not yet known and is being determined.
*/
- STATUSPENDING,
+ STATUS_PENDING,
/**
* The key is not currently usable to decrypt media data because of an
* internal error in processing unrelated to input parameters.
*/
- INTERNALERROR,
+ INTERNAL_ERROR,
/**
* The key is not yet usable to decrypt media because the start
* time is in the future. The key must become usable when
* its start time is reached.
*/
- USABLEINFUTURE,
+ USABLE_IN_FUTURE,
}
diff --git a/drm/aidl/android/hardware/drm/SharedBuffer.aidl b/drm/aidl/android/hardware/drm/SharedBuffer.aidl
index 6977284..2b2610f 100644
--- a/drm/aidl/android/hardware/drm/SharedBuffer.aidl
+++ b/drm/aidl/android/hardware/drm/SharedBuffer.aidl
@@ -16,6 +16,8 @@
package android.hardware.drm;
+import android.hardware.common.NativeHandle;
+
/**
* SharedBuffer describes a decrypt buffer which is defined by a bufferId, an
* offset and a size. The offset is relative to the shared memory base for the
@@ -36,4 +38,8 @@
* The size of the shared buffer in bytes
*/
long size;
+ /**
+ * Handle to shared memory
+ */
+ NativeHandle handle;
}
diff --git a/drm/aidl/android/hardware/drm/Uuid.aidl b/drm/aidl/android/hardware/drm/Uuid.aidl
index b36c409..db5a70d 100644
--- a/drm/aidl/android/hardware/drm/Uuid.aidl
+++ b/drm/aidl/android/hardware/drm/Uuid.aidl
@@ -18,5 +18,5 @@
@VintfStability
parcelable Uuid {
- byte[] uuid;
+ byte[16] uuid;
}
diff --git a/drm/aidl/vts/Android.bp b/drm/aidl/vts/Android.bp
index 5b41830..190f60d 100644
--- a/drm/aidl/vts/Android.bp
+++ b/drm/aidl/vts/Android.bp
@@ -49,6 +49,8 @@
"android.hardware.drm@1.0-helper",
"android.hardware.drm-V1-ndk",
"android.hardware.common-V2-ndk",
+ "libaidlcommonsupport",
+ "libgmock_ndk",
"libdrmvtshelper",
"libvtsclearkey",
],
diff --git a/drm/aidl/vts/drm_hal_common.cpp b/drm/aidl/vts/drm_hal_common.cpp
index 751c25b..9b315f4 100644
--- a/drm/aidl/vts/drm_hal_common.cpp
+++ b/drm/aidl/vts/drm_hal_common.cpp
@@ -22,9 +22,11 @@
#include <sys/mman.h>
#include <random>
+#include <aidlcommonsupport/NativeHandle.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <android/sharedmem.h>
+#include <cutils/native_handle.h>
#include "drm_hal_clearkey_module.h"
#include "drm_hal_common.h"
@@ -39,8 +41,7 @@
using std::vector;
using ::aidl::android::hardware::common::Ashmem;
-using ::aidl::android::hardware::drm::BufferType;
-using ::aidl::android::hardware::drm::DecryptResult;
+using ::aidl::android::hardware::drm::DecryptArgs;
using ::aidl::android::hardware::drm::DestinationBuffer;
using ::aidl::android::hardware::drm::EventType;
using ::aidl::android::hardware::drm::ICryptoPlugin;
@@ -72,7 +73,6 @@
}
const char* kDrmIface = "android.hardware.drm.IDrmFactory";
-const char* kCryptoIface = "android.hardware.drm.ICryptoFactory";
std::string HalFullName(const std::string& iface, const std::string& basename) {
return iface + '/' + basename;
@@ -184,7 +184,6 @@
test_info->name(), GetParamService().c_str());
auto svc = GetParamService();
- const string cryptoInstance = HalFullName(kCryptoIface, svc);
const string drmInstance = HalFullName(kDrmIface, svc);
if (drmInstance.find("IDrmFactory") != std::string::npos) {
@@ -192,12 +191,6 @@
::ndk::SpAIBinder(AServiceManager_waitForService(drmInstance.c_str())));
ASSERT_NE(drmFactory, nullptr);
drmPlugin = createDrmPlugin();
- }
-
- if (cryptoInstance.find("ICryptoFactory") != std::string::npos) {
- cryptoFactory = ICryptoFactory::fromBinder(
- ::ndk::SpAIBinder(AServiceManager_waitForService(cryptoInstance.c_str())));
- ASSERT_NE(cryptoFactory, nullptr);
cryptoPlugin = createCryptoPlugin();
}
@@ -211,14 +204,12 @@
contentConfigurations = vendorModule->getContentConfigurations();
// If drm scheme not installed skip subsequent tests
- bool result = false;
- drmFactory->isCryptoSchemeSupported({getUUID()}, "cenc", SecurityLevel::SW_SECURE_CRYPTO,
- &result);
+ bool result = isCryptoSchemeSupported(getAidlUUID(), SecurityLevel::SW_SECURE_CRYPTO, "cenc");
if (!result) {
if (GetParamUUID() == std::array<uint8_t, 16>()) {
GTEST_SKIP() << "vendor module drm scheme not supported";
} else {
- FAIL() << "param scheme must not supported";
+ FAIL() << "param scheme must be supported";
}
}
@@ -234,18 +225,18 @@
}
std::string packageName("aidl.android.hardware.drm.test");
std::shared_ptr<::aidl::android::hardware::drm::IDrmPlugin> result;
- auto ret = drmFactory->createPlugin({getUUID()}, packageName, &result);
+ auto ret = drmFactory->createDrmPlugin(getAidlUUID(), packageName, &result);
EXPECT_OK(ret) << "createDrmPlugin remote call failed";
return result;
}
std::shared_ptr<::aidl::android::hardware::drm::ICryptoPlugin> DrmHalTest::createCryptoPlugin() {
- if (cryptoFactory == nullptr) {
+ if (drmFactory == nullptr) {
return nullptr;
}
vector<uint8_t> initVec;
std::shared_ptr<::aidl::android::hardware::drm::ICryptoPlugin> result;
- auto ret = cryptoFactory->createPlugin({getUUID()}, initVec, &result);
+ auto ret = drmFactory->createCryptoPlugin(getAidlUUID(), initVec, &result);
EXPECT_OK(ret) << "createCryptoPlugin remote call failed";
return result;
}
@@ -270,6 +261,26 @@
return vendorModule->getUUID();
}
+bool DrmHalTest::isCryptoSchemeSupported(Uuid uuid, SecurityLevel level, std::string mime) {
+ CryptoSchemes schemes{};
+ auto ret = drmFactory->getSupportedCryptoSchemes(&schemes);
+ EXPECT_OK(ret);
+ if (!ret.isOk() || !std::count(schemes.uuids.begin(), schemes.uuids.end(), uuid)) {
+ return false;
+ }
+ if (level > schemes.maxLevel || level < schemes.minLevel) {
+ if (level != SecurityLevel::DEFAULT && level != SecurityLevel::UNKNOWN) {
+ return false;
+ }
+ }
+ if (!mime.empty()) {
+ if (!std::count(schemes.mimeTypes.begin(), schemes.mimeTypes.end(), mime)) {
+ return false;
+ }
+ }
+ return true;
+}
+
void DrmHalTest::provision() {
std::string certificateType;
std::string certificateAuthority;
@@ -410,38 +421,43 @@
/**
* getDecryptMemory allocates memory for decryption, then sets it
- * as a shared buffer base in the crypto hal. A parcelable Ashmem
- * is returned.
+ * as a shared buffer base in the crypto hal. An output SharedBuffer
+ * is updated via reference.
*
* @param size the size of the memory segment to allocate
* @param the index of the memory segment which will be used
* to refer to it for decryption.
*/
-Ashmem DrmHalTest::getDecryptMemory(size_t size, size_t index) {
+void DrmHalTest::getDecryptMemory(size_t size, size_t index, SharedBuffer& out) {
+ out.bufferId = static_cast<int32_t>(index);
+ out.offset = 0;
+ out.size = static_cast<int64_t>(size);
+
int fd = ASharedMemory_create("drmVtsSharedMemory", size);
EXPECT_GE(fd, 0);
EXPECT_EQ(size, ASharedMemory_getSize(fd));
+ auto handle = native_handle_create(1, 0);
+ handle->data[0] = fd;
+ out.handle = ::android::makeToAidl(handle);
- Ashmem ashmem;
- ashmem.fd = ::ndk::ScopedFileDescriptor(fd);
- ashmem.size = size;
- EXPECT_OK(cryptoPlugin->setSharedBufferBase(ashmem, index));
- return ashmem;
+ EXPECT_OK(cryptoPlugin->setSharedBufferBase(out));
+ native_handle_delete(handle);
}
-void DrmHalTest::fillRandom(const Ashmem& ashmem) {
+uint8_t* DrmHalTest::fillRandom(const ::aidl::android::hardware::drm::SharedBuffer& buf) {
std::random_device rd;
std::mt19937 rand(rd());
- ::ndk::ScopedFileDescriptor fd = ashmem.fd.dup();
- size_t size = ashmem.size;
+ auto fd = buf.handle.fds[0].get();
+ size_t size = buf.size;
uint8_t* base = static_cast<uint8_t*>(
- mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd.get(), 0));
+ mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
EXPECT_NE(MAP_FAILED, base);
for (size_t i = 0; i < size / sizeof(uint32_t); i++) {
auto p = static_cast<uint32_t*>(static_cast<void*>(base));
p[i] = rand();
}
+ return base;
}
uint32_t DrmHalTest::decrypt(Mode mode, bool isSecure, const std::array<uint8_t, 16>& keyId,
@@ -453,6 +469,7 @@
uint8_t localIv[AES_BLOCK_SIZE];
memcpy(localIv, iv, AES_BLOCK_SIZE);
vector<uint8_t> ivVec(localIv, localIv + AES_BLOCK_SIZE);
+ vector<uint8_t> keyIdVec(keyId.begin(), keyId.end());
int64_t totalSize = 0;
for (size_t i = 0; i < subSamples.size(); i++) {
@@ -463,32 +480,39 @@
// The first totalSize bytes of shared memory is the encrypted
// input, the second totalSize bytes (if exists) is the decrypted output.
size_t factor = expectedStatus == Status::ERROR_DRM_FRAME_TOO_LARGE ? 1 : 2;
- Ashmem sharedMemory = getDecryptMemory(totalSize * factor, kSegmentIndex);
+ SharedBuffer sourceBuffer;
+ getDecryptMemory(totalSize * factor, kSegmentIndex, sourceBuffer);
+ auto base = fillRandom(sourceBuffer);
- const SharedBuffer sourceBuffer = {.bufferId = kSegmentIndex, .offset = 0, .size = totalSize};
- fillRandom(sharedMemory);
+ SharedBuffer sourceRange;
+ sourceRange.bufferId = kSegmentIndex;
+ sourceRange.offset = 0;
+ sourceRange.size = totalSize;
- const DestinationBuffer destBuffer = {
- .type = BufferType::SHARED_MEMORY,
- .nonsecureMemory = {.bufferId = kSegmentIndex, .offset = totalSize, .size = totalSize},
- .secureMemory = {.fds = {}, .ints = {}}};
- const uint64_t offset = 0;
- uint32_t bytesWritten = 0;
- vector<uint8_t> keyIdVec(keyId.begin(), keyId.end());
- DecryptResult result;
- auto ret = cryptoPlugin->decrypt(isSecure, keyIdVec, ivVec, mode, pattern, subSamples,
- sourceBuffer, offset, destBuffer, &result);
+ SharedBuffer destRange;
+ destRange.bufferId = kSegmentIndex;
+ destRange.offset = totalSize;
+ destRange.size = totalSize;
+
+ DecryptArgs args;
+ args.secure = isSecure;
+ args.keyId = keyIdVec;
+ args.iv = ivVec;
+ args.mode = mode;
+ args.pattern = pattern;
+ args.subSamples = subSamples;
+ args.source = std::move(sourceRange);
+ args.offset = 0;
+ args.destination = std::move(destRange);
+
+ int32_t bytesWritten = 0;
+ auto ret = cryptoPlugin->decrypt(args, &bytesWritten);
EXPECT_TXN(ret);
- EXPECT_EQ(expectedStatus, DrmErr(ret)) << "Unexpected decrypt status " << result.detailedError;
- bytesWritten = result.bytesWritten;
+ EXPECT_EQ(expectedStatus, DrmErr(ret)) << "Unexpected decrypt status " << ret.getMessage();
if (bytesWritten != totalSize) {
return bytesWritten;
}
- ::ndk::ScopedFileDescriptor fd = sharedMemory.fd.dup();
- uint8_t* base = static_cast<uint8_t*>(
- mmap(nullptr, totalSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd.get(), 0));
- EXPECT_NE(MAP_FAILED, base);
// generate reference vector
vector<uint8_t> reference(totalSize);
@@ -513,6 +537,7 @@
EXPECT_EQ(0, memcmp(static_cast<void*>(&reference[0]), static_cast<void*>(base + totalSize),
totalSize))
<< "decrypt data mismatch";
+ munmap(base, totalSize * factor);
return totalSize;
}
diff --git a/drm/aidl/vts/drm_hal_test.cpp b/drm/aidl/vts/drm_hal_test.cpp
index 3ac9f5c..266ea39 100644
--- a/drm/aidl/vts/drm_hal_test.cpp
+++ b/drm/aidl/vts/drm_hal_test.cpp
@@ -66,11 +66,8 @@
* Ensure drm factory supports module UUID Scheme
*/
TEST_P(DrmHalTest, VendorUuidSupported) {
- bool result = false;
- auto ret =
- drmFactory->isCryptoSchemeSupported(getAidlUUID(), kVideoMp4, kSwSecureCrypto, &result);
- ALOGI("kVideoMp4 = %s res %d", kVideoMp4, static_cast<bool>(result));
- EXPECT_OK(ret);
+ bool result = isCryptoSchemeSupported(getAidlUUID(), kSwSecureCrypto, kVideoMp4);
+ ALOGI("kVideoMp4 = %s res %d", kVideoMp4, result);
EXPECT_TRUE(result);
}
@@ -80,10 +77,7 @@
TEST_P(DrmHalTest, InvalidPluginNotSupported) {
const vector<uint8_t> kInvalidUUID = {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80};
- bool result = false;
- auto ret = drmFactory->isCryptoSchemeSupported(toAidlUuid(kInvalidUUID), kVideoMp4,
- kSwSecureCrypto, &result);
- EXPECT_OK(ret);
+ auto result = isCryptoSchemeSupported(toAidlUuid(kInvalidUUID), kSwSecureCrypto, kVideoMp4);
EXPECT_FALSE(result);
}
@@ -93,10 +87,7 @@
TEST_P(DrmHalTest, EmptyPluginUUIDNotSupported) {
vector<uint8_t> emptyUUID(16);
memset(emptyUUID.data(), 0, 16);
- bool result = false;
- auto ret = drmFactory->isCryptoSchemeSupported(toAidlUuid(emptyUUID), kVideoMp4,
- kSwSecureCrypto, &result);
- EXPECT_OK(ret);
+ auto result = isCryptoSchemeSupported(toAidlUuid(emptyUUID), kSwSecureCrypto, kVideoMp4);
EXPECT_FALSE(result);
}
@@ -104,10 +95,7 @@
* Ensure drm factory doesn't support an invalid mime type
*/
TEST_P(DrmHalTest, BadMimeNotSupported) {
- bool result = false;
- auto ret =
- drmFactory->isCryptoSchemeSupported(getAidlUUID(), kBadMime, kSwSecureCrypto, &result);
- EXPECT_OK(ret);
+ auto result = isCryptoSchemeSupported(getAidlUUID(), kSwSecureCrypto, kBadMime);
EXPECT_FALSE(result);
}
@@ -380,9 +368,7 @@
* Ensure clearkey drm factory doesn't support security level higher than supported
*/
TEST_P(DrmHalClearkeyTest, BadLevelNotSupported) {
- bool result = false;
- auto ret = drmFactory->isCryptoSchemeSupported(getAidlUUID(), kVideoMp4, kHwSecureAll, &result);
- EXPECT_OK(ret);
+ auto result = isCryptoSchemeSupported(getAidlUUID(), kHwSecureAll, kVideoMp4);
EXPECT_FALSE(result);
}
@@ -461,7 +447,7 @@
const vector<KeyStatus> keyStatusList = {
{{0xa, 0xb, 0xc}, KeyStatusType::USABLE},
{{0xd, 0xe, 0xf}, KeyStatusType::EXPIRED},
- {{0x0, 0x1, 0x2}, KeyStatusType::USABLEINFUTURE},
+ {{0x0, 0x1, 0x2}, KeyStatusType::USABLE_IN_FUTURE},
};
EXPECT_EQ(sessionId, args.sessionId);
EXPECT_EQ(keyStatusList, args.keyStatusList);
diff --git a/drm/aidl/vts/drm_hal_test_main.cpp b/drm/aidl/vts/drm_hal_test_main.cpp
index dc0f6d7..833a51a 100644
--- a/drm/aidl/vts/drm_hal_test_main.cpp
+++ b/drm/aidl/vts/drm_hal_test_main.cpp
@@ -42,21 +42,15 @@
using drm_vts::PrintParamInstanceToString;
static const std::vector<DrmHalTestParam> getAllInstances() {
- using ::aidl::android::hardware::drm::ICryptoFactory;
using ::aidl::android::hardware::drm::IDrmFactory;
std::vector<std::string> drmInstances =
android::getAidlHalInstanceNames(IDrmFactory::descriptor);
- std::vector<std::string> cryptoInstances =
- android::getAidlHalInstanceNames(ICryptoFactory::descriptor);
std::set<std::string> allInstances;
for (auto svc : drmInstances) {
allInstances.insert(HalBaseName(svc));
}
- for (auto svc : cryptoInstances) {
- allInstances.insert(HalBaseName(svc));
- }
std::vector<DrmHalTestParam> allInstanceUuidCombos;
auto noUUID = [](std::string s) { return DrmHalTestParam(s); };
diff --git a/drm/aidl/vts/include/drm_hal_common.h b/drm/aidl/vts/include/drm_hal_common.h
index 4aac48b..2c7e514 100644
--- a/drm/aidl/vts/include/drm_hal_common.h
+++ b/drm/aidl/vts/include/drm_hal_common.h
@@ -18,14 +18,17 @@
#include <aidl/android/hardware/common/Ashmem.h>
#include <aidl/android/hardware/drm/BnDrmPluginListener.h>
-#include <aidl/android/hardware/drm/ICryptoFactory.h>
#include <aidl/android/hardware/drm/ICryptoPlugin.h>
#include <aidl/android/hardware/drm/IDrmFactory.h>
#include <aidl/android/hardware/drm/IDrmPlugin.h>
#include <aidl/android/hardware/drm/IDrmPluginListener.h>
#include <aidl/android/hardware/drm/Status.h>
+#include <android/binder_auto_utils.h>
+
+#include <gmock/gmock.h>
#include <array>
+#include <algorithm>
#include <chrono>
#include <future>
#include <iostream>
@@ -35,8 +38,6 @@
#include <utility>
#include <vector>
-#include <android/binder_auto_utils.h>
-
#include "VtsHalHidlTargetCallbackBase.h"
#include "drm_hal_vendor_module_api.h"
#include "drm_vts_helper.h"
@@ -80,11 +81,14 @@
std::array<uint8_t, 16> GetParamUUID() { return GetParam().scheme_; }
std::string GetParamService() { return GetParam().instance_; }
::aidl::android::hardware::drm::Uuid toAidlUuid(const std::vector<uint8_t>& in_uuid) {
- ::aidl::android::hardware::drm::Uuid uuid;
- uuid.uuid = in_uuid;
- return uuid;
+ std::array<uint8_t, 16> a;
+ std::copy_n(in_uuid.begin(), a.size(), a.begin());
+ return {a};
}
+ bool isCryptoSchemeSupported(::aidl::android::hardware::drm::Uuid uuid,
+ ::aidl::android::hardware::drm::SecurityLevel level,
+ std::string mime);
void provision();
SessionId openSession(::aidl::android::hardware::drm::SecurityLevel level,
::aidl::android::hardware::drm::Status* err);
@@ -106,8 +110,8 @@
KeyedVector toAidlKeyedVector(const std::map<std::string, std::string>& params);
std::array<uint8_t, 16> toStdArray(const std::vector<uint8_t>& vec);
- void fillRandom(const ::aidl::android::hardware::common::Ashmem& ashmem);
- ::aidl::android::hardware::common::Ashmem getDecryptMemory(size_t size, size_t index);
+ uint8_t* fillRandom(const ::aidl::android::hardware::drm::SharedBuffer& buf);
+ void getDecryptMemory(size_t size, size_t index, SharedBuffer& buf);
uint32_t decrypt(::aidl::android::hardware::drm::Mode mode, bool isSecure,
const std::array<uint8_t, 16>& keyId, uint8_t* iv,
@@ -123,7 +127,6 @@
const std::vector<uint8_t>& key);
std::shared_ptr<::aidl::android::hardware::drm::IDrmFactory> drmFactory;
- std::shared_ptr<::aidl::android::hardware::drm::ICryptoFactory> cryptoFactory;
std::shared_ptr<::aidl::android::hardware::drm::IDrmPlugin> drmPlugin;
std::shared_ptr<::aidl::android::hardware::drm::ICryptoPlugin> cryptoPlugin;
@@ -139,16 +142,13 @@
public:
virtual void SetUp() override {
DrmHalTest::SetUp();
- const std::vector<uint8_t> kClearKeyUUID = {0xE2, 0x71, 0x9D, 0x58, 0xA9, 0x85, 0xB3, 0xC9,
- 0x78, 0x1A, 0xB0, 0x30, 0xAF, 0x78, 0xD3, 0x0E};
+ auto kClearKeyUUID = toAidlUuid({0xE2, 0x71, 0x9D, 0x58, 0xA9, 0x85, 0xB3, 0xC9,
+ 0x78, 0x1A, 0xB0, 0x30, 0xAF, 0x78, 0xD3, 0x0E});
static const std::string kMimeType = "video/mp4";
static constexpr ::aidl::android::hardware::drm::SecurityLevel kSecurityLevel =
::aidl::android::hardware::drm::SecurityLevel::SW_SECURE_CRYPTO;
- bool drmClearkey = false;
- auto ret = drmFactory->isCryptoSchemeSupported(toAidlUuid(kClearKeyUUID), kMimeType,
- kSecurityLevel, &drmClearkey);
- if (!drmClearkey) {
+ if (!isCryptoSchemeSupported(kClearKeyUUID, kSecurityLevel, kMimeType)) {
GTEST_SKIP() << "ClearKey not supported by " << GetParamService();
}
}
diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp
index a861957..7855b51 100644
--- a/gnss/aidl/default/Gnss.cpp
+++ b/gnss/aidl/default/Gnss.cpp
@@ -53,17 +53,26 @@
ALOGE("%s: Null callback ignored", __func__);
return ScopedAStatus::fromExceptionCode(STATUS_INVALID_OPERATION);
}
-
sGnssCallback = callback;
- int capabilities = (int)(IGnssCallback::CAPABILITY_SATELLITE_BLOCKLIST |
- IGnssCallback::CAPABILITY_SATELLITE_PVT |
- IGnssCallback::CAPABILITY_CORRELATION_VECTOR |
- IGnssCallback::CAPABILITY_ANTENNA_INFO);
-
+ int capabilities =
+ (int)(IGnssCallback::CAPABILITY_MEASUREMENTS | IGnssCallback::CAPABILITY_SCHEDULING |
+ IGnssCallback::CAPABILITY_SATELLITE_BLOCKLIST |
+ IGnssCallback::CAPABILITY_SATELLITE_PVT |
+ IGnssCallback::CAPABILITY_CORRELATION_VECTOR |
+ IGnssCallback::CAPABILITY_ANTENNA_INFO);
auto status = sGnssCallback->gnssSetCapabilitiesCb(capabilities);
if (!status.isOk()) {
- ALOGE("%s: Unable to invoke callback.gnssSetCapabilities", __func__);
+ ALOGE("%s: Unable to invoke callback.gnssSetCapabilitiesCb", __func__);
+ }
+
+ IGnssCallback::GnssSystemInfo systemInfo = {
+ .yearOfHw = 2022,
+ .name = "Google Mock GNSS Implementation AIDL v2",
+ };
+ status = sGnssCallback->gnssSetSystemInfoCb(systemInfo);
+ if (!status.isOk()) {
+ ALOGE("%s: Unable to invoke callback.gnssSetSystemInfoCb", __func__);
}
return ScopedAStatus::ok();
diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp
index c1128ba..f184f81 100644
--- a/gnss/aidl/vts/gnss_hal_test.cpp
+++ b/gnss/aidl/vts/gnss_hal_test.cpp
@@ -33,7 +33,7 @@
ASSERT_NE(aidl_gnss_hal_, nullptr);
ALOGD("AIDL Interface Version = %d", aidl_gnss_hal_->getInterfaceVersion());
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
const auto& hidlInstanceNames = android::hardware::getAllHalInstanceNames(
android::hardware::gnss::V2_1::IGnss::descriptor);
gnss_hal_ = IGnss_V2_1::getService(hidlInstanceNames[0]);
@@ -60,9 +60,15 @@
TIMEOUT_SEC));
EXPECT_EQ(aidl_gnss_cb_->capabilities_cbq_.calledCount(), 1);
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
// Invoke the super method.
GnssHalTestTemplate<IGnss_V2_1>::SetUpGnssCallback();
+ } else {
+ /*
+ * SystemInfo callback should trigger
+ */
+ EXPECT_TRUE(aidl_gnss_cb_->info_cbq_.retrieve(aidl_gnss_cb_->last_info_, TIMEOUT_SEC));
+ EXPECT_EQ(aidl_gnss_cb_->info_cbq_.calledCount(), 1);
}
}
@@ -71,7 +77,7 @@
}
void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_power_mode) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
// Invoke the super method.
return GnssHalTestTemplate<IGnss_V2_1>::SetPositionMode(min_interval_msec, low_power_mode);
}
@@ -93,7 +99,7 @@
bool GnssHalTest::StartAndCheckFirstLocation(const int min_interval_msec,
const bool low_power_mode) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
// Invoke the super method.
return GnssHalTestTemplate<IGnss_V2_1>::StartAndCheckFirstLocation(min_interval_msec,
low_power_mode);
@@ -127,7 +133,7 @@
void GnssHalTest::StopAndClearLocations() {
ALOGD("StopAndClearLocations");
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
// Invoke the super method.
return GnssHalTestTemplate<IGnss_V2_1>::StopAndClearLocations();
}
@@ -148,7 +154,7 @@
}
void GnssHalTest::StartAndCheckLocations(int count) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
// Invoke the super method.
return GnssHalTestTemplate<IGnss_V2_1>::StartAndCheckLocations(count);
}
@@ -264,7 +270,7 @@
GnssConstellationType GnssHalTest::startLocationAndGetNonGpsConstellation(
const int locations_to_await, const int gnss_sv_info_list_timeout) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
return static_cast<GnssConstellationType>(
GnssHalTestTemplate<IGnss_V2_1>::startLocationAndGetNonGpsConstellation(
locations_to_await, gnss_sv_info_list_timeout));
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 8e51b44..365f9d3 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -28,6 +28,7 @@
#include <android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.h>
#include <android/hardware/gnss/visibility_control/IGnssVisibilityControl.h>
#include <cutils/properties.h>
+#include <cmath>
#include "AGnssCallbackAidl.h"
#include "AGnssRilCallbackAidl.h"
#include "GnssAntennaInfoCallbackAidl.h"
@@ -45,7 +46,9 @@
using android::hardware::gnss::BlocklistedSource;
using android::hardware::gnss::ElapsedRealtime;
using android::hardware::gnss::GnssClock;
+using android::hardware::gnss::GnssConstellationType;
using android::hardware::gnss::GnssData;
+using android::hardware::gnss::GnssLocation;
using android::hardware::gnss::GnssMeasurement;
using android::hardware::gnss::GnssPowerStats;
using android::hardware::gnss::IAGnss;
@@ -72,7 +75,6 @@
using android::hardware::gnss::visibility_control::IGnssVisibilityControl;
using GnssConstellationTypeV2_0 = android::hardware::gnss::V2_0::GnssConstellationType;
-using GnssConstellationTypeAidl = android::hardware::gnss::GnssConstellationType;
static bool IsAutomotiveDevice() {
char buffer[PROPERTY_VALUE_MAX] = {0};
@@ -89,6 +91,222 @@
TEST_P(GnssHalTest, SetupTeardownCreateCleanup) {}
/*
+ * GetLocation:
+ * Turns on location, waits 75 second for at least 5 locations,
+ * and checks them for reasonable validity.
+ */
+TEST_P(GnssHalTest, GetLocations) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+ const int kMinIntervalMsec = 500;
+ const int kLocationsToCheck = 5;
+
+ SetPositionMode(kMinIntervalMsec, /* low_power_mode= */ false);
+ StartAndCheckLocations(kLocationsToCheck);
+ StopAndClearLocations();
+}
+
+/*
+ * InjectDelete:
+ * Ensures that calls to inject and/or delete information state are handled.
+ */
+TEST_P(GnssHalTest, InjectDelete) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+ // Confidently, well north of Alaska
+ auto status = aidl_gnss_hal_->injectLocation(Utils::getMockLocation(80.0, -170.0, 150.0));
+ ASSERT_TRUE(status.isOk());
+
+ // Fake time, but generally reasonable values (time in Aug. 2018)
+ status =
+ aidl_gnss_hal_->injectTime(/* timeMs= */ 1534567890123L,
+ /* timeReferenceMs= */ 123456L, /* uncertaintyMs= */ 10000L);
+ ASSERT_TRUE(status.isOk());
+
+ status = aidl_gnss_hal_->deleteAidingData(IGnss::GnssAidingData::POSITION);
+ ASSERT_TRUE(status.isOk());
+
+ status = aidl_gnss_hal_->deleteAidingData(IGnss::GnssAidingData::TIME);
+ ASSERT_TRUE(status.isOk());
+
+ // Ensure we can get a good location after a bad injection has been deleted
+ StartAndCheckFirstLocation(/* min_interval_msec= */ 1000, /* low_power_mode= */ false);
+ StopAndClearLocations();
+}
+
+/*
+ * InjectSeedLocation:
+ * Injects a seed location and ensures the injected seed location is not fused in the resulting
+ * GNSS location.
+ */
+TEST_P(GnssHalTest, InjectSeedLocation) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+ // An arbitrary position in North Pacific Ocean (where no VTS labs will ever likely be located).
+ const double seedLatDegrees = 32.312894;
+ const double seedLngDegrees = -172.954117;
+ const float seedAccuracyMeters = 150.0;
+
+ auto status = aidl_gnss_hal_->injectLocation(
+ Utils::getMockLocation(seedLatDegrees, seedLngDegrees, seedAccuracyMeters));
+ ASSERT_TRUE(status.isOk());
+
+ StartAndCheckFirstLocation(/* min_interval_msec= */ 1000, /* low_power_mode= */ false);
+
+ // Ensure we don't get a location anywhere within 111km (1 degree of lat or lng) of the seed
+ // location.
+ EXPECT_TRUE(std::abs(aidl_gnss_cb_->last_location_.latitudeDegrees - seedLatDegrees) > 1.0 ||
+ std::abs(aidl_gnss_cb_->last_location_.longitudeDegrees - seedLngDegrees) > 1.0);
+
+ StopAndClearLocations();
+
+ status = aidl_gnss_hal_->deleteAidingData(IGnss::GnssAidingData::POSITION);
+ ASSERT_TRUE(status.isOk());
+}
+
+/*
+ * GnssCapabilities:
+ * 1. Verifies that GNSS hardware supports measurement capabilities.
+ * 2. Verifies that GNSS hardware supports Scheduling capabilities.
+ */
+TEST_P(GnssHalTest, GnssCapabilites) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+ if (!IsAutomotiveDevice()) {
+ EXPECT_TRUE(aidl_gnss_cb_->last_capabilities_ & IGnssCallback::CAPABILITY_MEASUREMENTS);
+ }
+ EXPECT_TRUE(aidl_gnss_cb_->last_capabilities_ & IGnssCallback::CAPABILITY_SCHEDULING);
+}
+
+/*
+ * GetLocationLowPower:
+ * Turns on location, waits for at least 5 locations allowing max of LOCATION_TIMEOUT_SUBSEQUENT_SEC
+ * between one location and the next. Also ensure that MIN_INTERVAL_MSEC is respected by waiting
+ * NO_LOCATION_PERIOD_SEC and verfiy that no location is received. Also perform validity checks on
+ * each received location.
+ */
+TEST_P(GnssHalTest, GetLocationLowPower) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+
+ const int kMinIntervalMsec = 5000;
+ const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) * 2;
+ const int kNoLocationPeriodSec = (kMinIntervalMsec / 1000) / 2;
+ const int kLocationsToCheck = 5;
+ const bool kLowPowerMode = true;
+
+ // Warmup period - VTS doesn't have AGPS access via GnssLocationProvider
+ aidl_gnss_cb_->location_cbq_.reset();
+ StartAndCheckLocations(kLocationsToCheck);
+ StopAndClearLocations();
+ aidl_gnss_cb_->location_cbq_.reset();
+
+ // Start of Low Power Mode test
+ // Don't expect true - as without AGPS access
+ if (!StartAndCheckFirstLocation(kMinIntervalMsec, kLowPowerMode)) {
+ ALOGW("GetLocationLowPower test - no first low power location received.");
+ }
+
+ for (int i = 1; i < kLocationsToCheck; i++) {
+ // Verify that kMinIntervalMsec is respected by waiting kNoLocationPeriodSec and
+ // ensure that no location is received yet
+
+ aidl_gnss_cb_->location_cbq_.retrieve(aidl_gnss_cb_->last_location_, kNoLocationPeriodSec);
+ const int location_called_count = aidl_gnss_cb_->location_cbq_.calledCount();
+ // Tolerate (ignore) one extra location right after the first one
+ // to handle startup edge case scheduling limitations in some implementations
+ if ((i == 1) && (location_called_count == 2)) {
+ CheckLocation(aidl_gnss_cb_->last_location_, true);
+ continue; // restart the quiet wait period after this too-fast location
+ }
+ EXPECT_LE(location_called_count, i);
+ if (location_called_count != i) {
+ ALOGW("GetLocationLowPower test - not enough locations received. %d vs. %d expected ",
+ location_called_count, i);
+ }
+
+ if (!aidl_gnss_cb_->location_cbq_.retrieve(
+ aidl_gnss_cb_->last_location_,
+ kLocationTimeoutSubsequentSec - kNoLocationPeriodSec)) {
+ ALOGW("GetLocationLowPower test - timeout awaiting location %d", i);
+ } else {
+ CheckLocation(aidl_gnss_cb_->last_location_, true);
+ }
+ }
+
+ StopAndClearLocations();
+}
+
+/*
+ * InjectBestLocation
+ *
+ * Ensure successfully injecting a location.
+ */
+TEST_P(GnssHalTest, InjectBestLocation) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+ StartAndCheckLocations(1);
+ GnssLocation gnssLocation = aidl_gnss_cb_->last_location_;
+ CheckLocation(gnssLocation, true);
+
+ auto status = aidl_gnss_hal_->injectBestLocation(gnssLocation);
+
+ ASSERT_TRUE(status.isOk());
+
+ status = aidl_gnss_hal_->deleteAidingData(IGnss::GnssAidingData::POSITION);
+
+ ASSERT_TRUE(status.isOk());
+}
+
+/*
+ * TestGnssSvInfoFields:
+ * Gets 1 location and a (non-empty) GnssSvInfo, and verifies basebandCN0DbHz is valid.
+ */
+TEST_P(GnssHalTest, TestGnssSvInfoFields) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+ aidl_gnss_cb_->location_cbq_.reset();
+ aidl_gnss_cb_->sv_info_list_cbq_.reset();
+ StartAndCheckFirstLocation(/* min_interval_msec= */ 1000, /* low_power_mode= */ false);
+ int location_called_count = aidl_gnss_cb_->location_cbq_.calledCount();
+ ALOGD("Observed %d GnssSvStatus, while awaiting one location (%d received)",
+ aidl_gnss_cb_->sv_info_list_cbq_.size(), location_called_count);
+
+ // Wait for up to kNumSvInfoLists events for kTimeoutSeconds for each event.
+ int kTimeoutSeconds = 2;
+ int kNumSvInfoLists = 4;
+ std::list<std::vector<IGnssCallback::GnssSvInfo>> sv_info_lists;
+ std::vector<IGnssCallback::GnssSvInfo> last_sv_info_list;
+
+ do {
+ EXPECT_GT(aidl_gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_lists, kNumSvInfoLists,
+ kTimeoutSeconds),
+ 0);
+ last_sv_info_list = sv_info_lists.back();
+ } while (last_sv_info_list.size() == 0);
+
+ ALOGD("last_sv_info size = %d", (int)last_sv_info_list.size());
+ bool nonZeroCn0Found = false;
+ for (auto sv_info : last_sv_info_list) {
+ EXPECT_TRUE(sv_info.basebandCN0DbHz >= 0.0 && sv_info.basebandCN0DbHz <= 65.0);
+ if (sv_info.basebandCN0DbHz > 0.0) {
+ nonZeroCn0Found = true;
+ }
+ }
+ // Assert at least one value is non-zero. Zero is ok in status as it's possibly
+ // reporting a searched but not found satellite.
+ EXPECT_TRUE(nonZeroCn0Found);
+ StopAndClearLocations();
+}
+
+/*
* TestPsdsExtension:
* 1. Gets the PsdsExtension
* 2. Injects empty PSDS data and verifies that it returns an error.
@@ -158,15 +376,7 @@
}
void CheckGnssMeasurementClockFields(const GnssData& measurement) {
- ASSERT_TRUE(measurement.elapsedRealtime.flags >= 0 &&
- measurement.elapsedRealtime.flags <= (ElapsedRealtime::HAS_TIMESTAMP_NS |
- ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS));
- if (measurement.elapsedRealtime.flags & ElapsedRealtime::HAS_TIMESTAMP_NS) {
- ASSERT_TRUE(measurement.elapsedRealtime.timestampNs > 0);
- }
- if (measurement.elapsedRealtime.flags & ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS) {
- ASSERT_TRUE(measurement.elapsedRealtime.timeUncertaintyNs > 0);
- }
+ Utils::checkElapsedRealtime(measurement.elapsedRealtime);
ASSERT_TRUE(measurement.clock.gnssClockFlags >= 0 &&
measurement.clock.gnssClockFlags <=
(GnssClock::HAS_LEAP_SECOND | GnssClock::HAS_TIME_UNCERTAINTY |
@@ -189,6 +399,34 @@
GnssMeasurement::HAS_CORRELATION_VECTOR));
}
+void CheckGnssMeasurementFields(const GnssMeasurement& measurement, const GnssData& data) {
+ CheckGnssMeasurementFlags(measurement);
+ // Verify CodeType is valid.
+ ASSERT_NE(measurement.signalType.codeType, "");
+ // Verify basebandCn0DbHz is valid.
+ ASSERT_TRUE(measurement.basebandCN0DbHz > 0.0 && measurement.basebandCN0DbHz <= 65.0);
+
+ if (((measurement.flags & GnssMeasurement::HAS_FULL_ISB) > 0) &&
+ ((measurement.flags & GnssMeasurement::HAS_FULL_ISB_UNCERTAINTY) > 0) &&
+ ((measurement.flags & GnssMeasurement::HAS_SATELLITE_ISB) > 0) &&
+ ((measurement.flags & GnssMeasurement::HAS_SATELLITE_ISB_UNCERTAINTY) > 0)) {
+ GnssConstellationType referenceConstellation =
+ data.clock.referenceSignalTypeForIsb.constellation;
+ double carrierFrequencyHz = data.clock.referenceSignalTypeForIsb.carrierFrequencyHz;
+ std::string codeType = data.clock.referenceSignalTypeForIsb.codeType;
+
+ ASSERT_TRUE(referenceConstellation >= GnssConstellationType::UNKNOWN &&
+ referenceConstellation <= GnssConstellationType::IRNSS);
+ ASSERT_TRUE(carrierFrequencyHz > 0);
+ ASSERT_NE(codeType, "");
+
+ ASSERT_TRUE(std::abs(measurement.fullInterSignalBiasNs) < 1.0e6);
+ ASSERT_TRUE(measurement.fullInterSignalBiasUncertaintyNs >= 0);
+ ASSERT_TRUE(std::abs(measurement.satelliteInterSignalBiasNs) < 1.0e6);
+ ASSERT_TRUE(measurement.satelliteInterSignalBiasUncertaintyNs >= 0);
+ }
+}
+
/*
* TestGnssMeasurementExtensionAndSatellitePvt:
* 1. Gets the GnssMeasurementExtension and verifies that it returns a non-null extension.
@@ -229,7 +467,7 @@
CheckGnssMeasurementClockFields(lastMeasurement);
for (const auto& measurement : lastMeasurement.measurements) {
- CheckGnssMeasurementFlags(measurement);
+ CheckGnssMeasurementFields(measurement, lastMeasurement);
if (measurement.flags & GnssMeasurement::HAS_SATELLITE_PVT &&
kIsSatellitePvtSupported == true) {
ALOGD("Found a measurement with SatellitePvt");
@@ -289,7 +527,7 @@
CheckGnssMeasurementClockFields(lastMeasurement);
for (const auto& measurement : lastMeasurement.measurements) {
- CheckGnssMeasurementFlags(measurement);
+ CheckGnssMeasurementFields(measurement, lastMeasurement);
if (measurement.flags & GnssMeasurement::HAS_CORRELATION_VECTOR) {
correlationVectorFound = true;
ASSERT_TRUE(measurement.correlationVectors.size() > 0);
@@ -466,7 +704,7 @@
FindStrongFrequentNonGpsSource(sv_info_vec_list, kLocationsToAwait - 1);
}
- if (source_to_blocklist.constellation == GnssConstellationTypeAidl::UNKNOWN) {
+ if (source_to_blocklist.constellation == GnssConstellationType::UNKNOWN) {
// Cannot find a non-GPS satellite. Let the test pass.
ALOGD("Cannot find a non-GPS satellite. Letting the test pass.");
return;
@@ -522,7 +760,7 @@
auto& gnss_sv = sv_info_vec[iSv];
EXPECT_FALSE(
(gnss_sv.v2_0.v1_0.svid == source_to_blocklist.svid) &&
- (static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
source_to_blocklist.constellation) &&
(gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
}
@@ -584,7 +822,7 @@
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
auto& gnss_sv = sv_info_vec[iSv];
if ((gnss_sv.v2_0.v1_0.svid == source_to_blocklist.svid) &&
- (static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
source_to_blocklist.constellation) &&
(gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)) {
strongest_sv_is_reobserved = true;
@@ -633,7 +871,7 @@
const int kGnssSvInfoListTimeout = 2;
// Find first non-GPS constellation to blocklist
- GnssConstellationTypeAidl constellation_to_blocklist = static_cast<GnssConstellationTypeAidl>(
+ GnssConstellationType constellation_to_blocklist = static_cast<GnssConstellationType>(
startLocationAndGetNonGpsConstellation(kLocationsToAwait, kGnssSvInfoListTimeout));
// Turns off location
@@ -646,7 +884,7 @@
// IRNSS was added in 2.0. Always attempt to blocklist IRNSS to verify that the new enum is
// supported.
BlocklistedSource source_to_blocklist_2;
- source_to_blocklist_2.constellation = GnssConstellationTypeAidl::IRNSS;
+ source_to_blocklist_2.constellation = GnssConstellationType::IRNSS;
source_to_blocklist_2.svid = 0; // documented wildcard for all satellites in this constellation
sp<IGnssConfiguration> gnss_configuration_hal;
@@ -686,11 +924,11 @@
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
const auto& gnss_sv = sv_info_vec[iSv];
EXPECT_FALSE(
- (static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
source_to_blocklist_1.constellation) &&
(gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
EXPECT_FALSE(
- (static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
source_to_blocklist_2.constellation) &&
(gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
}
@@ -736,7 +974,7 @@
const int kGnssSvInfoListTimeout = 2;
// Find first non-GPS constellation to blocklist
- GnssConstellationTypeAidl constellation_to_blocklist = static_cast<GnssConstellationTypeAidl>(
+ GnssConstellationType constellation_to_blocklist = static_cast<GnssConstellationType>(
startLocationAndGetNonGpsConstellation(kLocationsToAwait, kGnssSvInfoListTimeout));
BlocklistedSource source_to_blocklist_1;
@@ -746,7 +984,7 @@
// IRNSS was added in 2.0. Always attempt to blocklist IRNSS to verify that the new enum is
// supported.
BlocklistedSource source_to_blocklist_2;
- source_to_blocklist_2.constellation = GnssConstellationTypeAidl::IRNSS;
+ source_to_blocklist_2.constellation = GnssConstellationType::IRNSS;
source_to_blocklist_2.svid = 0; // documented wildcard for all satellites in this constellation
sp<IGnssConfiguration> gnss_configuration_hal;
@@ -789,11 +1027,11 @@
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
const auto& gnss_sv = sv_info_vec[iSv];
EXPECT_FALSE(
- (static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
source_to_blocklist_1.constellation) &&
(gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
EXPECT_FALSE(
- (static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
source_to_blocklist_2.constellation) &&
(gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
}
@@ -884,7 +1122,8 @@
* TestAGnssRilExtension:
* 1. Gets the IAGnssRil extension.
* 2. Sets AGnssRilCallback.
- * 3. Sets reference location.
+ * 3. Update network state to connected and then disconnected.
+ * 4. Sets reference location.
*/
TEST_P(GnssHalTest, TestAGnssRilExtension) {
if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
@@ -899,6 +1138,20 @@
status = iAGnssRil->setCallback(agnssRilCallback);
ASSERT_TRUE(status.isOk());
+ // Update GNSS HAL that a network has connected.
+ IAGnssRil::NetworkAttributes networkAttributes;
+ networkAttributes.networkHandle = 7700664333L;
+ networkAttributes.isConnected = true;
+ networkAttributes.capabilities = IAGnssRil::NETWORK_CAPABILITY_NOT_ROAMING;
+ networkAttributes.apn = "placeholder-apn";
+ status = iAGnssRil->updateNetworkState(networkAttributes);
+ ASSERT_TRUE(status.isOk());
+
+ // Update GNSS HAL that network has disconnected.
+ networkAttributes.isConnected = false;
+ status = iAGnssRil->updateNetworkState(networkAttributes);
+ ASSERT_TRUE(status.isOk());
+
// Set RefLocation
IAGnssRil::AGnssRefLocationCellID agnssReflocationCellId;
agnssReflocationCellId.type = IAGnssRil::AGnssRefLocationType::LTE_CELLID;
@@ -1020,6 +1273,9 @@
// Validity check GnssData fields
CheckGnssMeasurementClockFields(lastMeasurement);
+ for (const auto& measurement : lastMeasurement.measurements) {
+ CheckGnssMeasurementFields(measurement, lastMeasurement);
+ }
}
status = iGnssMeasurement->close();
@@ -1076,12 +1332,11 @@
* PhaseCenterVariationCorrections and SignalGainCorrections are optional.
*/
TEST_P(GnssHalTest, TestGnssAntennaInfo) {
- const int kAntennaInfoTimeoutSeconds = 2;
-
if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
return;
}
+ const int kAntennaInfoTimeoutSeconds = 2;
sp<IGnssAntennaInfo> iGnssAntennaInfo;
auto status = aidl_gnss_hal_->getExtensionGnssAntennaInfo(&iGnssAntennaInfo);
ASSERT_TRUE(status.isOk());
diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp
index 4e6a718..a519d3a 100644
--- a/gnss/common/utils/default/Utils.cpp
+++ b/gnss/common/utils/default/Utils.cpp
@@ -217,7 +217,8 @@
.biasUncertaintyNs = 47514.989972114563,
.driftNsps = -51.757811607455452,
.driftUncertaintyNsps = 310.64968328491528,
- .hwClockDiscontinuityCount = 1};
+ .hwClockDiscontinuityCount = 1,
+ .referenceSignalTypeForIsb = signalType};
ElapsedRealtime timestamp = {
.flags = ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS,
diff --git a/gnss/common/utils/vts/Utils.cpp b/gnss/common/utils/vts/Utils.cpp
index da4c07f..4c725a8 100644
--- a/gnss/common/utils/vts/Utils.cpp
+++ b/gnss/common/utils/vts/Utils.cpp
@@ -20,12 +20,16 @@
#include "gtest/gtest.h"
#include <cutils/properties.h>
+#include <utils/SystemClock.h>
namespace android {
namespace hardware {
namespace gnss {
namespace common {
+using android::hardware::gnss::ElapsedRealtime;
+using android::hardware::gnss::GnssLocation;
+
using namespace measurement_corrections::V1_0;
using V1_0::GnssLocationFlags;
@@ -45,6 +49,50 @@
return location.timestamp;
}
+template <>
+void Utils::checkLocationElapsedRealtime(const V1_0::GnssLocation&) {}
+
+template <>
+void Utils::checkLocationElapsedRealtime(const android::hardware::gnss::GnssLocation& location) {
+ checkElapsedRealtime(location.elapsedRealtime);
+}
+
+void Utils::checkElapsedRealtime(const ElapsedRealtime& elapsedRealtime) {
+ ASSERT_TRUE(elapsedRealtime.flags >= 0 &&
+ elapsedRealtime.flags <= (ElapsedRealtime::HAS_TIMESTAMP_NS |
+ ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS));
+ if (elapsedRealtime.flags & ElapsedRealtime::HAS_TIMESTAMP_NS) {
+ ASSERT_TRUE(elapsedRealtime.timestampNs > 0);
+ }
+ if (elapsedRealtime.flags & ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS) {
+ ASSERT_TRUE(elapsedRealtime.timeUncertaintyNs > 0);
+ }
+}
+
+const GnssLocation Utils::getMockLocation(double latitudeDegrees, double longitudeDegrees,
+ double horizontalAccuracyMeters) {
+ ElapsedRealtime elapsedRealtime;
+ elapsedRealtime.flags =
+ ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS;
+ elapsedRealtime.timestampNs = ::android::elapsedRealtimeNano();
+ elapsedRealtime.timeUncertaintyNs = 1000;
+ GnssLocation location;
+ location.gnssLocationFlags = 0xFF;
+ location.latitudeDegrees = latitudeDegrees;
+ location.longitudeDegrees = longitudeDegrees;
+ location.altitudeMeters = 500.0;
+ location.speedMetersPerSec = 0.0;
+ location.bearingDegrees = 0.0;
+ location.horizontalAccuracyMeters = horizontalAccuracyMeters;
+ location.verticalAccuracyMeters = 1000.0;
+ location.speedAccuracyMetersPerSecond = 1000.0;
+ location.bearingAccuracyDegrees = 90.0;
+ location.timestampMillis =
+ static_cast<int64_t>(kMockTimestamp + ::android::elapsedRealtimeNano() * 1e-6);
+ location.elapsedRealtime = elapsedRealtime;
+ return location;
+}
+
const MeasurementCorrections Utils::getMockMeasurementCorrections() {
ReflectingPlane reflectingPlane = {
.latitudeDegrees = 37.4220039,
diff --git a/gnss/common/utils/vts/include/Utils.h b/gnss/common/utils/vts/include/Utils.h
index 4ea6cd6..7b89078 100644
--- a/gnss/common/utils/vts/include/Utils.h
+++ b/gnss/common/utils/vts/include/Utils.h
@@ -19,11 +19,13 @@
#include <android/hardware/gnss/1.0/IGnss.h>
#include <android/hardware/gnss/2.0/IGnss.h>
+#include <android/hardware/gnss/IGnss.h>
#include <android/hardware/gnss/measurement_corrections/1.0/IMeasurementCorrections.h>
#include <android/hardware/gnss/measurement_corrections/1.1/IMeasurementCorrections.h>
#include <android/hardware/gnss/measurement_corrections/BnMeasurementCorrectionsInterface.h>
#include <gtest/gtest.h>
+#include <type_traits>
namespace android {
namespace hardware {
@@ -32,8 +34,18 @@
struct Utils {
public:
+ static const int64_t kMockTimestamp = 1519930775453L;
+
template <class T>
static void checkLocation(const T& location, bool check_speed, bool check_more_accuracies);
+ template <class T>
+ static void checkLocationElapsedRealtime(const T& location);
+
+ static void checkElapsedRealtime(
+ const android::hardware::gnss::ElapsedRealtime& elapsedRealtime);
+
+ static const android::hardware::gnss::GnssLocation getMockLocation(
+ double latitudeDegrees, double longitudeDegrees, double horizontalAccuracyMeters);
static const measurement_corrections::V1_0::MeasurementCorrections
getMockMeasurementCorrections();
static const measurement_corrections::V1_1::MeasurementCorrections
@@ -117,6 +129,8 @@
// Check timestamp > 1.48e12 (47 years in msec - 1970->2017+)
EXPECT_GT(getLocationTimestampMillis(location), 1.48e12);
+
+ checkLocationElapsedRealtime(location);
}
} // namespace common
diff --git a/identity/support/include/cppbor/cppbor.h b/identity/support/include/cppbor/cppbor.h
index a755db1..af5d82e 100644
--- a/identity/support/include/cppbor/cppbor.h
+++ b/identity/support/include/cppbor/cppbor.h
@@ -274,7 +274,7 @@
virtual std::unique_ptr<Item> clone() const override { return std::make_unique<Nint>(mValue); }
private:
- uint64_t addlInfo() const { return -1ll - mValue; }
+ uint64_t addlInfo() const { return -1LL - mValue; }
int64_t mValue;
};
diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
index eddf83f..6caac63 100644
--- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
+++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
@@ -203,9 +203,8 @@
}
int64_t delayUs = finishBy - android::ALooper::GetNowUs();
if (delayUs < 0) return toStatus(android::TIMED_OUT);
- (timeoutUs < 0)
- ? msgCondition.wait(msgLock)
- : msgCondition.waitRelative(msgLock, delayUs * 1000ll);
+ (timeoutUs < 0) ? msgCondition.wait(msgLock)
+ : msgCondition.waitRelative(msgLock, delayUs * 1000LL);
}
}
diff --git a/sensors/common/default/2.X/Sensor.cpp b/sensors/common/default/2.X/Sensor.cpp
index 23c9803..fd701fd 100644
--- a/sensors/common/default/2.X/Sensor.cpp
+++ b/sensors/common/default/2.X/Sensor.cpp
@@ -59,10 +59,10 @@
}
void Sensor::batch(int64_t samplingPeriodNs) {
- if (samplingPeriodNs < mSensorInfo.minDelay * 1000ll) {
- samplingPeriodNs = mSensorInfo.minDelay * 1000ll;
- } else if (samplingPeriodNs > mSensorInfo.maxDelay * 1000ll) {
- samplingPeriodNs = mSensorInfo.maxDelay * 1000ll;
+ if (samplingPeriodNs < mSensorInfo.minDelay * 1000LL) {
+ samplingPeriodNs = mSensorInfo.minDelay * 1000LL;
+ } else if (samplingPeriodNs > mSensorInfo.maxDelay * 1000LL) {
+ samplingPeriodNs = mSensorInfo.maxDelay * 1000LL;
}
if (mSamplingPeriodNs != samplingPeriodNs) {
diff --git a/usb/aidl/Android.bp b/usb/aidl/Android.bp
index d1e9e68..f71cacb 100644
--- a/usb/aidl/Android.bp
+++ b/usb/aidl/Android.bp
@@ -12,6 +12,15 @@
// 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"],
+}
+
aidl_interface {
name: "android.hardware.usb",
vendor_available: true,
diff --git a/usb/aidl/default/Android.bp b/usb/aidl/default/Android.bp
index da0cff2..7cb2822 100644
--- a/usb/aidl/default/Android.bp
+++ b/usb/aidl/default/Android.bp
@@ -14,6 +14,15 @@
// 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_binary {
name: "android.hardware.usb-service.example",
relative_install_path: "hw",
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorGids.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorGids.aidl
index b0d88e0..5515c67 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorGids.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorGids.aidl
@@ -34,5 +34,5 @@
package android.hardware.uwb.fira_android;
@Backing(type="byte") @VintfStability
enum UwbVendorGids {
- ANDROID = 14,
+ ANDROID = 12,
}
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl
index c04bdcf..e389a2d 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl
@@ -19,6 +19,7 @@
/**
* Android specific vendor command OIDs should be defined here.
*
+ * For use with Android GID - 0xC.
*/
@VintfStability
@Backing(type="byte")
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGids.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGids.aidl
index c7bc6b0..dbe00cb 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGids.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGids.aidl
@@ -32,5 +32,5 @@
*/
/** All Android specific commands/response/notification should use this GID */
- ANDROID = 0xE,
+ ANDROID = 0xC,
}