Merge changes I86e0c465,I537588c4
* changes:
Remove any references to DEBUG_ capabilities in the Vendor HAL service.
Remove DEBUG_ capabilities from ChipCapabilityMask.
diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp
index 01af940..af3f5a2 100644
--- a/audio/aidl/Android.bp
+++ b/audio/aidl/Android.bp
@@ -120,8 +120,6 @@
"android/hardware/audio/core/IStreamOut.aidl",
"android/hardware/audio/core/IStreamOutEventCallback.aidl",
"android/hardware/audio/core/ITelephony.aidl",
- "android/hardware/audio/core/MicrophoneDynamicInfo.aidl",
- "android/hardware/audio/core/MicrophoneInfo.aidl",
"android/hardware/audio/core/MmapBufferDescriptor.aidl",
"android/hardware/audio/core/ModuleDebug.aidl",
"android/hardware/audio/core/StreamDescriptor.aidl",
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
index 45217e7..1eafdab 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
@@ -58,7 +58,7 @@
void setMasterVolume(float volume);
boolean getMicMute();
void setMicMute(boolean mute);
- android.hardware.audio.core.MicrophoneInfo[] getMicrophones();
+ android.media.audio.common.MicrophoneInfo[] getMicrophones();
void updateAudioMode(android.media.audio.common.AudioMode mode);
void updateScreenRotation(android.hardware.audio.core.IModule.ScreenRotation rotation);
void updateScreenState(boolean isTurnedOn);
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl
index 1041943..a01f877 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl
@@ -35,7 +35,7 @@
@VintfStability
interface IStreamIn {
android.hardware.audio.core.IStreamCommon getStreamCommon();
- android.hardware.audio.core.MicrophoneDynamicInfo[] getActiveMicrophones();
+ android.media.audio.common.MicrophoneDynamicInfo[] getActiveMicrophones();
android.hardware.audio.core.IStreamIn.MicrophoneDirection getMicrophoneDirection();
void setMicrophoneDirection(android.hardware.audio.core.IStreamIn.MicrophoneDirection direction);
float getMicrophoneFieldDimension();
@@ -43,7 +43,7 @@
void updateMetadata(in android.hardware.audio.common.SinkMetadata sinkMetadata);
float[] getHwGain();
void setHwGain(in float[] channelGains);
- const int MIC_FIELD_DIMENSION_WIDE_ANGLE = (-1);
+ const int MIC_FIELD_DIMENSION_WIDE_ANGLE = (-1) /* -1 */;
const int MIC_FIELD_DIMENSION_NO_ZOOM = 0;
const int MIC_FIELD_DIMENSION_MAX_ZOOM = 1;
const int HW_GAIN_MIN = 0;
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl
index 001d074..84d7aa1 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl
@@ -46,7 +46,7 @@
const int VOICE_VOLUME_MAX = 1;
@Backing(type="int") @VintfStability
enum TtyMode {
- UNSPECIFIED = (-1),
+ UNSPECIFIED = (-1) /* -1 */,
OFF = 0,
FULL = 1,
HCO = 2,
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneInfo.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneInfo.aidl
deleted file mode 100644
index b77afe3..0000000
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneInfo.aidl
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.
- */
-///////////////////////////////////////////////////////////////////////////////
-// 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.audio.core;
-@JavaDerive(equals=true, toString=true) @VintfStability
-parcelable MicrophoneInfo {
- @utf8InCpp String id;
- android.media.audio.common.AudioDevice device;
- android.hardware.audio.core.MicrophoneInfo.Location location = android.hardware.audio.core.MicrophoneInfo.Location.UNKNOWN;
- int group = GROUP_UNKNOWN;
- int indexInTheGroup = INDEX_IN_THE_GROUP_UNKNOWN;
- @nullable android.hardware.audio.core.MicrophoneInfo.Sensitivity sensitivity;
- android.hardware.audio.core.MicrophoneInfo.Directionality directionality = android.hardware.audio.core.MicrophoneInfo.Directionality.UNKNOWN;
- android.hardware.audio.core.MicrophoneInfo.FrequencyResponsePoint[] frequencyResponse;
- @nullable android.hardware.audio.core.MicrophoneInfo.Coordinate position;
- @nullable android.hardware.audio.core.MicrophoneInfo.Coordinate orientation;
- const int GROUP_UNKNOWN = (-1);
- const int INDEX_IN_THE_GROUP_UNKNOWN = (-1);
- @Backing(type="int") @VintfStability
- enum Location {
- UNKNOWN = 0,
- MAINBODY = 1,
- MAINBODY_MOVABLE = 2,
- PERIPHERAL = 3,
- }
- @VintfStability
- parcelable Sensitivity {
- float leveldBFS;
- float maxSpldB;
- float minSpldB;
- }
- @Backing(type="int") @VintfStability
- enum Directionality {
- UNKNOWN = 0,
- OMNI = 1,
- BI_DIRECTIONAL = 2,
- CARDIOID = 3,
- HYPER_CARDIOID = 4,
- SUPER_CARDIOID = 5,
- }
- @VintfStability
- parcelable FrequencyResponsePoint {
- float frequencyHz;
- float leveldB;
- }
- @VintfStability
- parcelable Coordinate {
- float x;
- float y;
- float z;
- }
-}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl
index a65d7b7..3e3dc38 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl
@@ -39,12 +39,12 @@
int frameSizeBytes;
long bufferSizeFrames;
android.hardware.audio.core.StreamDescriptor.AudioBuffer audio;
- const int LATENCY_UNKNOWN = (-1);
+ const int LATENCY_UNKNOWN = (-1) /* -1 */;
@FixedSize @VintfStability
parcelable Position {
- long frames = UNKNOWN;
- long timeNs = UNKNOWN;
- const long UNKNOWN = (-1);
+ long frames = UNKNOWN /* -1 */;
+ long timeNs = UNKNOWN /* -1 */;
+ const long UNKNOWN = (-1) /* -1 */;
}
@Backing(type="int") @VintfStability
enum State {
diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl
index 968b573..edfb9f2 100644
--- a/audio/aidl/android/hardware/audio/core/IModule.aidl
+++ b/audio/aidl/android/hardware/audio/core/IModule.aidl
@@ -26,7 +26,6 @@
import android.hardware.audio.core.IStreamOut;
import android.hardware.audio.core.IStreamOutEventCallback;
import android.hardware.audio.core.ITelephony;
-import android.hardware.audio.core.MicrophoneInfo;
import android.hardware.audio.core.ModuleDebug;
import android.hardware.audio.core.StreamDescriptor;
import android.hardware.audio.core.VendorParameter;
@@ -39,6 +38,7 @@
import android.media.audio.common.AudioPort;
import android.media.audio.common.AudioPortConfig;
import android.media.audio.common.Float;
+import android.media.audio.common.MicrophoneInfo;
/**
* Each instance of IModule corresponds to a separate audio module. The system
diff --git a/audio/aidl/android/hardware/audio/core/IStreamIn.aidl b/audio/aidl/android/hardware/audio/core/IStreamIn.aidl
index c2b3633..93cad11 100644
--- a/audio/aidl/android/hardware/audio/core/IStreamIn.aidl
+++ b/audio/aidl/android/hardware/audio/core/IStreamIn.aidl
@@ -18,7 +18,7 @@
import android.hardware.audio.common.SinkMetadata;
import android.hardware.audio.core.IStreamCommon;
-import android.hardware.audio.core.MicrophoneDynamicInfo;
+import android.media.audio.common.MicrophoneDynamicInfo;
/**
* This interface provides means for receiving audio data from input devices.
diff --git a/audio/aidl/android/hardware/audio/core/MicrophoneDynamicInfo.aidl b/audio/aidl/android/hardware/audio/core/MicrophoneDynamicInfo.aidl
deleted file mode 100644
index 36cc51f..0000000
--- a/audio/aidl/android/hardware/audio/core/MicrophoneDynamicInfo.aidl
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.audio.core;
-
-/**
- * Structure providing dynamic information on a microphone. This information
- * changes between recording sessions.
- */
-@JavaDerive(equals=true, toString=true)
-@VintfStability
-parcelable MicrophoneDynamicInfo {
- /**
- * Unique alphanumeric id for the microphone. It must match the id of one of
- * the 'MicrophoneInfo' entries returned by 'IModule.getMicrophones'.
- */
- @utf8InCpp String id;
-
- @VintfStability
- @Backing(type="int")
- enum ChannelMapping {
- /** Channel not used. */
- UNUSED = 0,
- /** Channel is used and the signal is not processed. */
- DIRECT = 1,
- /** Channel is used and the signal has some processing. */
- PROCESSED = 2,
- }
- /**
- * The vector is indexes by zero-based channels of the microphone, thus the
- * element '0' corresponds to the first channel, '1' is the second, etc. The
- * vector must contain at least 1 element.
- */
- ChannelMapping[] channelMapping;
-}
diff --git a/audio/aidl/android/hardware/audio/core/MicrophoneInfo.aidl b/audio/aidl/android/hardware/audio/core/MicrophoneInfo.aidl
deleted file mode 100644
index 3b8c7f3..0000000
--- a/audio/aidl/android/hardware/audio/core/MicrophoneInfo.aidl
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.audio.core;
-
-import android.media.audio.common.AudioDevice;
-
-/**
- * Structure providing static information on a microphone. This information
- * never changes during the lifetime of the IModule which owns the microphone.
- * The information presented in this structure indicates the location and
- * orientation of the microphone on the device as well as useful information
- * like frequency response and sensitivity.
- */
-@JavaDerive(equals=true, toString=true)
-@VintfStability
-parcelable MicrophoneInfo {
- /**
- * Unique alphanumeric id for the microphone. It must remain the same across
- * device reboots. The client must never attempt to parse the value of this
- * field.
- */
- @utf8InCpp String id;
- /**
- * Describes the location of the microphone in terms of managed audio devices.
- */
- AudioDevice device;
-
- @VintfStability
- @Backing(type="int")
- enum Location {
- /** Microphone location is unknown. */
- UNKNOWN = 0,
- /** The microphone is located on the main body of the device. */
- MAINBODY = 1,
- /** The microphone is located on a movable main body of the device. */
- MAINBODY_MOVABLE = 2,
- /** The microphone is located on a peripheral. */
- PERIPHERAL = 3,
- }
- /** Location of the microphone in regard to the body of the device */
- Location location = Location.UNKNOWN;
-
- /**
- * This value is used when the group of the microphone is unknown.
- */
- const int GROUP_UNKNOWN = -1;
- /**
- * An identifier to group related microphones together, for example,
- * microphones of a microphone array should all belong to the same group.
- * Note that microphones assigned to 'GROUP_UNKNOWN' do not form a group.
- */
- int group = GROUP_UNKNOWN;
- /**
- * This value is used when the index in the group of the microphone is
- * unknown.
- */
- const int INDEX_IN_THE_GROUP_UNKNOWN = -1;
- /**
- * Index of this microphone within the group. The pair (group, index) must
- * be unique within the same HAL module, except the pair
- * (GROUP_UNKNOWN, INDEX_IN_THE_GROUP_UNKNOWN).
- */
- int indexInTheGroup = INDEX_IN_THE_GROUP_UNKNOWN;
-
- @VintfStability
- parcelable Sensitivity {
- /** Level in dBFS produced by a 1000 Hz tone at 94 dB SPL. */
- float leveldBFS;
- /** Level in dB of the max SPL supported at 1000 Hz */
- float maxSpldB;
- /** Level in dB of the min SPL supported at 1000 Hz */
- float minSpldB;
- }
- /**
- * If provided, must describe acceptable sound pressure levels (SPL)
- * for a 1 kHz sine wave, and the resulting level in dBFS.
- */
- @nullable Sensitivity sensitivity;
-
- @VintfStability
- @Backing(type="int")
- enum Directionality {
- UNKNOWN = 0,
- OMNI = 1,
- BI_DIRECTIONAL = 2,
- CARDIOID = 3,
- HYPER_CARDIOID = 4,
- SUPER_CARDIOID = 5,
- }
- /**
- * The standard polar pattern of the microphone.
- */
- Directionality directionality = Directionality.UNKNOWN;
-
- /**
- * A (frequency, level) pair. Used to represent frequency response.
- */
- @VintfStability
- parcelable FrequencyResponsePoint {
- float frequencyHz;
- float leveldB;
- }
- /**
- * Vector with ordered frequency responses (from low to high frequencies)
- * with the frequency response of the microphone. Levels are in dB,
- * relative to level at 1000 Hz.
- */
- FrequencyResponsePoint[] frequencyResponse;
-
- /**
- * A 3D point used to represent position or orientation of a microphone.
- */
- @VintfStability
- parcelable Coordinate {
- float x;
- float y;
- float z;
- }
- /**
- * If provided, must specify distances of the microphone's capsule, in
- * meters, from the bottom-left-back corner of the bounding box of device in
- * its natural orientation (PORTRAIT for phones, LANDSCAPE for tablets, TVs,
- * etc).
- */
- @nullable Coordinate position;
- /**
- * If provided, describes the normalized point which defines the main
- * orientation of the microphone's capsule.
- * Magnitude = sqrt(x^2 + y^2 + z^2) = 1.
- */
- @nullable Coordinate orientation;
-}
diff --git a/audio/aidl/default/Configuration.cpp b/audio/aidl/default/Configuration.cpp
index 854c7f3..a72be24 100644
--- a/audio/aidl/default/Configuration.cpp
+++ b/audio/aidl/default/Configuration.cpp
@@ -40,6 +40,7 @@
using aidl::android::media::audio::common::AudioPortMixExt;
using aidl::android::media::audio::common::AudioProfile;
using aidl::android::media::audio::common::Int;
+using aidl::android::media::audio::common::MicrophoneInfo;
using aidl::android::media::audio::common::PcmType;
using android::hardware::audio::common::makeBitPositionFlagMask;
diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp
index 2f6ab2f..10aead2 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -55,6 +55,7 @@
using aidl::android::media::audio::common::AudioProfile;
using aidl::android::media::audio::common::Boolean;
using aidl::android::media::audio::common::Int;
+using aidl::android::media::audio::common::MicrophoneInfo;
using aidl::android::media::audio::common::PcmType;
using android::hardware::audio::common::getFrameSizeInBytes;
using android::hardware::audio::common::isBitPositionFlagSet;
diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp
index d62ca1d..49ad2f2 100644
--- a/audio/aidl/default/Stream.cpp
+++ b/audio/aidl/default/Stream.cpp
@@ -31,6 +31,8 @@
using aidl::android::media::audio::common::AudioLatencyMode;
using aidl::android::media::audio::common::AudioOffloadInfo;
using aidl::android::media::audio::common::AudioPlaybackRate;
+using aidl::android::media::audio::common::MicrophoneDynamicInfo;
+using aidl::android::media::audio::common::MicrophoneInfo;
using android::hardware::audio::common::getChannelCount;
using android::hardware::audio::common::getFrameSizeInBytes;
diff --git a/audio/aidl/default/StreamStub.cpp b/audio/aidl/default/StreamStub.cpp
index 85d1e16..0ed9357 100644
--- a/audio/aidl/default/StreamStub.cpp
+++ b/audio/aidl/default/StreamStub.cpp
@@ -24,6 +24,7 @@
using aidl::android::hardware::audio::common::SourceMetadata;
using aidl::android::media::audio::common::AudioDevice;
using aidl::android::media::audio::common::AudioOffloadInfo;
+using aidl::android::media::audio::common::MicrophoneInfo;
namespace aidl::android::hardware::audio::core {
diff --git a/audio/aidl/default/include/core-impl/Configuration.h b/audio/aidl/default/include/core-impl/Configuration.h
index 1aca1fe..4dd0133 100644
--- a/audio/aidl/default/include/core-impl/Configuration.h
+++ b/audio/aidl/default/include/core-impl/Configuration.h
@@ -22,14 +22,14 @@
#include <aidl/android/hardware/audio/core/AudioPatch.h>
#include <aidl/android/hardware/audio/core/AudioRoute.h>
-#include <aidl/android/hardware/audio/core/MicrophoneInfo.h>
#include <aidl/android/media/audio/common/AudioPort.h>
#include <aidl/android/media/audio/common/AudioPortConfig.h>
+#include <aidl/android/media/audio/common/MicrophoneInfo.h>
namespace aidl::android::hardware::audio::core::internal {
struct Configuration {
- std::vector<MicrophoneInfo> microphones;
+ std::vector<::aidl::android::media::audio::common::MicrophoneInfo> microphones;
std::vector<::aidl::android::media::audio::common::AudioPort> ports;
std::vector<::aidl::android::media::audio::common::AudioPortConfig> portConfigs;
std::vector<::aidl::android::media::audio::common::AudioPortConfig> initialConfigs;
diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h
index fab1c14..8365b34 100644
--- a/audio/aidl/default/include/core-impl/Module.h
+++ b/audio/aidl/default/include/core-impl/Module.h
@@ -94,7 +94,9 @@
ndk::ScopedAStatus setMasterVolume(float in_volume) override;
ndk::ScopedAStatus getMicMute(bool* _aidl_return) override;
ndk::ScopedAStatus setMicMute(bool in_mute) override;
- ndk::ScopedAStatus getMicrophones(std::vector<MicrophoneInfo>* _aidl_return) override;
+ ndk::ScopedAStatus getMicrophones(
+ std::vector<::aidl::android::media::audio::common::MicrophoneInfo>* _aidl_return)
+ override;
ndk::ScopedAStatus updateAudioMode(
::aidl::android::media::audio::common::AudioMode in_mode) override;
ndk::ScopedAStatus updateScreenRotation(
diff --git a/audio/aidl/default/include/core-impl/Stream.h b/audio/aidl/default/include/core-impl/Stream.h
index f8c12e6..0d4365a3 100644
--- a/audio/aidl/default/include/core-impl/Stream.h
+++ b/audio/aidl/default/include/core-impl/Stream.h
@@ -32,10 +32,10 @@
#include <aidl/android/hardware/audio/core/BnStreamOut.h>
#include <aidl/android/hardware/audio/core/IStreamCallback.h>
#include <aidl/android/hardware/audio/core/IStreamOutEventCallback.h>
-#include <aidl/android/hardware/audio/core/MicrophoneInfo.h>
#include <aidl/android/hardware/audio/core/StreamDescriptor.h>
#include <aidl/android/media/audio/common/AudioDevice.h>
#include <aidl/android/media/audio/common/AudioOffloadInfo.h>
+#include <aidl/android/media/audio/common/MicrophoneInfo.h>
#include <fmq/AidlMessageQueue.h>
#include <system/thread_defs.h>
#include <utils/Errors.h>
@@ -413,7 +413,8 @@
getStreamCommon(_aidl_return);
}
ndk::ScopedAStatus getActiveMicrophones(
- std::vector<MicrophoneDynamicInfo>* _aidl_return) override;
+ std::vector<::aidl::android::media::audio::common::MicrophoneDynamicInfo>* _aidl_return)
+ override;
ndk::ScopedAStatus getMicrophoneDirection(MicrophoneDirection* _aidl_return) override;
ndk::ScopedAStatus setMicrophoneDirection(MicrophoneDirection in_direction) override;
ndk::ScopedAStatus getMicrophoneFieldDimension(float* _aidl_return) override;
@@ -434,7 +435,7 @@
StreamIn(const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
StreamContext&& context, const DriverInterface::CreateInstance& createDriver,
const StreamWorkerInterface::CreateInstance& createWorker,
- const std::vector<MicrophoneInfo>& microphones);
+ const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones);
void createStreamCommon(const std::shared_ptr<StreamIn>& myPtr) {
StreamCommonImpl<
::aidl::android::hardware::audio::common::SinkMetadata>::createStreamCommon(myPtr);
@@ -445,7 +446,8 @@
public:
using CreateInstance = std::function<ndk::ScopedAStatus(
const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
- StreamContext&& context, const std::vector<MicrophoneInfo>& microphones,
+ StreamContext&& context,
+ const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones,
std::shared_ptr<StreamIn>* result)>;
};
diff --git a/audio/aidl/default/include/core-impl/StreamStub.h b/audio/aidl/default/include/core-impl/StreamStub.h
index aea9da5..69fd7b3 100644
--- a/audio/aidl/default/include/core-impl/StreamStub.h
+++ b/audio/aidl/default/include/core-impl/StreamStub.h
@@ -43,13 +43,16 @@
public:
static ndk::ScopedAStatus createInstance(
const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
- StreamContext&& context, const std::vector<MicrophoneInfo>& microphones,
+ StreamContext&& context,
+ const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones,
std::shared_ptr<StreamIn>* result);
private:
friend class ndk::SharedRefBase;
- StreamInStub(const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
- StreamContext&& context, const std::vector<MicrophoneInfo>& microphones);
+ StreamInStub(
+ const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
+ StreamContext&& context,
+ const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones);
};
class StreamOutStub final : public StreamOut {
diff --git a/audio/aidl/default/include/core-impl/StreamUsb.h b/audio/aidl/default/include/core-impl/StreamUsb.h
index 8ac1f34..c04dc66 100644
--- a/audio/aidl/default/include/core-impl/StreamUsb.h
+++ b/audio/aidl/default/include/core-impl/StreamUsb.h
@@ -60,18 +60,22 @@
class StreamInUsb final : public StreamIn {
ndk::ScopedAStatus getActiveMicrophones(
- std::vector<MicrophoneDynamicInfo>* _aidl_return) override;
+ std::vector<::aidl::android::media::audio::common::MicrophoneDynamicInfo>* _aidl_return)
+ override;
public:
static ndk::ScopedAStatus createInstance(
const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
- StreamContext&& context, const std::vector<MicrophoneInfo>& microphones,
+ StreamContext&& context,
+ const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones,
std::shared_ptr<StreamIn>* result);
private:
friend class ndk::SharedRefBase;
- StreamInUsb(const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
- StreamContext&& context, const std::vector<MicrophoneInfo>& microphones);
+ StreamInUsb(
+ const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
+ StreamContext&& context,
+ const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones);
};
class StreamOutUsb final : public StreamOut {
diff --git a/audio/aidl/default/usb/StreamUsb.cpp b/audio/aidl/default/usb/StreamUsb.cpp
index 22e36ac..bd53a0e 100644
--- a/audio/aidl/default/usb/StreamUsb.cpp
+++ b/audio/aidl/default/usb/StreamUsb.cpp
@@ -30,6 +30,8 @@
using aidl::android::media::audio::common::AudioDevice;
using aidl::android::media::audio::common::AudioDeviceAddress;
using aidl::android::media::audio::common::AudioOffloadInfo;
+using aidl::android::media::audio::common::MicrophoneDynamicInfo;
+using aidl::android::media::audio::common::MicrophoneInfo;
namespace aidl::android::hardware::audio::core {
@@ -239,4 +241,4 @@
},
offloadInfo) {}
-} // namespace aidl::android::hardware::audio::core
\ No newline at end of file
+} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
index 3ca51c7..ed56597 100644
--- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
@@ -64,8 +64,6 @@
using aidl::android::hardware::audio::core::IStreamIn;
using aidl::android::hardware::audio::core::IStreamOut;
using aidl::android::hardware::audio::core::ITelephony;
-using aidl::android::hardware::audio::core::MicrophoneDynamicInfo;
-using aidl::android::hardware::audio::core::MicrophoneInfo;
using aidl::android::hardware::audio::core::ModuleDebug;
using aidl::android::hardware::audio::core::StreamDescriptor;
using aidl::android::hardware::audio::core::VendorParameter;
@@ -93,6 +91,8 @@
using aidl::android::media::audio::common::Boolean;
using aidl::android::media::audio::common::Float;
using aidl::android::media::audio::common::Int;
+using aidl::android::media::audio::common::MicrophoneDynamicInfo;
+using aidl::android::media::audio::common::MicrophoneInfo;
using aidl::android::media::audio::common::Void;
using android::hardware::audio::common::getChannelCount;
using android::hardware::audio::common::isBitPositionFlagSet;
diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl
index 8dc5ffe..ffd575d 100644
--- a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl
@@ -46,4 +46,6 @@
oneway void onAudioFocusChangeWithMetaData(in android.hardware.audio.common.PlaybackTrackMetadata playbackMetaData, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusChange);
oneway void setAudioDeviceGainsChanged(in android.hardware.automotive.audiocontrol.Reasons[] reasons, in android.hardware.automotive.audiocontrol.AudioGainConfigInfo[] gains);
oneway void registerGainCallback(in android.hardware.automotive.audiocontrol.IAudioGainCallback callback);
+ void setModuleChangeCallback(in android.hardware.automotive.audiocontrol.IModuleChangeCallback callback);
+ void clearModuleChangeCallback();
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl
similarity index 79%
copy from audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl
copy to automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl
index 50a5528..2bbb936 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,15 +31,8 @@
// 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.audio.core;
-@JavaDerive(equals=true, toString=true) @VintfStability
-parcelable MicrophoneDynamicInfo {
- @utf8InCpp String id;
- android.hardware.audio.core.MicrophoneDynamicInfo.ChannelMapping[] channelMapping;
- @Backing(type="int") @VintfStability
- enum ChannelMapping {
- UNUSED = 0,
- DIRECT = 1,
- PROCESSED = 2,
- }
+package android.hardware.automotive.audiocontrol;
+@VintfStability
+interface IModuleChangeCallback {
+ oneway void onAudioPortsChanged(in android.media.audio.common.AudioPort[] audioPorts);
}
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl
index 0ffcd5e..9564efc 100644
--- a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl
@@ -51,6 +51,7 @@
import android.hardware.automotive.audiocontrol.DuckingInfo;
import android.hardware.automotive.audiocontrol.IAudioGainCallback;
import android.hardware.automotive.audiocontrol.IFocusListener;
+import android.hardware.automotive.audiocontrol.IModuleChangeCallback;
import android.hardware.automotive.audiocontrol.MutingInfo;
import android.hardware.automotive.audiocontrol.Reasons;
@@ -183,4 +184,26 @@
* interface.
*/
oneway void registerGainCallback(in IAudioGainCallback callback);
+
+ /**
+ * Sets callback with HAL for notifying changes to hardware module (that is:
+ * {@link android.hardware.audio.core.IModule}) configurations.
+ *
+ * @param callback The {@link android.hardware.automotive.audiocontrol.IModuleChangeCallback}
+ * interface to use use when new updates are available for
+ * {@link android.hardware.audio.core.IModule} configs
+ * @throws EX_UNSUPPORTED_OPERATION if dynamic audio configs are not supported.
+ * @throws EX_ILLEGAL_STATE if a callback already exists
+ * @throws EX_ILLEGAL_ARGUMENT if the passed callback is (@code null}
+ */
+ void setModuleChangeCallback(in IModuleChangeCallback callback);
+
+ /**
+ * Clears module change callback
+ *
+ * If no callback is registered previously, then this call should be a no-op.
+ *
+ * @throws EX_UNSUPPORTED_OPERATION if dynamic audio configs are not supported.
+ */
+ void clearModuleChangeCallback();
}
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl
new file mode 100644
index 0000000..4282483
--- /dev/null
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2023 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.automotive.audiocontrol;
+
+import android.media.audio.common.AudioPort;
+
+/**
+ * Interface definition for asynchronous changes to audio configs defined
+ * for a hardware {@link android.hardware.audio.core.IModule}.
+ */
+@VintfStability
+oneway interface IModuleChangeCallback {
+ /**
+ * Used to indicate that one or more {@link android.media.audio.common.AudioPort}
+ * configs have changed. Implementations MUST return at least one AudioPort.
+ *
+ * Notes for AudioPort:
+ * 1. For V3, the support will be limited to configurable AudioGain stages - per
+ * car audio framework support.
+ * 2. For automotive 'bus' devices, the expected settings are
+ * AudioDevice {
+ * AudioDeviceDescription {type: IN/OUT_DEVICE, connection: CONNECTION_BUS}
+ * AudioDeviceAddress {id: string}}
+ *
+ * Notes for AudioGain:
+ * 1. Car audio framework only supports AudioGainMode::JOINT. Any other mode
+ * selection will be ignored.
+ * See {@link android.media.audio.common.AudioGainMode}
+ * 2. Implementations MUST ensure that the gain stages are identical for buses
+ * that map to the same volume group. Any inconsistencies will result in
+ * inferior volume-change experience to the users.
+ * 3. Implementations MUST ensure that the new gain stages are subset (do not
+ * exceed) of the gain stage definitions provided to audio policy. If they
+ * exceed, it can result in failure when setting value over the range
+ * allowed by the audio policy.
+ *
+ * Other notes:
+ * 1. In case of AudioControl service restart or resume, the implementations MUST
+ * issue an immediate callback following registration.
+ * 2. In case of client restart, the AudioControl service MUST clear all stale
+ * callbacks.
+ *
+ * @param audioPorts list of {@link android.media.audio.common.AudioPort} that
+ * are updated
+ */
+ void onAudioPortsChanged(in AudioPort[] audioPorts);
+}
diff --git a/automotive/audiocontrol/aidl/default/Android.bp b/automotive/audiocontrol/aidl/default/Android.bp
index 6bf4b9d..dde05c3 100644
--- a/automotive/audiocontrol/aidl/default/Android.bp
+++ b/automotive/audiocontrol/aidl/default/Android.bp
@@ -31,7 +31,7 @@
"android.hardware.audio.common@7.0-enums",
"android.hardware.audio.common-V1-ndk",
"android.frameworks.automotive.powerpolicy-V1-ndk",
- "android.hardware.automotive.audiocontrol-V2-ndk",
+ "android.hardware.automotive.audiocontrol-V3-ndk",
"libbase",
"libbinder_ndk",
"libcutils",
diff --git a/automotive/audiocontrol/aidl/default/AudioControl.cpp b/automotive/audiocontrol/aidl/default/AudioControl.cpp
index a121f8b..cf7307d 100644
--- a/automotive/audiocontrol/aidl/default/AudioControl.cpp
+++ b/automotive/audiocontrol/aidl/default/AudioControl.cpp
@@ -24,6 +24,7 @@
#include <aidl/android/hardware/automotive/audiocontrol/IFocusListener.h>
#include <android-base/logging.h>
+#include <android-base/parsebool.h>
#include <android-base/parseint.h>
#include <android-base/strings.h>
@@ -37,6 +38,8 @@
namespace aidl::android::hardware::automotive::audiocontrol {
using ::android::base::EqualsIgnoreCase;
+using ::android::base::ParseBool;
+using ::android::base::ParseBoolResult;
using ::android::base::ParseInt;
using ::std::shared_ptr;
using ::std::string;
@@ -70,6 +73,95 @@
}
} // namespace
+namespace {
+using ::aidl::android::media::audio::common::AudioChannelLayout;
+using ::aidl::android::media::audio::common::AudioDeviceDescription;
+using ::aidl::android::media::audio::common::AudioDeviceType;
+using ::aidl::android::media::audio::common::AudioFormatDescription;
+using ::aidl::android::media::audio::common::AudioFormatType;
+using ::aidl::android::media::audio::common::AudioGain;
+using ::aidl::android::media::audio::common::AudioGainMode;
+using ::aidl::android::media::audio::common::AudioIoFlags;
+using ::aidl::android::media::audio::common::AudioOutputFlags;
+using ::aidl::android::media::audio::common::AudioPort;
+using ::aidl::android::media::audio::common::AudioPortDeviceExt;
+using ::aidl::android::media::audio::common::AudioPortExt;
+using ::aidl::android::media::audio::common::AudioPortMixExt;
+using ::aidl::android::media::audio::common::AudioProfile;
+using ::aidl::android::media::audio::common::PcmType;
+
+// reuse common code artifacts
+void fillProfile(const std::vector<int32_t>& channelLayouts,
+ const std::vector<int32_t>& sampleRates, AudioProfile* profile) {
+ for (auto layout : channelLayouts) {
+ profile->channelMasks.push_back(
+ AudioChannelLayout::make<AudioChannelLayout::layoutMask>(layout));
+ }
+ profile->sampleRates.insert(profile->sampleRates.end(), sampleRates.begin(), sampleRates.end());
+}
+
+AudioProfile createProfile(PcmType pcmType, const std::vector<int32_t>& channelLayouts,
+ const std::vector<int32_t>& sampleRates) {
+ AudioProfile profile;
+ profile.format.type = AudioFormatType::PCM;
+ profile.format.pcm = pcmType;
+ fillProfile(channelLayouts, sampleRates, &profile);
+ return profile;
+}
+
+AudioProfile createProfile(const std::string& encodingType,
+ const std::vector<int32_t>& channelLayouts,
+ const std::vector<int32_t>& sampleRates) {
+ AudioProfile profile;
+ profile.format.encoding = encodingType;
+ fillProfile(channelLayouts, sampleRates, &profile);
+ return profile;
+}
+
+AudioPortExt createDeviceExt(AudioDeviceType devType, int32_t flags,
+ const std::string& connection = "", const std::string& address = "") {
+ AudioPortDeviceExt deviceExt;
+ deviceExt.device.type.type = devType;
+ if (devType == AudioDeviceType::IN_MICROPHONE && connection.empty()) {
+ deviceExt.device.address = "bottom";
+ } else if (devType == AudioDeviceType::IN_MICROPHONE_BACK && connection.empty()) {
+ deviceExt.device.address = "back";
+ } else {
+ deviceExt.device.address = std::move(address);
+ }
+ deviceExt.device.type.connection = std::move(connection);
+ deviceExt.flags = flags;
+ return AudioPortExt::make<AudioPortExt::Tag::device>(deviceExt);
+}
+
+AudioPort createPort(int32_t id, const std::string& name, int32_t flags, bool isInput,
+ const AudioPortExt& ext) {
+ AudioPort port;
+ port.id = id;
+ port.name = name;
+ port.flags = isInput ? AudioIoFlags::make<AudioIoFlags::Tag::input>(flags)
+ : AudioIoFlags::make<AudioIoFlags::Tag::output>(flags);
+ port.ext = ext;
+ return port;
+}
+
+AudioGain createGain(int32_t mode, AudioChannelLayout channelMask, int32_t minValue,
+ int32_t maxValue, int32_t defaultValue, int32_t stepValue,
+ int32_t minRampMs = 100, int32_t maxRampMs = 100, bool useForVolume = true) {
+ AudioGain gain;
+ gain.mode = mode;
+ gain.channelMask = channelMask;
+ gain.minValue = minValue;
+ gain.maxValue = maxValue;
+ gain.defaultValue = defaultValue;
+ gain.stepValue = stepValue;
+ gain.minRampMs = minRampMs;
+ gain.maxRampMs = maxRampMs;
+ gain.useForVolume = useForVolume;
+ return gain;
+}
+} // namespace
+
ndk::ScopedAStatus AudioControl::registerFocusListener(
const shared_ptr<IFocusListener>& in_listener) {
LOG(DEBUG) << "registering focus listener";
@@ -190,6 +282,33 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus AudioControl::setModuleChangeCallback(
+ const std::shared_ptr<IModuleChangeCallback>& in_callback) {
+ LOG(DEBUG) << ": " << __func__;
+
+ if (in_callback.get() == nullptr) {
+ LOG(ERROR) << __func__ << ": Callback is nullptr";
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+ }
+ if (mModuleChangeCallback != nullptr) {
+ LOG(ERROR) << __func__ << ": Module change callback was already registered";
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+ }
+ std::atomic_store(&mModuleChangeCallback, in_callback);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AudioControl::clearModuleChangeCallback() {
+ if (mModuleChangeCallback != nullptr) {
+ shared_ptr<IModuleChangeCallback> nullCallback = nullptr;
+ std::atomic_store(&mModuleChangeCallback, nullCallback);
+ LOG(DEBUG) << ":" << __func__ << ": Unregistered successfully";
+ } else {
+ LOG(DEBUG) << ":" << __func__ << ": No callback registered, no-op";
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
binder_status_t AudioControl::dump(int fd, const char** args, uint32_t numArgs) {
if (numArgs == 0) {
return dumpsys(fd);
@@ -208,6 +327,8 @@
return cmdAbandonFocusWithMetaData(fd, args, numArgs);
} else if (EqualsIgnoreCase(option, "--audioGainCallback")) {
return cmdOnAudioDeviceGainsChanged(fd, args, numArgs);
+ } else if (EqualsIgnoreCase(option, "--audioPortsChangedCallback")) {
+ return cmdOnAudioPortsChanged(fd, args, numArgs);
} else {
dprintf(fd, "Invalid option: %s\n", option.c_str());
return STATUS_BAD_VALUE;
@@ -262,7 +383,21 @@
dprintf(fd,
"Tags are optional. If provided, it must follow the <key>=<value> pattern, where the "
"value is namespaced (for example com.google.strategy=VR).\n");
-
+ dprintf(fd,
+ "--audioPortsChangedCallback <ID_1> <NAME_1> <BUS_ADDRESS_1> <CONNECTION_TYPE_1> "
+ "<AUDIO_GAINS_1> [<ID_N> <NAME_N> <BUS_ADDRESS_N> <CONNECTION_TYPE_N> "
+ "<AUDIO_GAINS_N>]: fires audio ports changed callback. Carries list of modified "
+ "AudioPorts. "
+ "For simplicity, this command accepts limited information for each AudioPort: "
+ "id(int), name(string), port address(string), connection type (string), "
+ "audio gain (csv int)\n");
+ dprintf(fd, "Notes: \n");
+ dprintf(fd,
+ "1. AudioGain csv should match definition at "
+ "android/media/audio/common/AudioPort.aidl\n");
+ dprintf(fd,
+ "2. See android/media/audio/common/AudioDeviceDescription.aidl for valid "
+ "<CONNECTION_TYPE> values.\n");
return STATUS_OK;
}
@@ -514,4 +649,166 @@
toEnumString(reasons).c_str(), toString(agcis).c_str());
return STATUS_OK;
}
+
+binder_status_t AudioControl::parseAudioGains(int fd, const std::string& stringGain,
+ std::vector<AudioGain>& gains) {
+ const int kAudioGainSize = 9;
+ std::stringstream csvGain(stringGain);
+ std::vector<std::string> vecGain;
+ std::string value;
+ while (getline(csvGain, value, ',')) {
+ vecGain.push_back(value);
+ }
+
+ if ((vecGain.size() == 0) || ((vecGain.size() % kAudioGainSize) != 0)) {
+ dprintf(fd, "Erroneous input to generate AudioGain: %s\n", stringGain.c_str());
+ return STATUS_BAD_VALUE;
+ }
+
+ // iterate over injected AudioGains
+ for (int index = 0; index < vecGain.size(); index += kAudioGainSize) {
+ int32_t mode;
+ if (!safelyParseInt(vecGain[index], &mode)) {
+ dprintf(fd, "Non-integer index provided with request: %s\n", vecGain[index].c_str());
+ return STATUS_BAD_VALUE;
+ }
+
+ // car audio framework only supports JOINT mode.
+ // skip injected AudioGains that are not compliant with this.
+ if (mode != static_cast<int>(AudioGainMode::JOINT)) {
+ LOG(WARNING) << ":" << __func__ << ": skipping gain since it is not JOINT mode!";
+ continue;
+ }
+
+ int32_t layout;
+ if (!safelyParseInt(vecGain[index + 1], &layout)) {
+ dprintf(fd, "Non-integer index provided with request: %s\n",
+ vecGain[index + 1].c_str());
+ return STATUS_BAD_VALUE;
+ }
+ AudioChannelLayout channelMask =
+ AudioChannelLayout::make<AudioChannelLayout::layoutMask>(layout);
+
+ int32_t minValue;
+ if (!safelyParseInt(vecGain[index + 2], &minValue)) {
+ dprintf(fd, "Non-integer index provided with request: %s\n",
+ vecGain[index + 2].c_str());
+ return STATUS_BAD_VALUE;
+ }
+
+ int32_t maxValue;
+ if (!safelyParseInt(vecGain[index + 3], &maxValue)) {
+ dprintf(fd, "Non-integer index provided with request: %s\n",
+ vecGain[index + 3].c_str());
+ return STATUS_BAD_VALUE;
+ }
+
+ int32_t defaultValue;
+ if (!safelyParseInt(vecGain[index + 4], &defaultValue)) {
+ dprintf(fd, "Non-integer index provided with request: %s\n",
+ vecGain[index + 4].c_str());
+ return STATUS_BAD_VALUE;
+ }
+
+ int32_t stepValue;
+ if (!safelyParseInt(vecGain[index + 5], &stepValue)) {
+ dprintf(fd, "Non-integer index provided with request: %s\n",
+ vecGain[index + 5].c_str());
+ return STATUS_BAD_VALUE;
+ }
+
+ int32_t minRampMs;
+ if (!safelyParseInt(vecGain[index + 6], &minRampMs)) {
+ dprintf(fd, "Non-integer index provided with request: %s\n",
+ vecGain[index + 6].c_str());
+ return STATUS_BAD_VALUE;
+ }
+
+ int32_t maxRampMs;
+ if (!safelyParseInt(vecGain[index + 7], &maxRampMs)) {
+ dprintf(fd, "Non-integer index provided with request: %s\n",
+ vecGain[index + 7].c_str());
+ return STATUS_BAD_VALUE;
+ }
+
+ ParseBoolResult useForVolume = ParseBool(vecGain[index + 8]);
+ if (useForVolume == ParseBoolResult::kError) {
+ dprintf(fd, "Non-boolean index provided with request: %s\n",
+ vecGain[index + 8].c_str());
+ return STATUS_BAD_VALUE;
+ } else if (useForVolume == ParseBoolResult::kFalse) {
+ // at this level we only care about gain stages that are relevant
+ // for volume control. skip the gain stage if its flagged as false.
+ LOG(WARNING) << ":" << __func__
+ << ": skipping gain since it is not for volume control!";
+ continue;
+ }
+
+ AudioGain gain = createGain(mode, channelMask, minValue, maxValue, defaultValue, stepValue,
+ minRampMs, maxRampMs, true /*useForVolume*/);
+ gains.push_back(gain);
+ }
+ return STATUS_OK;
+}
+
+binder_status_t AudioControl::cmdOnAudioPortsChanged(int fd, const char** args, uint32_t numArgs) {
+ if (!checkCallerHasWritePermissions(fd)) {
+ return STATUS_PERMISSION_DENIED;
+ }
+
+ if ((numArgs < 6) || ((numArgs - 1) % 5 != 0)) {
+ dprintf(fd,
+ "Invalid number of arguments: please provide\n"
+ "--audioPortsChangedCallback <ID_1> <NAME_1> <BUS_ADDRESS_1> <CONNECTION_TYPE_1> "
+ "<AUDIO_GAINS_1> [<ID_N> <NAME_N> <BUS_ADDRESS_N> <CONNECTION_TYPE_N> "
+ "<AUDIO_GAINS_N>]: triggers audio ports changed callback. Carries list of "
+ "modified AudioPorts. "
+ "For simplicity, this command accepts limited information for each AudioPort: "
+ "id(int), name(string), port address(string), connection type (string), "
+ "audio gain (csv int)\n");
+ return STATUS_BAD_VALUE;
+ }
+
+ std::vector<AudioPort> ports;
+ for (uint32_t i = 1; i < numArgs; i += 5) {
+ binder_status_t status;
+ int32_t id;
+ if (!safelyParseInt(std::string(args[i]), &id)) {
+ dprintf(fd, "Non-integer index provided with request: %s\n",
+ std::string(args[i]).c_str());
+ return STATUS_BAD_VALUE;
+ }
+
+ std::string name = std::string(args[i + 1]);
+ std::string address = std::string(args[i + 2]);
+ std::string connection = std::string(args[i + 3]);
+
+ std::string stringGains = std::string(args[i + 4]);
+ std::vector<AudioGain> gains;
+ status = parseAudioGains(fd, stringGains, gains);
+ if (status != STATUS_OK) {
+ return status;
+ }
+
+ AudioPort port = createPort(
+ id, name, 0 /*flags*/, false /*isInput*/,
+ createDeviceExt(AudioDeviceType::OUT_DEVICE, 0 /*flags*/, connection, address));
+ port.gains.insert(port.gains.begin(), gains.begin(), gains.end());
+
+ ports.push_back(port);
+ }
+
+ if (mModuleChangeCallback == nullptr) {
+ dprintf(fd,
+ "Unable to trigger audio port callback for ports: %s \n"
+ " - no module change callback registered\n",
+ toString(ports).c_str());
+ return STATUS_BAD_VALUE;
+ }
+
+ // TODO (b/269139706) fix atomic read issue
+ mModuleChangeCallback->onAudioPortsChanged(ports);
+ dprintf(fd, "SUCCESS audio port callback for ports: %s \n", toString(ports).c_str());
+ return STATUS_OK;
+}
} // namespace aidl::android::hardware::automotive::audiocontrol
diff --git a/automotive/audiocontrol/aidl/default/AudioControl.h b/automotive/audiocontrol/aidl/default/AudioControl.h
index 16b80e8..7eca446 100644
--- a/automotive/audiocontrol/aidl/default/AudioControl.h
+++ b/automotive/audiocontrol/aidl/default/AudioControl.h
@@ -21,11 +21,20 @@
#include <aidl/android/hardware/automotive/audiocontrol/BnAudioControl.h>
#include <aidl/android/hardware/automotive/audiocontrol/DuckingInfo.h>
#include <aidl/android/hardware/automotive/audiocontrol/IAudioGainCallback.h>
+#include <aidl/android/hardware/automotive/audiocontrol/IModuleChangeCallback.h>
#include <aidl/android/hardware/automotive/audiocontrol/MutingInfo.h>
#include <aidl/android/hardware/automotive/audiocontrol/Reasons.h>
#include <aidl/android/hardware/audio/common/PlaybackTrackMetadata.h>
+#include <aidl/android/media/audio/common/AudioChannelLayout.h>
+#include <aidl/android/media/audio/common/AudioDeviceType.h>
+#include <aidl/android/media/audio/common/AudioFormatDescription.h>
+#include <aidl/android/media/audio/common/AudioFormatType.h>
+#include <aidl/android/media/audio/common/AudioGainMode.h>
+#include <aidl/android/media/audio/common/AudioIoFlags.h>
+#include <aidl/android/media/audio/common/AudioOutputFlags.h>
+
namespace aidl::android::hardware::automotive::audiocontrol {
namespace audiohalcommon = ::aidl::android::hardware::audio::common;
@@ -51,6 +60,9 @@
const std::vector<AudioGainConfigInfo>& in_gains) override;
ndk::ScopedAStatus registerGainCallback(
const std::shared_ptr<IAudioGainCallback>& in_callback) override;
+ ndk::ScopedAStatus setModuleChangeCallback(
+ const std::shared_ptr<IModuleChangeCallback>& in_callback) override;
+ ndk::ScopedAStatus clearModuleChangeCallback() override;
binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
@@ -67,15 +79,23 @@
*/
std::shared_ptr<IAudioGainCallback> mAudioGainCallback = nullptr;
+ std::shared_ptr<IModuleChangeCallback> mModuleChangeCallback = nullptr;
+
binder_status_t cmdHelp(int fd) const;
binder_status_t cmdRequestFocus(int fd, const char** args, uint32_t numArgs);
binder_status_t cmdAbandonFocus(int fd, const char** args, uint32_t numArgs);
binder_status_t cmdRequestFocusWithMetaData(int fd, const char** args, uint32_t numArgs);
binder_status_t cmdAbandonFocusWithMetaData(int fd, const char** args, uint32_t numArgs);
binder_status_t cmdOnAudioDeviceGainsChanged(int fd, const char** args, uint32_t numArgs);
+ binder_status_t cmdOnAudioPortsChanged(int fd, const char** args, uint32_t numArgs);
binder_status_t parseMetaData(int fd, const std::string& metadataLiteral,
audiohalcommon::PlaybackTrackMetadata& trackMetadata);
+ binder_status_t parseAudioGains(
+ int fd, const std::string& stringGain,
+ std::vector<::aidl::android::media::audio::common::AudioGain>& gains);
+ binder_status_t parseSampleRates(int fd, const std::string& sampleRates,
+ std::vector<int32_t>& vecSampleRates);
binder_status_t dumpsys(int fd);
};
diff --git a/automotive/audiocontrol/aidl/vts/Android.bp b/automotive/audiocontrol/aidl/vts/Android.bp
index edac160..a9122ce 100644
--- a/automotive/audiocontrol/aidl/vts/Android.bp
+++ b/automotive/audiocontrol/aidl/vts/Android.bp
@@ -39,7 +39,7 @@
"libxml2",
],
static_libs: [
- "android.hardware.automotive.audiocontrol-V2-cpp",
+ "android.hardware.automotive.audiocontrol-V3-cpp",
"libgmock",
],
test_suites: [
diff --git a/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp
index f4f5eef..f4e3b5a 100644
--- a/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp
+++ b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp
@@ -21,6 +21,7 @@
#include <android/hardware/automotive/audiocontrol/BnAudioGainCallback.h>
#include <android/hardware/automotive/audiocontrol/BnFocusListener.h>
+#include <android/hardware/automotive/audiocontrol/BnModuleChangeCallback.h>
#include <android/hardware/automotive/audiocontrol/IAudioControl.h>
#include <android/log.h>
#include <binder/IServiceManager.h>
@@ -34,10 +35,14 @@
using android::hardware::automotive::audiocontrol::AudioGainConfigInfo;
using android::hardware::automotive::audiocontrol::BnAudioGainCallback;
using android::hardware::automotive::audiocontrol::BnFocusListener;
+using android::hardware::automotive::audiocontrol::BnModuleChangeCallback;
using android::hardware::automotive::audiocontrol::DuckingInfo;
using android::hardware::automotive::audiocontrol::IAudioControl;
+using android::hardware::automotive::audiocontrol::IModuleChangeCallback;
using android::hardware::automotive::audiocontrol::MutingInfo;
using android::hardware::automotive::audiocontrol::Reasons;
+using ::testing::AnyOf;
+using ::testing::Eq;
#include "android_audio_policy_configuration_V7_0.h"
@@ -55,6 +60,8 @@
ASSERT_NE(audioControl, nullptr);
}
+ void TearDown() override { audioControl = nullptr; }
+
sp<IAudioControl> audioControl;
int32_t capabilities;
};
@@ -226,6 +233,47 @@
ASSERT_TRUE(audioControl->registerGainCallback(gainCallback2).isOk());
}
+/*
+ * Test Module change Callback registration.
+ *
+ * Verifies that:
+ * - setModuleChangeCallback succeeds
+ * - setting a double callback fails with exception
+ * - clearModuleChangeCallback succeeds
+ * - setting with nullptr callback fails with exception
+ * - closing handle does not crash
+ */
+struct ModuleChangeCallbackMock : BnModuleChangeCallback {
+ MOCK_METHOD(Status, onAudioPortsChanged,
+ (const std::vector<android::media::audio::common::AudioPort>& audioPorts));
+};
+
+TEST_P(AudioControlAidl, RegisterModuleChangeCallbackTwiceThrowsException) {
+ ALOGI("Register Module change callback test");
+ // make sure no stale callbacks.
+ audioControl->clearModuleChangeCallback();
+
+ sp<ModuleChangeCallbackMock> moduleChangeCallback = new ModuleChangeCallbackMock();
+ auto status = audioControl->setModuleChangeCallback(moduleChangeCallback);
+ EXPECT_THAT(status.exceptionCode(),
+ AnyOf(Eq(Status::EX_NONE), Eq(Status::EX_UNSUPPORTED_OPERATION)));
+ if (!status.isOk()) return;
+
+ sp<ModuleChangeCallbackMock> moduleChangeCallback2 = new ModuleChangeCallbackMock();
+ // no need to check for unsupported feature
+ EXPECT_EQ(Status::EX_ILLEGAL_STATE,
+ audioControl->setModuleChangeCallback(moduleChangeCallback2).exceptionCode());
+ ASSERT_TRUE(audioControl->clearModuleChangeCallback().isOk());
+ ASSERT_TRUE(audioControl->setModuleChangeCallback(moduleChangeCallback2).isOk());
+}
+
+TEST_P(AudioControlAidl, RegisterModuleChangeNullCallbackThrowsException) {
+ ALOGI("Register Module change callback with nullptr test");
+ auto status = audioControl->setModuleChangeCallback(nullptr);
+ EXPECT_THAT(status.exceptionCode(),
+ AnyOf(Eq(Status::EX_ILLEGAL_ARGUMENT), Eq(Status::EX_UNSUPPORTED_OPERATION)));
+}
+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioControlAidl);
INSTANTIATE_TEST_SUITE_P(
Audiocontrol, AudioControlAidl,
diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvsServiceType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvsServiceType.aidl
index 1363a64..285732c 100644
--- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvsServiceType.aidl
+++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvsServiceType.aidl
@@ -36,4 +36,11 @@
enum EvsServiceType {
REARVIEW = 0,
SURROUNDVIEW = 1,
+ FRONTVIEW = 2,
+ LEFTVIEW = 3,
+ RIGHTVIEW = 4,
+ DRIVERVIEW = 5,
+ FRONTPASSENGERSVIEW = 6,
+ REARPASSENGERSVIEW = 7,
+ USER_DEFINED = 1000,
}
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvsServiceType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvsServiceType.aidl
index 6c621f7..20582dc 100644
--- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvsServiceType.aidl
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvsServiceType.aidl
@@ -24,4 +24,11 @@
enum EvsServiceType {
REARVIEW = 0,
SURROUNDVIEW = 1,
+ FRONTVIEW = 2,
+ LEFTVIEW = 3,
+ RIGHTVIEW = 4,
+ DRIVERVIEW = 5,
+ FRONTPASSENGERSVIEW = 6,
+ REARPASSENGERSVIEW = 7,
+ USER_DEFINED = 1000,
}
diff --git a/biometrics/fingerprint/aidl/default/fingerprint-example.rc b/biometrics/fingerprint/aidl/default/fingerprint-example.rc
index 10db00d..ee4713c 100644
--- a/biometrics/fingerprint/aidl/default/fingerprint-example.rc
+++ b/biometrics/fingerprint/aidl/default/fingerprint-example.rc
@@ -2,8 +2,6 @@
class hal
user nobody
group nobody
+ interface aidl android.hardware.biometrics.fingerprint.IFingerprint/virtual
+ oneshot
disabled
-on property:ro.vendor.fingerprint_virtual_hal_start=true
- enable vendor.fingerprint-example
-on property:persist.vendor.fingerprint.virtual.type=*
- enable vendor.fingerprint-example
diff --git a/biometrics/fingerprint/aidl/default/main.cpp b/biometrics/fingerprint/aidl/default/main.cpp
index 0e672b1..7df015b 100644
--- a/biometrics/fingerprint/aidl/default/main.cpp
+++ b/biometrics/fingerprint/aidl/default/main.cpp
@@ -28,8 +28,10 @@
std::shared_ptr<Fingerprint> hal = ndk::SharedRefBase::make<Fingerprint>();
const std::string instance = std::string(Fingerprint::descriptor) + "/virtual";
- binder_status_t status = AServiceManager_addService(hal->asBinder().get(), instance.c_str());
+ binder_status_t status =
+ AServiceManager_registerLazyService(hal->asBinder().get(), instance.c_str());
CHECK_EQ(status, STATUS_OK);
+ AServiceManager_forceLazyServicesPersist(true);
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reach
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LatencyMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LatencyMode.aidl
index 5583679..1140f9e 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LatencyMode.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LatencyMode.aidl
@@ -34,7 +34,9 @@
package android.hardware.bluetooth.audio;
@Backing(type="int") @VintfStability
enum LatencyMode {
- UNKNOWN = 0,
- LOW_LATENCY = 1,
- FREE = 2,
+ UNKNOWN,
+ LOW_LATENCY,
+ FREE,
+ DYNAMIC_SPATIAL_AUDIO_SOFTWARE,
+ DYNAMIC_SPATIAL_AUDIO_HARDWARE,
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
index edb6795..679655c 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
@@ -42,5 +42,6 @@
parcelable StreamMap {
char streamHandle;
int audioChannelAllocation;
+ boolean isStreamActive;
}
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LatencyMode.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LatencyMode.aidl
index 0c354f7..ec181c1 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LatencyMode.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LatencyMode.aidl
@@ -22,4 +22,6 @@
UNKNOWN,
LOW_LATENCY,
FREE,
+ DYNAMIC_SPATIAL_AUDIO_SOFTWARE,
+ DYNAMIC_SPATIAL_AUDIO_HARDWARE
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
index 0d1e3de..f22f309 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
@@ -35,6 +35,10 @@
* Audio Location assigned number.
*/
int audioChannelAllocation;
+ /*
+ * The stream handle status
+ */
+ boolean isStreamActive;
}
CodecType codecType;
StreamMap[] streamMap;
diff --git a/compatibility_matrices/compatibility_matrix.4.xml b/compatibility_matrices/compatibility_matrix.4.xml
index 8ef0b3a..c898aab 100644
--- a/compatibility_matrices/compatibility_matrix.4.xml
+++ b/compatibility_matrices/compatibility_matrix.4.xml
@@ -171,7 +171,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <hal format="hidl" optional="true">
<name>android.hardware.gatekeeper</name>
<version>1.0</version>
<interface>
diff --git a/compatibility_matrices/compatibility_matrix.5.xml b/compatibility_matrices/compatibility_matrix.5.xml
index 12b85c7..c5a1dc2 100644
--- a/compatibility_matrices/compatibility_matrix.5.xml
+++ b/compatibility_matrices/compatibility_matrix.5.xml
@@ -192,7 +192,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <hal format="hidl" optional="true">
<name>android.hardware.gatekeeper</name>
<version>1.0</version>
<interface>
diff --git a/compatibility_matrices/compatibility_matrix.6.xml b/compatibility_matrices/compatibility_matrix.6.xml
index e19d2dd..1c76ee6 100644
--- a/compatibility_matrices/compatibility_matrix.6.xml
+++ b/compatibility_matrices/compatibility_matrix.6.xml
@@ -215,7 +215,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <hal format="hidl" optional="true">
<name>android.hardware.gatekeeper</name>
<version>1.0</version>
<interface>
diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp
index b17c0e2..f3374c3 100644
--- a/compatibility_matrices/exclude/fcm_exclude.cpp
+++ b/compatibility_matrices/exclude/fcm_exclude.cpp
@@ -64,6 +64,7 @@
"android.hardware.keymaster",
"android.hardware.media.bufferpool2",
"android.hardware.radio",
+ "android.hardware.threadnetwork",
"android.hardware.uwb.fira_android",
// Fastboot HAL is only used by recovery. Recovery is owned by OEM. Framework
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl
index 6e844ef..f02f8aa 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl
@@ -44,4 +44,5 @@
SKIP_VALIDATE = 4,
BOOT_DISPLAY_CONFIG = 5,
HDR_OUTPUT_CONVERSION_CONFIG = 6,
+ REFRESH_RATE_CHANGED_CALLBACK_DEBUG = 7,
}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Composition.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Composition.aidl
index d2d8f04..34d6822 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Composition.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Composition.aidl
@@ -41,4 +41,5 @@
CURSOR = 4,
SIDEBAND = 5,
DISPLAY_DECORATION = 6,
+ REFRESH_RATE_INDICATOR = 7,
}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl
index 21620e7..2c08cbe 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl
@@ -40,4 +40,5 @@
oneway void onVsync(long display, long timestamp, int vsyncPeriodNanos);
oneway void onVsyncPeriodTimingChanged(long display, in android.hardware.graphics.composer3.VsyncPeriodChangeTimeline updatedTimeline);
oneway void onVsyncIdle(long display);
+ oneway void onRefreshRateChangedDebug(in android.hardware.graphics.composer3.RefreshRateChangedDebugData data);
}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
index 10ce067..af82b83 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
@@ -78,6 +78,7 @@
android.hardware.graphics.composer3.OverlayProperties getOverlaySupport();
android.hardware.graphics.common.HdrConversionCapability[] getHdrConversionCapabilities();
void setHdrConversionStrategy(in android.hardware.graphics.common.HdrConversionStrategy conversionStrategy);
+ void setRefreshRateChangedCallbackDebugEnabled(long display, boolean enabled);
const int EX_BAD_CONFIG = 1;
const int EX_BAD_DISPLAY = 2;
const int EX_BAD_LAYER = 3;
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl
similarity index 76%
copy from audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl
copy to graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl
index 50a5528..2b9801a 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl
@@ -1,11 +1,11 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
+/**
+ * Copyright 2023, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -31,15 +31,9 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.audio.core;
-@JavaDerive(equals=true, toString=true) @VintfStability
-parcelable MicrophoneDynamicInfo {
- @utf8InCpp String id;
- android.hardware.audio.core.MicrophoneDynamicInfo.ChannelMapping[] channelMapping;
- @Backing(type="int") @VintfStability
- enum ChannelMapping {
- UNUSED = 0,
- DIRECT = 1,
- PROCESSED = 2,
- }
+package android.hardware.graphics.composer3;
+@VintfStability
+parcelable RefreshRateChangedDebugData {
+ long display;
+ int vsyncPeriodNanos;
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl
index 509a8f4..4638610 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl
@@ -75,4 +75,15 @@
* @see IComposerClient.setHdrConversionStrategy
*/
HDR_OUTPUT_CONVERSION_CONFIG = 6,
+
+ /**
+ * Specifies that the device supports the callback onRefreshRateChangedDebug
+ * to pass information about the refresh rate.
+ * The refresh rate from the callback is used to update the refresh rate
+ * overlay indicator.
+ *
+ * @see IComposerClient.setRefreshRateChangedCallbackDebugEnabled
+ * @see IComposerCallback.onRefreshRateChangedDebug
+ */
+ REFRESH_RATE_CHANGED_CALLBACK_DEBUG = 7,
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl
index 82b218b..37912b0 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl
@@ -86,4 +86,14 @@
* to either DEVICE or CLIENT.
*/
DISPLAY_DECORATION = 6,
+
+ /**
+ * This composition type is similar to DEVICE, with a single difference,
+ * that indicates to HWC that this layer update is not considered an activity
+ * of any sort. For example, If HWC maintains a timer for activity to switch
+ * the display mode from a power save mode, it should not reset that timer.
+ *
+ * Upon validateDisplay, the device may request a change from this type to CLIENT.
+ */
+ REFRESH_RATE_INDICATOR = 7,
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl
index 67954d4..f4384b7 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl
@@ -16,6 +16,7 @@
package android.hardware.graphics.composer3;
+import android.hardware.graphics.composer3.RefreshRateChangedDebugData;
import android.hardware.graphics.composer3.VsyncPeriodChangeTimeline;
@VintfStability
@@ -96,4 +97,25 @@
* @param display is the display whose vsync cadence changed due to panel idle mode.
*/
oneway void onVsyncIdle(long display);
+
+ /**
+ * Notifies the client the vsyncPeriod of the display changed.
+ * Whether or not to call this callback is managed by
+ * IComposerClient.setRefreshRateChangedCallbackDebugEnabled
+ *
+ * Immediate callback is required after the setRefreshRateChangedCallbackDebugEnabled
+ * called.
+ * When the panel refresh rate changes, as a result of a setActiveConfig or
+ * setActiveConfigWithConstraints, this callback should be called with the new panel
+ * refresh rate. In addition, when the panel refresh rate is changed by other means,
+ * such as idleness or DOZE power state, this callback should be called as well.
+ *
+ * This callback is used for debug purposes, and not for scheduling frames,
+ * therefore synchronization is not required.
+ *
+ * @see IComposerClient.setRefreshRateChangedCallbackDebugEnabled
+ *
+ * @param data is the data for the callback when refresh rate changed.
+ */
+ oneway void onRefreshRateChangedDebug(in RefreshRateChangedDebugData data);
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
index 17924b9..fe6483e 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
@@ -850,4 +850,16 @@
* @see getHdrConversionCapabilities
*/
void setHdrConversionStrategy(in HdrConversionStrategy conversionStrategy);
+
+ /*
+ * Sets either the callback for the refresh rate change is enabled or disabled
+ * for the provided display.
+ *
+ * @see IComposerCallback.onRefreshRateChangedDebug
+ *
+ * @param display is the display on which the callback is enabled on.
+ * @param enabled true when refresh rate callback is enabled,
+ * false when refresh rate callback is disabled.
+ */
+ void setRefreshRateChangedCallbackDebugEnabled(long display, boolean enabled);
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl
new file mode 100644
index 0000000..c1f78d6
--- /dev/null
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl
@@ -0,0 +1,30 @@
+/**
+ * Copyright 2023, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.graphics.composer3;
+
+@VintfStability
+parcelable RefreshRateChangedDebugData {
+ /**
+ * The display for which the debug data is for.
+ */
+ long display;
+
+ /**
+ * The display vsync period in nanoseconds.
+ */
+ int vsyncPeriodNanos;
+}
diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp
index d534943..4fb5d01 100644
--- a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp
+++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp
@@ -124,6 +124,12 @@
return ::ndk::ScopedAStatus::ok();
}
+::ndk::ScopedAStatus GraphicsComposerCallback::onRefreshRateChangedDebug(
+ const RefreshRateChangedDebugData&) {
+ // TODO(b/202734676) Add implementation for Vts tests
+ return ::ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+}
+
::ndk::ScopedAStatus GraphicsComposerCallback::onVsyncPeriodTimingChanged(
int64_t in_display,
const ::aidl::android::hardware::graphics::composer3::VsyncPeriodChangeTimeline&
diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.h b/graphics/composer/aidl/vts/GraphicsComposerCallback.h
index e54da34..9c3bc70 100644
--- a/graphics/composer/aidl/vts/GraphicsComposerCallback.h
+++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.h
@@ -55,6 +55,8 @@
const ::aidl::android::hardware::graphics::composer3::VsyncPeriodChangeTimeline&
in_updatedTimeline) override;
virtual ::ndk::ScopedAStatus onVsyncIdle(int64_t in_display) override;
+ virtual ::ndk::ScopedAStatus onRefreshRateChangedDebug(
+ const RefreshRateChangedDebugData&) override;
mutable std::mutex mMutex;
// the set of all currently connected displays
diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp
index f95e747..2e2b193 100644
--- a/graphics/composer/aidl/vts/VtsComposerClient.cpp
+++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp
@@ -373,6 +373,12 @@
return mComposerCallback->getVsyncIdleTime();
}
+ndk::ScopedAStatus VtsComposerClient::setRefreshRateChangedCallbackDebugEnabled(
+ int64_t /* display */, bool /* enabled */) {
+ // TODO(b/202734676) Add implementation for VTS tests
+ return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+}
+
int64_t VtsComposerClient::getInvalidDisplayId() {
// returns an invalid display id (one that has not been registered to a
// display. Currently assuming that a device will never have close to
diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h
index 27788e7..aee46d2 100644
--- a/graphics/composer/aidl/vts/VtsComposerClient.h
+++ b/graphics/composer/aidl/vts/VtsComposerClient.h
@@ -196,6 +196,9 @@
bool verifyComposerCallbackParams();
+ ndk::ScopedAStatus setRefreshRateChangedCallbackDebugEnabled(int64_t /* display */,
+ bool /* enabled */);
+
// Keep track of displays and layers. When a test fails/ends,
// the VtsComposerClient::tearDown should be called from the
// test tearDown to clean up the resources for the test.
diff --git a/secure_element/aidl/vts/VtsHalSecureElementTargetTest.cpp b/secure_element/aidl/vts/VtsHalSecureElementTargetTest.cpp
index 37ff1b2..2e96f7d 100644
--- a/secure_element/aidl/vts/VtsHalSecureElementTargetTest.cpp
+++ b/secure_element/aidl/vts/VtsHalSecureElementTargetTest.cpp
@@ -106,6 +106,15 @@
EXPECT_OK(secure_element_->init(secure_element_callback_));
secure_element_callback_->expectCallbackHistory({true});
+
+ // Check if the basic channel is supported by the bound SE.
+ std::vector<uint8_t> basic_channel_response;
+ auto status =
+ secure_element_->openBasicChannel(kSelectableAid, 0x00, &basic_channel_response);
+ if (status.isOk()) {
+ basic_channel_supported_ = true;
+ secure_element_->closeChannel(0);
+ }
}
void TearDown() override {
@@ -143,6 +152,7 @@
std::shared_ptr<ISecureElement> secure_element_;
std::shared_ptr<MySecureElementCallback> secure_element_callback_;
+ bool basic_channel_supported_{false};
};
TEST_P(SecureElementAidl, init) {
@@ -159,14 +169,18 @@
LogicalChannelResponse logical_channel_response;
// reset called after init shall succeed.
- EXPECT_OK(secure_element_->openBasicChannel(kSelectableAid, 0x00, &basic_channel_response));
+ if (basic_channel_supported_) {
+ EXPECT_OK(secure_element_->openBasicChannel(kSelectableAid, 0x00, &basic_channel_response));
+ }
EXPECT_OK(secure_element_->openLogicalChannel(kSelectableAid, 0x00, &logical_channel_response));
EXPECT_OK(secure_element_->reset());
secure_element_callback_->expectCallbackHistory({true, false, true});
// All opened channels must be closed.
- EXPECT_NE(transmit(0), 0x9000);
+ if (basic_channel_supported_) {
+ EXPECT_NE(transmit(0), 0x9000);
+ }
EXPECT_NE(transmit(logical_channel_response.channelNumber), 0x9000);
}
@@ -190,6 +204,10 @@
TEST_P(SecureElementAidl, openBasicChannel) {
std::vector<uint8_t> response;
+ if (!basic_channel_supported_) {
+ return;
+ }
+
// openBasicChannel called with an invalid AID shall fail.
EXPECT_ERR(secure_element_->openBasicChannel(kNonSelectableAid, 0x00, &response));
@@ -199,7 +217,7 @@
EXPECT_OK(secure_element_->openBasicChannel(kSelectableAid, 0x00, &response));
EXPECT_GE(response.size(), 2u);
- // tramsmit called on the basic channel should succeed.
+ // transmit called on the basic channel should succeed.
EXPECT_EQ(transmit(0), 0x9000);
// openBasicChannel called a second time shall fail.
@@ -225,7 +243,7 @@
EXPECT_GE(response.channelNumber, 1u);
EXPECT_LE(response.channelNumber, 19u);
- // tramsmit called on the logical channel should succeed.
+ // transmit called on the logical channel should succeed.
EXPECT_EQ(transmit(response.channelNumber), 0x9000);
}
@@ -239,17 +257,19 @@
EXPECT_ERR(secure_element_->closeChannel(1));
// closeChannel called on basic channel closes the basic channel.
- EXPECT_OK(secure_element_->openBasicChannel(kSelectableAid, 0x00, &basic_channel_response));
- EXPECT_OK(secure_element_->closeChannel(0));
+ if (basic_channel_supported_) {
+ EXPECT_OK(secure_element_->openBasicChannel(kSelectableAid, 0x00, &basic_channel_response));
+ EXPECT_OK(secure_element_->closeChannel(0));
- // tramsmit called on the basic channel should fail.
- EXPECT_NE(transmit(0), 0x9000);
+ // transmit called on the basic channel should fail.
+ EXPECT_NE(transmit(0), 0x9000);
+ }
// closeChannel called on logical channel closes the logical channel.
EXPECT_OK(secure_element_->openLogicalChannel(kSelectableAid, 0x00, &logical_channel_response));
EXPECT_OK(secure_element_->closeChannel(logical_channel_response.channelNumber));
- // tramsmit called on the basic channel should fail.
+ // transmit called on the logical channel should fail.
EXPECT_NE(transmit(logical_channel_response.channelNumber), 0x9000);
}
diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash
index 404553b..1397c05 100644
--- a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash
+++ b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash
@@ -1 +1,2 @@
+976674616001f714f4a4df49ee45f548de828524
d285480d2e0002adc0ace80edf34aa725679512e
diff --git a/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl b/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl
index 57ee8cf..de94264 100644
--- a/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl
+++ b/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl
@@ -70,7 +70,7 @@
* ; HKDF. See details on use in ProtectedData comments above. The public key data
* ; included in the other field of PartyUInfo / PartyVInfo is encoded as:
* ; - a raw 32-byte public key for X25519
- * ; - uncompressed SEC-1 coordinate data (0x04 || x || y) for P-256
+ * ; - raw coordinate data (x || y) for P-256
* Context = [
* AlgorithmID : 3 ; AES-GCM 256
* PartyUInfo : [
diff --git a/staging/threadnetwork/aidl/Android.bp b/staging/threadnetwork/aidl/Android.bp
new file mode 100644
index 0000000..fcd3ab8
--- /dev/null
+++ b/staging/threadnetwork/aidl/Android.bp
@@ -0,0 +1,17 @@
+aidl_interface {
+ name: "android.hardware.threadnetwork",
+ host_supported: true,
+ vendor_available: true,
+
+ srcs: [
+ "android/hardware/threadnetwork/*.aidl",
+ ],
+
+ unstable: true,
+
+ backend: {
+ ndk: {
+ enabled: true,
+ },
+ },
+}
diff --git a/staging/threadnetwork/aidl/android/hardware/threadnetwork/IThreadChip.aidl b/staging/threadnetwork/aidl/android/hardware/threadnetwork/IThreadChip.aidl
new file mode 100644
index 0000000..3c57149
--- /dev/null
+++ b/staging/threadnetwork/aidl/android/hardware/threadnetwork/IThreadChip.aidl
@@ -0,0 +1,88 @@
+/*
+ * 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.threadnetwork;
+
+import android.hardware.threadnetwork.IThreadChipCallback;
+
+/**
+ * Controls a Thread radio chip on the device.
+ */
+
+interface IThreadChip {
+ /**
+ * The operation failed for the internal error.
+ */
+ const int ERROR_FAILED = 1;
+
+ /**
+ * Insufficient buffers available to send frames.
+ */
+ const int ERROR_NO_BUFS = 2;
+
+ /**
+ * Service is busy and could not service the operation.
+ */
+ const int ERROR_BUSY = 3;
+
+ /**
+ * This method initializes the Thread HAL instance. If open completes
+ * successfully, then the Thread HAL instance is ready to accept spinel
+ * messages through sendSpinelFrame() API.
+ *
+ * @param callback A IThreadChipCallback callback instance. If multiple
+ * callbacks are passed in, the open() will return ERROR_BUSY.
+ *
+ * @throws EX_ILLEGAL_ARGUMENT if the callback handle is invalid (for example, it is null).
+ * @throws ServiceSpecificException with one of the following values:
+ * - ERROR_FAILED The interface cannot be opened due to an internal error.
+ * - ERROR_BUSY This interface is in use.
+ */
+ void open(in IThreadChipCallback callback);
+
+ /**
+ * Close the Thread HAL instance. Must free all resources.
+ *
+ * @throws EX_ILLEGAL_STATE if the Thread HAL instance is not opened.
+ *
+ */
+ void close();
+
+ /**
+ * This method resets the Thread HAL internal state. The callback registered by
+ * `open()` won’t be reset and the resource allocated by `open()` won’t be free.
+ *
+ */
+ void reset();
+
+ /**
+ * This method sends a spinel frame to the Thread HAL.
+ *
+ * This method should block until the frame is sent out successfully or
+ * the method throws errors immediately.
+ *
+ * Spinel Protocol:
+ * https://github.com/openthread/openthread/blob/main/src/lib/spinel/spinel.h
+ *
+ * @param frame The spinel frame to be sent.
+ *
+ * @throws ServiceSpecificException with one of the following values:
+ * - ERROR_FAILED The Thread HAL failed to send the frame for an internal reason.
+ * - ERROR_NO_BUFS Insufficient buffer space to send the frame.
+ * - ERROR_BUSY The Thread HAL is busy.
+ */
+ void sendSpinelFrame(in byte[] frame);
+}
diff --git a/staging/threadnetwork/aidl/android/hardware/threadnetwork/IThreadChipCallback.aidl b/staging/threadnetwork/aidl/android/hardware/threadnetwork/IThreadChipCallback.aidl
new file mode 100644
index 0000000..a0fe88c
--- /dev/null
+++ b/staging/threadnetwork/aidl/android/hardware/threadnetwork/IThreadChipCallback.aidl
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.threadnetwork;
+
+interface IThreadChipCallback {
+ /**
+ * This method is called when a spinel frame is received. Thread network
+ * will process the received spinel frame.
+ *
+ * Spinel Protocol:
+ * https://github.com/openthread/openthread/blob/main/src/lib/spinel/spinel.h
+ *
+ * @param frame The received spinel frame.
+ */
+ oneway void onReceiveSpinelFrame(in byte[] frame);
+}
diff --git a/staging/threadnetwork/aidl/default/Android.bp b/staging/threadnetwork/aidl/default/Android.bp
new file mode 100644
index 0000000..c701295
--- /dev/null
+++ b/staging/threadnetwork/aidl/default/Android.bp
@@ -0,0 +1,54 @@
+// 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.
+
+cc_defaults {
+ name: "threadnetwork_service_default",
+ vendor: true,
+ relative_install_path: "hw",
+
+ shared_libs: [
+ "android.hardware.threadnetwork-ndk",
+ "libbase",
+ "libbinder_ndk",
+ "libcutils",
+ "liblog",
+ "libutils",
+ ],
+
+ static_libs: [
+ "openthread-common",
+ "openthread-hdlc",
+ "openthread-platform",
+ "openthread-posix",
+ "openthread-url",
+ ],
+
+ srcs: [
+ "main.cpp",
+ "service.cpp",
+ "thread_chip.cpp",
+ "utils.cpp",
+ ],
+}
+
+cc_binary {
+ name: "android.hardware.threadnetwork-service.sim",
+ defaults: ["threadnetwork_service_default"],
+ init_rc: ["android.hardware.threadnetwork-service.sim.rc"],
+}
+
+cc_binary {
+ name: "android.hardware.threadnetwork-service",
+ defaults: ["threadnetwork_service_default"],
+}
diff --git a/staging/threadnetwork/aidl/default/android.hardware.threadnetwork-service.sim.rc b/staging/threadnetwork/aidl/default/android.hardware.threadnetwork-service.sim.rc
new file mode 100644
index 0000000..2fb409c
--- /dev/null
+++ b/staging/threadnetwork/aidl/default/android.hardware.threadnetwork-service.sim.rc
@@ -0,0 +1,3 @@
+service vendor.threadnetwork_hal /vendor/bin/hw/android.hardware.threadnetwork-service.sim spinel+hdlc+forkpty:///vendor/bin/ot-rcp?forkpty-arg=1
+ class hal
+ user thread_network
diff --git a/staging/threadnetwork/aidl/default/main.cpp b/staging/threadnetwork/aidl/default/main.cpp
new file mode 100644
index 0000000..b6c8bbb
--- /dev/null
+++ b/staging/threadnetwork/aidl/default/main.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android-base/logging.h>
+#include <utils/Log.h>
+
+#include "service.hpp"
+
+int main(int argc, char* argv[]) {
+ CHECK_GT(argc, 1);
+ aidl::android::hardware::threadnetwork::Service service(&argv[1], argc - 1);
+
+ ALOGI("Thread Network HAL is running");
+
+ service.startLoop();
+ return EXIT_FAILURE; // should not reach
+}
diff --git a/staging/threadnetwork/aidl/default/service.cpp b/staging/threadnetwork/aidl/default/service.cpp
new file mode 100644
index 0000000..8047214
--- /dev/null
+++ b/staging/threadnetwork/aidl/default/service.cpp
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "service.hpp"
+
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+#include <utils/Log.h>
+
+#include "thread_chip.hpp"
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace threadnetwork {
+
+Service::Service(char* urls[], int numUrls) : mBinderFd(-1) {
+ int fd;
+
+ CHECK_NE(urls, nullptr);
+ CHECK_GT(numUrls, 0);
+
+ for (int i = 0; i < numUrls; i++) {
+ auto threadChip = ndk::SharedRefBase::make<ThreadChip>(i, urls[i]);
+ CHECK_NE(threadChip, nullptr);
+ mThreadChips.push_back(std::move(threadChip));
+ }
+
+ binder_status_t status = ABinderProcess_setupPolling(&fd);
+ CHECK_EQ(status, ::STATUS_OK);
+ CHECK_GE(fd, 0);
+ mBinderFd.reset(fd);
+}
+
+void Service::Update(otSysMainloopContext& context) {
+ FD_SET(mBinderFd.get(), &context.mReadFdSet);
+ context.mMaxFd = std::max(context.mMaxFd, mBinderFd.get());
+}
+
+void Service::Process(const otSysMainloopContext& context) {
+ if (FD_ISSET(mBinderFd.get(), &context.mReadFdSet)) {
+ ABinderProcess_handlePolledCommands();
+ }
+}
+
+void Service::startLoop(void) {
+ const struct timeval kPollTimeout = {1, 0};
+ otSysMainloopContext context;
+ int rval;
+
+ ot::Posix::Mainloop::Manager::Get().Add(*this);
+
+ while (true) {
+ context.mMaxFd = -1;
+ context.mTimeout = kPollTimeout;
+
+ FD_ZERO(&context.mReadFdSet);
+ FD_ZERO(&context.mWriteFdSet);
+ FD_ZERO(&context.mErrorFdSet);
+
+ ot::Posix::Mainloop::Manager::Get().Update(context);
+
+ rval = select(context.mMaxFd + 1, &context.mReadFdSet, &context.mWriteFdSet,
+ &context.mErrorFdSet, &context.mTimeout);
+
+ if (rval >= 0) {
+ ot::Posix::Mainloop::Manager::Get().Process(context);
+ } else if (errno != EINTR) {
+ ALOGE("select() failed: %s", strerror(errno));
+ break;
+ }
+ }
+}
+} // namespace threadnetwork
+} // namespace hardware
+} // namespace android
+} // namespace aidl
diff --git a/staging/threadnetwork/aidl/default/service.hpp b/staging/threadnetwork/aidl/default/service.hpp
new file mode 100644
index 0000000..6e6e868
--- /dev/null
+++ b/staging/threadnetwork/aidl/default/service.hpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android-base/unique_fd.h>
+
+#include "mainloop.hpp"
+#include "thread_chip.hpp"
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace threadnetwork {
+
+class Service : public ot::Posix::Mainloop::Source {
+ public:
+ Service(char* urls[], int numUrls);
+
+ void Update(otSysMainloopContext& context) override;
+ void Process(const otSysMainloopContext& context) override;
+ void startLoop(void);
+
+ private:
+ ::android::base::unique_fd mBinderFd;
+ std::vector<std::shared_ptr<ThreadChip>> mThreadChips;
+};
+} // namespace threadnetwork
+} // namespace hardware
+} // namespace android
+} // namespace aidl
diff --git a/staging/threadnetwork/aidl/default/thread_chip.cpp b/staging/threadnetwork/aidl/default/thread_chip.cpp
new file mode 100644
index 0000000..38abad4
--- /dev/null
+++ b/staging/threadnetwork/aidl/default/thread_chip.cpp
@@ -0,0 +1,197 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "thread_chip.hpp"
+
+#include <android-base/logging.h>
+#include <android/binder_auto_utils.h>
+#include <android/binder_ibinder.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+#include <utils/Log.h>
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace threadnetwork {
+
+static ndk::ScopedAStatus errorStatus(int32_t error, const char* message) {
+ return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(error, message));
+}
+
+ThreadChip::ThreadChip(uint8_t id, char* url)
+ : mUrl(),
+ mInterface(handleReceivedFrame, this, mRxFrameBuffer),
+ mRxFrameBuffer(),
+ mCallback(nullptr) {
+ const std::string name(std::string() + IThreadChip::descriptor + "/chip" + std::to_string(id));
+ binder_status_t status;
+
+ ALOGI("ServiceName: %s, Url: %s", name.c_str(), url);
+ CHECK_EQ(mUrl.Init(url), 0);
+ status = AServiceManager_addService(asBinder().get(), name.c_str());
+ CHECK_EQ(status, STATUS_OK);
+
+ mDeathRecipient = ndk::ScopedAIBinder_DeathRecipient(
+ AIBinder_DeathRecipient_new(ThreadChip::onBinderDied));
+ AIBinder_DeathRecipient_setOnUnlinked(mDeathRecipient.get(), ThreadChip::onBinderUnlinked);
+}
+
+ThreadChip::~ThreadChip() {
+ AIBinder_DeathRecipient_delete(mDeathRecipient.get());
+}
+
+void ThreadChip::onBinderDied(void* context) {
+ reinterpret_cast<ThreadChip*>(context)->onBinderDied();
+}
+
+void ThreadChip::onBinderDied(void) {
+ ALOGW("Thread Network HAL client is dead.");
+}
+
+void ThreadChip::onBinderUnlinked(void* context) {
+ reinterpret_cast<ThreadChip*>(context)->onBinderUnlinked();
+}
+
+void ThreadChip::onBinderUnlinked(void) {
+ ALOGW("ThreadChip binder is unlinked.");
+ deinitChip();
+}
+
+void ThreadChip::handleReceivedFrame(void* context) {
+ reinterpret_cast<ThreadChip*>(context)->handleReceivedFrame();
+}
+
+void ThreadChip::handleReceivedFrame(void) {
+ if (mCallback != nullptr) {
+ mCallback->onReceiveSpinelFrame(std::vector<uint8_t>(
+ mRxFrameBuffer.GetFrame(), mRxFrameBuffer.GetFrame() + mRxFrameBuffer.GetLength()));
+ }
+
+ mRxFrameBuffer.DiscardFrame();
+}
+
+ndk::ScopedAStatus ThreadChip::open(const std::shared_ptr<IThreadChipCallback>& in_callback) {
+ ndk::ScopedAStatus status = initChip(in_callback);
+
+ if (status.isOk()) {
+ AIBinder_linkToDeath(in_callback->asBinder().get(), mDeathRecipient.get(), this);
+ ALOGI("Open IThreadChip successfully.");
+ } else {
+ ALOGW("Open IThreadChip failed, error: %s", status.getDescription().c_str());
+ }
+
+ return status;
+}
+
+ndk::ScopedAStatus ThreadChip::initChip(const std::shared_ptr<IThreadChipCallback>& in_callback) {
+ if (in_callback == nullptr) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+ } else if (mCallback == nullptr) {
+ if (mInterface.Init(mUrl) != OT_ERROR_NONE) {
+ return errorStatus(ERROR_FAILED, "Failed to initialize the interface");
+ }
+
+ mCallback = in_callback;
+ ot::Posix::Mainloop::Manager::Get().Add(*this);
+ return ndk::ScopedAStatus::ok();
+ } else {
+ return errorStatus(ERROR_BUSY, "Interface is already opened");
+ }
+}
+
+ndk::ScopedAStatus ThreadChip::close() {
+ ndk::ScopedAStatus status;
+ std::shared_ptr<IThreadChipCallback> callback = mCallback;
+
+ status = deinitChip();
+ if (status.isOk()) {
+ if (callback != nullptr) {
+ AIBinder_unlinkToDeath(callback->asBinder().get(), mDeathRecipient.get(), this);
+ }
+
+ ALOGI("Close IThreadChip successfully");
+ } else {
+ ALOGW("Close IThreadChip failed, error: %s", status.getDescription().c_str());
+ }
+
+ return status;
+}
+
+ndk::ScopedAStatus ThreadChip::deinitChip() {
+ if (mCallback != nullptr) {
+ mInterface.Deinit();
+ ot::Posix::Mainloop::Manager::Get().Remove(*this);
+ mCallback = nullptr;
+ return ndk::ScopedAStatus::ok();
+ }
+
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+}
+
+ndk::ScopedAStatus ThreadChip::sendSpinelFrame(const std::vector<uint8_t>& in_frame) {
+ ndk::ScopedAStatus status;
+ otError error;
+
+ if (mCallback == nullptr) {
+ status = errorStatus(ERROR_FAILED, "The interface is not open");
+ } else {
+ error = mInterface.SendFrame(reinterpret_cast<const uint8_t*>(in_frame.data()),
+ in_frame.size());
+ if (error == OT_ERROR_NONE) {
+ status = ndk::ScopedAStatus::ok();
+ } else if (error == OT_ERROR_NO_BUFS) {
+ status = errorStatus(ERROR_NO_BUFS, "Insufficient buffer space to send");
+ } else if (error == OT_ERROR_BUSY) {
+ status = errorStatus(ERROR_BUSY, "The interface is busy");
+ } else {
+ status = errorStatus(ERROR_FAILED, "Failed to send the spinel frame");
+ }
+ }
+
+ if (!status.isOk()) {
+ ALOGW("Send spinel frame failed, error: %s", status.getDescription().c_str());
+ }
+
+ return status;
+}
+
+ndk::ScopedAStatus ThreadChip::reset() {
+ mInterface.OnRcpReset();
+ ALOGI("reset()");
+ return ndk::ScopedAStatus::ok();
+}
+
+void ThreadChip::Update(otSysMainloopContext& context) {
+ if (mCallback != nullptr) {
+ mInterface.UpdateFdSet(context.mReadFdSet, context.mWriteFdSet, context.mMaxFd,
+ context.mTimeout);
+ }
+}
+
+void ThreadChip::Process(const otSysMainloopContext& context) {
+ struct RadioProcessContext radioContext;
+
+ if (mCallback != nullptr) {
+ radioContext.mReadFdSet = &context.mReadFdSet;
+ radioContext.mWriteFdSet = &context.mWriteFdSet;
+ mInterface.Process(radioContext);
+ }
+}
+} // namespace threadnetwork
+} // namespace hardware
+} // namespace android
+} // namespace aidl
diff --git a/staging/threadnetwork/aidl/default/thread_chip.hpp b/staging/threadnetwork/aidl/default/thread_chip.hpp
new file mode 100644
index 0000000..da5cba7
--- /dev/null
+++ b/staging/threadnetwork/aidl/default/thread_chip.hpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/threadnetwork/BnThreadChip.h>
+#include <aidl/android/hardware/threadnetwork/IThreadChipCallback.h>
+
+#include "hdlc_interface.hpp"
+#include "lib/spinel/spinel_interface.hpp"
+#include "mainloop.hpp"
+
+#include <android/binder_auto_utils.h>
+#include <android/binder_ibinder.h>
+#include <utils/Mutex.h>
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace threadnetwork {
+
+class ThreadChip : public BnThreadChip, ot::Posix::Mainloop::Source {
+ public:
+ ThreadChip(uint8_t id, char* url);
+ ~ThreadChip();
+
+ ndk::ScopedAStatus open(const std::shared_ptr<IThreadChipCallback>& in_callback) override;
+ ndk::ScopedAStatus close() override;
+ ndk::ScopedAStatus sendSpinelFrame(const std::vector<uint8_t>& in_frame) override;
+ ndk::ScopedAStatus reset() override;
+ void Update(otSysMainloopContext& context) override;
+ void Process(const otSysMainloopContext& context) override;
+
+ private:
+ static void onBinderDied(void* context);
+ void onBinderDied(void);
+ static void onBinderUnlinked(void* context);
+ void onBinderUnlinked(void);
+ static void handleReceivedFrame(void* context);
+ void handleReceivedFrame(void);
+
+ ndk::ScopedAStatus initChip(const std::shared_ptr<IThreadChipCallback>& in_callback);
+ ndk::ScopedAStatus deinitChip();
+
+ ot::Url::Url mUrl;
+ ot::Posix::HdlcInterface mInterface;
+ ot::Spinel::SpinelInterface::RxFrameBuffer mRxFrameBuffer;
+ std::shared_ptr<IThreadChipCallback> mCallback;
+ ::ndk::ScopedAIBinder_DeathRecipient mDeathRecipient;
+};
+
+} // namespace threadnetwork
+} // namespace hardware
+} // namespace android
+} // namespace aidl
diff --git a/staging/threadnetwork/aidl/default/utils.cpp b/staging/threadnetwork/aidl/default/utils.cpp
new file mode 100644
index 0000000..d3b4062
--- /dev/null
+++ b/staging/threadnetwork/aidl/default/utils.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <openthread/logging.h>
+#include <utils/Log.h>
+
+void otLogCritPlat(const char* format, ...) {
+ va_list args;
+
+ va_start(args, format);
+ __android_log_vprint(ANDROID_LOG_FATAL, LOG_TAG, format, args);
+ va_end(args);
+}
+
+void otLogWarnPlat(const char* format, ...) {
+ va_list args;
+
+ va_start(args, format);
+ __android_log_vprint(ANDROID_LOG_WARN, LOG_TAG, format, args);
+ va_end(args);
+}
diff --git a/staging/threadnetwork/aidl/vts/Android.bp b/staging/threadnetwork/aidl/vts/Android.bp
new file mode 100644
index 0000000..70386d9
--- /dev/null
+++ b/staging/threadnetwork/aidl/vts/Android.bp
@@ -0,0 +1,38 @@
+//
+// 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.
+//
+
+cc_test {
+ name: "VtsHalThreadNetworkTargetTest",
+ defaults: [
+ "VtsHalTargetTestDefaults",
+ "use_libaidlvintf_gtest_helper_static",
+ ],
+ srcs: [
+ "VtsHalThreadNetworkTargetTest.cpp",
+ ],
+
+ shared_libs: [
+ "libbinder",
+ "libbinder_ndk",
+ ],
+ static_libs: [
+ "android.hardware.threadnetwork-ndk",
+ ],
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
+}
diff --git a/staging/threadnetwork/aidl/vts/VtsHalThreadNetworkTargetTest.cpp b/staging/threadnetwork/aidl/vts/VtsHalThreadNetworkTargetTest.cpp
new file mode 100644
index 0000000..3e43f9c
--- /dev/null
+++ b/staging/threadnetwork/aidl/vts/VtsHalThreadNetworkTargetTest.cpp
@@ -0,0 +1,149 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "ThreadNetworkHalTargetTest"
+
+#include <future>
+
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+#include <android-base/logging.h>
+#include <android/binder_auto_utils.h>
+#include <android/binder_manager.h>
+#include <binder/IServiceManager.h>
+#include <binder/ProcessState.h>
+#include <log/log.h>
+
+#include <aidl/android/hardware/threadnetwork/BnThreadChipCallback.h>
+#include <aidl/android/hardware/threadnetwork/IThreadChip.h>
+
+using aidl::android::hardware::threadnetwork::BnThreadChipCallback;
+using aidl::android::hardware::threadnetwork::IThreadChip;
+using android::ProcessState;
+using ndk::ScopedAStatus;
+using ndk::SpAIBinder;
+
+namespace {
+constexpr static int kCallbackTimeoutMs = 5000;
+} // namespace
+
+class ThreadChipCallback : public BnThreadChipCallback {
+ public:
+ ThreadChipCallback(const std::function<void(const std::vector<uint8_t>&)>& on_spinel_message_cb)
+ : on_spinel_message_cb_(on_spinel_message_cb) {}
+
+ ScopedAStatus onReceiveSpinelFrame(const std::vector<uint8_t>& in_aFrame) {
+ on_spinel_message_cb_(in_aFrame);
+ return ScopedAStatus::ok();
+ }
+
+ private:
+ std::function<void(const std::vector<uint8_t>&)> on_spinel_message_cb_;
+};
+
+class ThreadNetworkAidl : public testing::TestWithParam<std::string> {
+ public:
+ virtual void SetUp() override {
+ std::string serviceName = GetParam();
+
+ ALOGI("serviceName: %s", serviceName.c_str());
+
+ thread_chip = IThreadChip::fromBinder(
+ SpAIBinder(AServiceManager_waitForService(serviceName.c_str())));
+ ASSERT_NE(thread_chip, nullptr);
+ }
+
+ virtual void TearDown() override { thread_chip->close(); }
+
+ std::shared_ptr<IThreadChip> thread_chip;
+};
+
+TEST_P(ThreadNetworkAidl, Open) {
+ std::shared_ptr<ThreadChipCallback> callback =
+ ndk::SharedRefBase::make<ThreadChipCallback>([](auto /* data */) {});
+
+ EXPECT_TRUE(thread_chip->open(callback).isOk());
+ EXPECT_EQ(thread_chip->open(callback).getServiceSpecificError(), IThreadChip::ERROR_BUSY);
+}
+
+TEST_P(ThreadNetworkAidl, Close) {
+ std::shared_ptr<ThreadChipCallback> callback =
+ ndk::SharedRefBase::make<ThreadChipCallback>([](auto /* data */) {});
+
+ EXPECT_TRUE(thread_chip->open(callback).isOk());
+ EXPECT_TRUE(thread_chip->close().isOk());
+ EXPECT_EQ(thread_chip->close().getExceptionCode(), EX_ILLEGAL_STATE);
+}
+
+TEST_P(ThreadNetworkAidl, Reset) {
+ std::shared_ptr<ThreadChipCallback> callback =
+ ndk::SharedRefBase::make<ThreadChipCallback>([](auto /* data */) {});
+
+ EXPECT_TRUE(thread_chip->open(callback).isOk());
+ EXPECT_TRUE(thread_chip->reset().isOk());
+}
+
+TEST_P(ThreadNetworkAidl, SendSpinelFrame) {
+ const uint8_t kCmdOffset = 2;
+ const uint8_t kMajorVersionOffset = 3;
+ const uint8_t kMinorVersionOffset = 4;
+ const std::vector<uint8_t> kGetSpinelProtocolVersion({0x81, 0x02, 0x01});
+ const std::vector<uint8_t> kGetSpinelProtocolVersionResponse({0x81, 0x06, 0x01, 0x04, 0x03});
+ uint8_t min_major_version = kGetSpinelProtocolVersionResponse[kMajorVersionOffset];
+ uint8_t min_minor_version = kGetSpinelProtocolVersionResponse[kMinorVersionOffset];
+ uint8_t major_version;
+ uint8_t minor_version;
+ std::promise<void> open_cb_promise;
+ std::future<void> open_cb_future{open_cb_promise.get_future()};
+ std::shared_ptr<ThreadChipCallback> callback;
+ std::vector<uint8_t> received_frame;
+ std::chrono::milliseconds timeout{kCallbackTimeoutMs};
+
+ callback = ndk::SharedRefBase::make<ThreadChipCallback>(
+ [&](const std::vector<uint8_t>& in_aFrame) {
+ if (in_aFrame.size() == kGetSpinelProtocolVersionResponse.size() &&
+ in_aFrame[kCmdOffset] == kGetSpinelProtocolVersionResponse[kCmdOffset]) {
+ major_version = in_aFrame[kMajorVersionOffset];
+ minor_version = in_aFrame[kMinorVersionOffset];
+ open_cb_promise.set_value();
+ }
+ });
+
+ ASSERT_NE(callback, nullptr);
+
+ EXPECT_TRUE(thread_chip->open(callback).isOk());
+
+ EXPECT_TRUE(thread_chip->sendSpinelFrame(kGetSpinelProtocolVersion).isOk());
+ EXPECT_EQ(open_cb_future.wait_for(timeout), std::future_status::ready);
+
+ EXPECT_GE(major_version, min_major_version);
+ if (major_version == min_major_version) {
+ EXPECT_GE(minor_version, min_minor_version);
+ }
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ThreadNetworkAidl);
+INSTANTIATE_TEST_SUITE_P(
+ Thread, ThreadNetworkAidl,
+ testing::ValuesIn(android::getAidlHalInstanceNames(IThreadChip::descriptor)),
+ android::PrintInstanceNameToString);
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ProcessState::self()->setThreadPoolMaxThreadCount(1);
+ ProcessState::self()->startThreadPool();
+ return RUN_ALL_TESTS();
+}
diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingDevice.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingDevice.aidl
index dfd8686..dff3c4c 100644
--- a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingDevice.aidl
+++ b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingDevice.aidl
@@ -33,7 +33,7 @@
package android.hardware.thermal;
/* @hide */
-@VintfStability
+@JavaDerive(toString=true) @VintfStability
parcelable CoolingDevice {
android.hardware.thermal.CoolingType type;
String name;
diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/Temperature.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/Temperature.aidl
index 3bf08bf..ce70ab8 100644
--- a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/Temperature.aidl
+++ b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/Temperature.aidl
@@ -33,7 +33,7 @@
package android.hardware.thermal;
/* @hide */
-@VintfStability
+@JavaDerive(toString=true) @VintfStability
parcelable Temperature {
android.hardware.thermal.TemperatureType type;
String name;
diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureThreshold.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureThreshold.aidl
index c5ca4b9..a384d19 100644
--- a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureThreshold.aidl
+++ b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureThreshold.aidl
@@ -33,7 +33,7 @@
package android.hardware.thermal;
/* @hide */
-@VintfStability
+@JavaDerive(toString=true) @VintfStability
parcelable TemperatureThreshold {
android.hardware.thermal.TemperatureType type;
String name;
diff --git a/thermal/aidl/android/hardware/thermal/CoolingDevice.aidl b/thermal/aidl/android/hardware/thermal/CoolingDevice.aidl
index 1f2360d..0c5c17d 100644
--- a/thermal/aidl/android/hardware/thermal/CoolingDevice.aidl
+++ b/thermal/aidl/android/hardware/thermal/CoolingDevice.aidl
@@ -20,6 +20,7 @@
/* @hide */
@VintfStability
+@JavaDerive(toString=true)
parcelable CoolingDevice {
/**
* This cooling device type, CPU, GPU, BATTERY, and etc.
diff --git a/thermal/aidl/android/hardware/thermal/Temperature.aidl b/thermal/aidl/android/hardware/thermal/Temperature.aidl
index 281d68d..b3f6700 100644
--- a/thermal/aidl/android/hardware/thermal/Temperature.aidl
+++ b/thermal/aidl/android/hardware/thermal/Temperature.aidl
@@ -21,6 +21,7 @@
/* @hide */
@VintfStability
+@JavaDerive(toString=true)
parcelable Temperature {
/**
* This temperature's type.
diff --git a/thermal/aidl/android/hardware/thermal/TemperatureThreshold.aidl b/thermal/aidl/android/hardware/thermal/TemperatureThreshold.aidl
index 0714c82..94991ae 100644
--- a/thermal/aidl/android/hardware/thermal/TemperatureThreshold.aidl
+++ b/thermal/aidl/android/hardware/thermal/TemperatureThreshold.aidl
@@ -20,6 +20,7 @@
/* @hide */
@VintfStability
+@JavaDerive(toString=true)
parcelable TemperatureThreshold {
/**
* This temperature's type.
diff --git a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp
index eb91e31..05cc8e0 100644
--- a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp
+++ b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp
@@ -95,20 +95,15 @@
mThermalCallback = ndk::SharedRefBase::make<ThermalCallback>();
ASSERT_NE(mThermalCallback, nullptr);
- auto status = mThermal->registerThermalChangedCallback(mThermalCallback);
- ASSERT_TRUE(status.isOk());
- // Expect to fail if register again
- status = mThermal->registerThermalChangedCallback(mThermalCallback);
- ASSERT_FALSE(status.isOk());
- ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
+ ::ndk::ScopedAStatus status = mThermal->registerThermalChangedCallback(mThermalCallback);
+ ASSERT_TRUE(status.isOk()) << status.getMessage();
}
void TearDown() override {
- auto status = mThermal->unregisterThermalChangedCallback(mThermalCallback);
- ASSERT_TRUE(status.isOk());
+ ::ndk::ScopedAStatus status = mThermal->unregisterThermalChangedCallback(mThermalCallback);
+ ASSERT_TRUE(status.isOk()) << status.getMessage();
// Expect to fail if unregister again
status = mThermal->unregisterThermalChangedCallback(mThermalCallback);
- ASSERT_FALSE(status.isOk());
ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
}
@@ -121,11 +116,144 @@
// This just calls into and back from our local ThermalChangedCallback impl.
TEST_P(ThermalAidlTest, NotifyThrottlingTest) {
std::shared_ptr<ThermalCallback> thermalCallback = ndk::SharedRefBase::make<ThermalCallback>();
- auto ret = thermalCallback->notifyThrottling(kThrottleTemp);
- ASSERT_TRUE(ret.isOk());
+ ::ndk::ScopedAStatus status = thermalCallback->notifyThrottling(kThrottleTemp);
+ ASSERT_TRUE(status.isOk()) << status.getMessage();
ASSERT_TRUE(thermalCallback->waitForCallback(200ms));
}
+// Test Thermal->registerThermalChangedCallback.
+TEST_P(ThermalAidlTest, RegisterThermalChangedCallbackTest) {
+ // Expect to fail with same callback
+ ::ndk::ScopedAStatus status = mThermal->registerThermalChangedCallback(mThermalCallback);
+ ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
+ // Expect to fail with null callback
+ status = mThermal->registerThermalChangedCallback(nullptr);
+ ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
+ std::shared_ptr<ThermalCallback> localThermalCallback =
+ ndk::SharedRefBase::make<ThermalCallback>();
+ // Expect to succeed with different callback
+ status = mThermal->registerThermalChangedCallback(localThermalCallback);
+ ASSERT_TRUE(status.isOk()) << status.getMessage();
+ ASSERT_TRUE(localThermalCallback->waitForCallback(200ms));
+ // Remove the local callback
+ status = mThermal->unregisterThermalChangedCallback(localThermalCallback);
+ ASSERT_TRUE(status.isOk()) << status.getMessage();
+ // Expect to fail with null callback
+ status = mThermal->unregisterThermalChangedCallback(nullptr);
+ ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
+}
+
+// Test Thermal->registerThermalChangedCallbackWithType.
+TEST_P(ThermalAidlTest, RegisterThermalChangedCallbackWithTypeTest) {
+ // Expect to fail with same callback
+ ::ndk::ScopedAStatus status = mThermal->registerThermalChangedCallbackWithType(
+ mThermalCallback, TemperatureType::SKIN);
+ ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
+ // Expect to fail with null callback
+ status = mThermal->registerThermalChangedCallbackWithType(nullptr, TemperatureType::SKIN);
+ ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
+ std::shared_ptr<ThermalCallback> localThermalCallback =
+ ndk::SharedRefBase::make<ThermalCallback>();
+ // Expect to succeed with different callback
+ status = mThermal->registerThermalChangedCallbackWithType(localThermalCallback,
+ TemperatureType::SKIN);
+ ASSERT_TRUE(status.isOk()) << status.getMessage();
+ ASSERT_TRUE(localThermalCallback->waitForCallback(200ms));
+ // Remove the local callback
+ status = mThermal->unregisterThermalChangedCallback(localThermalCallback);
+ ASSERT_TRUE(status.isOk()) << status.getMessage();
+ // Expect to fail with null callback
+ status = mThermal->unregisterThermalChangedCallback(nullptr);
+ ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
+}
+
+// Test Thermal->getCurrentTemperatures().
+TEST_P(ThermalAidlTest, TemperatureTest) {
+ std::vector<Temperature> ret;
+ ::ndk::ScopedAStatus status = mThermal->getTemperatures(&ret);
+ if (status.isOk()) {
+ for (auto& i : ret) {
+ EXPECT_LT(0u, i.name.size());
+ LOG(INFO) << i.name + " " + toString(i.type) << "\n";
+ }
+ } else {
+ ASSERT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode());
+ }
+
+ auto types = ::ndk::enum_range<TemperatureType>();
+ for (const auto& type : types) {
+ status = mThermal->getTemperaturesWithType(type, &ret);
+
+ if (status.isOk()) {
+ for (auto& i : ret) {
+ EXPECT_EQ(type, i.type) << "Expect type " + toString(type) + " but got " +
+ toString(i.type) + " for " + i.name;
+ EXPECT_LT(0u, i.name.size());
+ }
+ } else {
+ ASSERT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode());
+ }
+ }
+}
+
+// Test Thermal->getTemperatureThresholds().
+TEST_P(ThermalAidlTest, TemperatureThresholdTest) {
+ std::vector<TemperatureThreshold> ret;
+ ::ndk::ScopedAStatus status = mThermal->getTemperatureThresholds(&ret);
+ if (status.isOk()) {
+ for (auto& i : ret) {
+ EXPECT_LT(0u, i.name.size());
+ LOG(INFO) << i.name + " " + toString(i.type) << "\n";
+ }
+ } else {
+ ASSERT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode());
+ }
+
+ auto types = ::ndk::enum_range<TemperatureType>();
+ for (const auto& type : types) {
+ status = mThermal->getTemperatureThresholdsWithType(type, &ret);
+
+ if (status.isOk()) {
+ for (auto& i : ret) {
+ EXPECT_EQ(type, i.type) << "Expect type " + toString(type) + " but got " +
+ toString(i.type) + " for " + i.name;
+ EXPECT_LT(0u, i.name.size());
+ }
+ } else {
+ ASSERT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode());
+ }
+ }
+}
+
+// Test Thermal->getCoolingDevices().
+TEST_P(ThermalAidlTest, CoolingDeviceTest) {
+ std::vector<CoolingDevice> ret;
+ ::ndk::ScopedAStatus status = mThermal->getCoolingDevices(&ret);
+ if (status.isOk()) {
+ for (auto& i : ret) {
+ EXPECT_LT(0u, i.name.size());
+ LOG(INFO) << i.name + " " + toString(i.type) << "\n";
+ }
+ } else {
+ ASSERT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode());
+ }
+
+ auto types = ::ndk::enum_range<CoolingType>();
+ for (const auto& type : types) {
+ status = mThermal->getCoolingDevicesWithType(type, &ret);
+ if (status.isOk()) {
+ ASSERT_TRUE(status.isOk());
+ for (auto& i : ret) {
+ EXPECT_EQ(type, i.type) << "Expect type " + toString(type) + " but got " +
+ toString(i.type) + " for " + i.name;
+ EXPECT_LT(0u, i.name.size());
+ }
+ } else {
+ ASSERT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode());
+ }
+ }
+}
+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ThermalAidlTest);
INSTANTIATE_TEST_SUITE_P(
Thermal, ThermalAidlTest,
diff --git a/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp b/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp
index ca8c348..8f4411b 100644
--- a/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp
+++ b/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp
@@ -70,16 +70,21 @@
}
ScopedAStatus HdmiConnectionMock::setHpdSignal(HpdSignal signal, int32_t portId) {
- if (mHdmiThreadRun) {
- mHpdSignal.at(portId - 1) = signal;
- return ScopedAStatus::ok();
- } else {
+ if (portId > mTotalPorts || portId < 1) {
+ return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+ }
+ if (!mHdmiThreadRun) {
return ScopedAStatus::fromServiceSpecificError(
static_cast<int32_t>(Result::FAILURE_INVALID_STATE));
}
+ mHpdSignal.at(portId - 1) = signal;
+ return ScopedAStatus::ok();
}
ScopedAStatus HdmiConnectionMock::getHpdSignal(int32_t portId, HpdSignal* _aidl_return) {
+ if (portId > mTotalPorts || portId < 1) {
+ return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+ }
*_aidl_return = mHpdSignal.at(portId - 1);
return ScopedAStatus::ok();
}
@@ -123,7 +128,7 @@
bool connected = ((msgBuf[3]) & 0xf) > 0;
int32_t portId = static_cast<uint32_t>(msgBuf[0] & 0xf);
- if (portId > static_cast<int32_t>(mPortInfos.size())) {
+ if (portId > static_cast<int32_t>(mPortInfos.size()) || portId < 1) {
ALOGD("[halimp_aidl] ignore hot plug message, id %x does not exist", portId);
return;
}
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl
index 2bc3254..cd21c25 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl
@@ -49,4 +49,11 @@
android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeViContentionTimeStats;
android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeVoContentionTimeStats;
android.hardware.wifi.StaPeerInfo[] peers;
+ android.hardware.wifi.StaLinkLayerLinkStats.StaLinkState state;
+ @Backing(type="int") @VintfStability
+ enum StaLinkState {
+ UNKNOWN = 0,
+ NOT_IN_USE = (1 << 0) /* 1 */,
+ IN_USE = (1 << 1) /* 2 */,
+ }
}
diff --git a/wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl b/wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl
index d8d7975..2519543 100644
--- a/wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl
+++ b/wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl
@@ -95,4 +95,33 @@
* Per peer statistics for the link.
*/
StaPeerInfo[] peers;
+ /**
+ * Various states of the link.
+ */
+ @Backing(type="int")
+ @VintfStability
+ enum StaLinkState {
+ /**
+ * Chip does not support reporting the state of the link.
+ */
+ UNKNOWN = 0,
+ /**
+ * Link has not been in use since last report. It is placed in power save. All management,
+ * control and data frames for the MLO connection are carried over other links. In this
+ * state the link will not listen to beacons even in DTIM period and does not perform any
+ * GTK/IGTK/BIGTK updates but remains associated.
+ */
+ NOT_IN_USE = 1 << 0,
+ /**
+ * Link is in use. In presence of traffic, it is set to be power active. When the traffic
+ * stops, the link will go into power save mode and will listen for beacons every DTIM
+ * period.
+ *
+ */
+ IN_USE = 1 << 1,
+ }
+ /**
+ * State of the link. Refer |StaLinkState|.
+ */
+ StaLinkState state;
}
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl
index 28c1028..bcf0ea8 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl
@@ -35,4 +35,5 @@
@VintfStability
interface INonStandardCertCallback {
byte[] getBlob(in String alias);
+ String[] listAliases(in String prefix);
}
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
index e204184..19e6728 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
@@ -96,4 +96,5 @@
void findOnSocialChannels(in int timeoutInSec);
void findOnSpecificFrequency(in int freqInHz, in int timeoutInSec);
void setVendorElements(in android.hardware.wifi.supplicant.P2pFrameTypeMask frameTypeMask, in byte[] vendorElemBytes);
+ void configureEapolIpAddressAllocationParams(in int ipAddressGo, in int ipAddressMask, in int ipAddressStart, in int ipAddressEnd);
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl
similarity index 79%
rename from audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl
rename to wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl
index 50a5528..db31ca1 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,15 +31,10 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.audio.core;
-@JavaDerive(equals=true, toString=true) @VintfStability
-parcelable MicrophoneDynamicInfo {
- @utf8InCpp String id;
- android.hardware.audio.core.MicrophoneDynamicInfo.ChannelMapping[] channelMapping;
- @Backing(type="int") @VintfStability
- enum ChannelMapping {
- UNUSED = 0,
- DIRECT = 1,
- PROCESSED = 2,
- }
+package android.hardware.wifi.supplicant;
+@VintfStability
+parcelable P2pClientEapolIpAddressInfo {
+ int ipAddressClient;
+ int ipAddressMask;
+ int ipAddressGo;
}
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl
index 19611a9..614b49e 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl
@@ -43,4 +43,6 @@
boolean isPersistent;
byte[] goDeviceAddress;
byte[] goInterfaceAddress;
+ boolean isP2pClientEapolIpAddressInfoPresent;
+ android.hardware.wifi.supplicant.P2pClientEapolIpAddressInfo p2pClientIpInfo;
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl
index 3259585..2f9e528 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl
@@ -34,4 +34,13 @@
* |SupplicantStatusCode.FAILURE_UNKNOWN|
*/
byte[] getBlob(in String alias);
+
+ /**
+ * List the aliases currently stored in the database.
+ *
+ * @param prefix Prefix to filter the aliases by.
+ * @return List of alias strings in the certificate store.
+ The resulting strings will each exclude the prefix.
+ */
+ String[] listAliases(in String prefix);
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
index 313ee8b..e58422c 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
@@ -827,4 +827,22 @@
* |SupplicantStatusCode.FAILURE_IFACE_INVALID|
*/
void setVendorElements(in P2pFrameTypeMask frameTypeMask, in byte[] vendorElemBytes);
+
+ /**
+ * Configure the IP addresses in supplicant for P2P GO to provide the IP address to
+ * client in EAPOL handshake. Refer Wi-Fi P2P Technical Specification v1.7 - Section 4.2.8
+ * "IP Address Allocation in EAPOL-Key Frames (4-Way Handshake)" for more details.
+ * The IP addresses are IPV4 addresses and higher-order address bytes are in the lower-order
+ * int bytes (e.g. 1.2.3.4 is represented as 0x04030201)
+ *
+ * @param ipAddressGo The P2P Group Owner IP address.
+ * @param ipAddressMask The P2P Group owner subnet mask.
+ * @param ipAddressStart The starting address in the IP address pool.
+ * @param ipAddressEnd The ending address in the IP address pool.
+ * @throws ServiceSpecificException with one of the following values:
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ void configureEapolIpAddressAllocationParams(
+ in int ipAddressGo, in int ipAddressMask, in int ipAddressStart, in int ipAddressEnd);
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl
new file mode 100644
index 0000000..148e4a4
--- /dev/null
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.supplicant;
+
+/**
+ * P2P Client IPV4 address allocated via EAPOL exchange.
+ * The IP addresses are IPV4 addresses and higher-order address bytes are in the lower-order
+ * int bytes (e.g. 1.2.3.4 is represented as 0x04030201)
+ */
+@VintfStability
+parcelable P2pClientEapolIpAddressInfo {
+ /**
+ * The P2P Client IP address.
+ */
+ int ipAddressClient;
+ /**
+ * The subnet that the P2P Group Owner is using.
+ */
+ int ipAddressMask;
+ /**
+ * The P2P Group Owner IP address.
+ */
+ int ipAddressGo;
+}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl
index a04153a..ccd536c 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl
@@ -16,6 +16,8 @@
package android.hardware.wifi.supplicant;
+import android.hardware.wifi.supplicant.P2pClientEapolIpAddressInfo;
+
/**
* Parameters passed as part of Wifi P2P group start event.
*/
@@ -47,4 +49,18 @@
/** MAC Address of the P2P interface of the owner of this group. */
byte[/* 6 */] goInterfaceAddress;
+
+ /**
+ * Flag to indicate that the P2P Client IP address is allocated via EAPOL exchange.
+ */
+ boolean isP2pClientEapolIpAddressInfoPresent;
+
+ /**
+ * The P2P Client IP Address allocated by the P2P Group Owner in EAPOL
+ * key exchange.
+ * Refer Wi-Fi P2P Technical Specification v1.7 - Section 4.2.8
+ * "IP Address Allocation in EAPOL-Key Frames (4-Way Handshake)" for more details.
+ * The value is undefined if isP2pClientEapolIpAddressInfoPresent is false.
+ */
+ P2pClientEapolIpAddressInfo p2pClientIpInfo;
}