Merge "Refine tuner aidl hal threads."
diff --git a/camera/device/3.4/default/ExternalCameraDevice.cpp b/camera/device/3.4/default/ExternalCameraDevice.cpp
index 677b496..311c688 100644
--- a/camera/device/3.4/default/ExternalCameraDevice.cpp
+++ b/camera/device/3.4/default/ExternalCameraDevice.cpp
@@ -413,8 +413,8 @@
const uint8_t croppingType = ANDROID_SCALER_CROPPING_TYPE_CENTER_ONLY;
UPDATE(ANDROID_SCALER_CROPPING_TYPE, &croppingType, 1);
- const int32_t testPatternModes[] = {
- ANDROID_SENSOR_TEST_PATTERN_MODE_OFF};
+ const int32_t testPatternModes[] = {ANDROID_SENSOR_TEST_PATTERN_MODE_OFF,
+ ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR};
UPDATE(ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES, testPatternModes,
ARRAY_SIZE(testPatternModes));
diff --git a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp
index 5f86742..ca7186b 100644
--- a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp
+++ b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp
@@ -1462,14 +1462,50 @@
return onDeviceError("%s: V4L2 buffer map failed", __FUNCTION__);
}
+ // Process camera mute state
+ auto testPatternMode = req->setting.find(ANDROID_SENSOR_TEST_PATTERN_MODE);
+ if (testPatternMode.count == 1) {
+ if (mCameraMuted != (testPatternMode.data.u8[0] != ANDROID_SENSOR_TEST_PATTERN_MODE_OFF)) {
+ mCameraMuted = !mCameraMuted;
+ // Get solid color for test pattern, if any was set
+ if (testPatternMode.data.u8[0] == ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR) {
+ auto entry = req->setting.find(ANDROID_SENSOR_TEST_PATTERN_DATA);
+ if (entry.count == 4) {
+ // Update the mute frame if the pattern color has changed
+ if (memcmp(entry.data.i32, mTestPatternData, sizeof(mTestPatternData)) != 0) {
+ memcpy(mTestPatternData, entry.data.i32, sizeof(mTestPatternData));
+ // Fill the mute frame with the solid color, use only 8 MSB of RGGB as RGB
+ for (int i = 0; i < mMuteTestPatternFrame.size(); i += 3) {
+ mMuteTestPatternFrame[i] = entry.data.i32[0] >> 24;
+ mMuteTestPatternFrame[i + 1] = entry.data.i32[1] >> 24;
+ mMuteTestPatternFrame[i + 2] = entry.data.i32[3] >> 24;
+ }
+ }
+ }
+ }
+ }
+ }
+
// TODO: in some special case maybe we can decode jpg directly to gralloc output?
if (req->frameIn->mFourcc == V4L2_PIX_FMT_MJPEG) {
ATRACE_BEGIN("MJPGtoI420");
- int res = libyuv::MJPGToI420(
- inData, inDataSize, static_cast<uint8_t*>(mYu12FrameLayout.y), mYu12FrameLayout.yStride,
- static_cast<uint8_t*>(mYu12FrameLayout.cb), mYu12FrameLayout.cStride,
- static_cast<uint8_t*>(mYu12FrameLayout.cr), mYu12FrameLayout.cStride,
- mYu12Frame->mWidth, mYu12Frame->mHeight, mYu12Frame->mWidth, mYu12Frame->mHeight);
+ int res = 0;
+ if (mCameraMuted) {
+ res = libyuv::ConvertToI420(
+ mMuteTestPatternFrame.data(), mMuteTestPatternFrame.size(),
+ static_cast<uint8_t*>(mYu12FrameLayout.y), mYu12FrameLayout.yStride,
+ static_cast<uint8_t*>(mYu12FrameLayout.cb), mYu12FrameLayout.cStride,
+ static_cast<uint8_t*>(mYu12FrameLayout.cr), mYu12FrameLayout.cStride, 0, 0,
+ mYu12Frame->mWidth, mYu12Frame->mHeight, mYu12Frame->mWidth,
+ mYu12Frame->mHeight, libyuv::kRotate0, libyuv::FOURCC_RAW);
+ } else {
+ res = libyuv::MJPGToI420(
+ inData, inDataSize, static_cast<uint8_t*>(mYu12FrameLayout.y),
+ mYu12FrameLayout.yStride, static_cast<uint8_t*>(mYu12FrameLayout.cb),
+ mYu12FrameLayout.cStride, static_cast<uint8_t*>(mYu12FrameLayout.cr),
+ mYu12FrameLayout.cStride, mYu12Frame->mWidth, mYu12Frame->mHeight,
+ mYu12Frame->mWidth, mYu12Frame->mHeight);
+ }
ATRACE_END();
if (res != 0) {
@@ -1670,6 +1706,9 @@
}
}
+ // Allocate mute test pattern frame
+ mMuteTestPatternFrame.resize(mYu12Frame->mWidth * mYu12Frame->mHeight * 3);
+
mBlobBufferSize = blobBufferSize;
return Status::OK;
}
@@ -1679,6 +1718,7 @@
mYu12Frame.clear();
mYu12ThumbFrame.clear();
mIntermediateBuffers.clear();
+ mMuteTestPatternFrame.clear();
mBlobBufferSize = 0;
}
diff --git a/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h b/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h
index 180f0c1..184c16e 100644
--- a/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h
+++ b/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h
@@ -181,6 +181,9 @@
std::unordered_map<Size, sp<AllocatedFrame>, SizeHasher> mScaledYu12Frames;
YCbCrLayout mYu12FrameLayout;
YCbCrLayout mYu12ThumbFrameLayout;
+ std::vector<uint8_t> mMuteTestPatternFrame;
+ uint32_t mTestPatternData[4] = {0, 0, 0, 0};
+ bool mCameraMuted = false;
uint32_t mBlobBufferSize = 0; // 0 -> HAL derive buffer size, else: use given size
std::string mExifMake;
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 62067bf..f03008a 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -536,7 +536,7 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.soundtrigger</name>
- <version>2.3-4</version>
+ <version>2.3</version>
<interface>
<name>ISoundTriggerHw</name>
<instance>default</instance>
diff --git a/soundtrigger/2.4/cli/Android.bp b/soundtrigger/2.3/cli/Android.bp
similarity index 79%
rename from soundtrigger/2.4/cli/Android.bp
rename to soundtrigger/2.3/cli/Android.bp
index 8d0979b..27d7b30 100644
--- a/soundtrigger/2.4/cli/Android.bp
+++ b/soundtrigger/2.3/cli/Android.bp
@@ -8,10 +8,10 @@
}
java_binary {
- name: "sthal_cli_2.4",
- wrapper: "sthal_cli_2.4",
+ name: "sthal_cli_2.3",
+ wrapper: "sthal_cli_2.3",
srcs: ["java/**/*.java"],
static_libs: [
- "android.hardware.soundtrigger-V2.4-java",
+ "android.hardware.soundtrigger-V2.3-java",
],
}
diff --git a/soundtrigger/2.3/cli/OWNERS b/soundtrigger/2.3/cli/OWNERS
new file mode 100644
index 0000000..4fd27f3
--- /dev/null
+++ b/soundtrigger/2.3/cli/OWNERS
@@ -0,0 +1 @@
+include platform/frameworks/base:/services/core/java/com/android/server/soundtrigger_middleware/OWNERS
diff --git a/soundtrigger/2.4/cli/java/android/hardware/soundtrigger/V2_4/cli/SthalCli.java b/soundtrigger/2.3/cli/java/android/hardware/soundtrigger/V2_3/cli/SthalCli.java
similarity index 83%
rename from soundtrigger/2.4/cli/java/android/hardware/soundtrigger/V2_4/cli/SthalCli.java
rename to soundtrigger/2.3/cli/java/android/hardware/soundtrigger/V2_3/cli/SthalCli.java
index 4931105..68b04f4 100644
--- a/soundtrigger/2.4/cli/java/android/hardware/soundtrigger/V2_4/cli/SthalCli.java
+++ b/soundtrigger/2.3/cli/java/android/hardware/soundtrigger/V2_3/cli/SthalCli.java
@@ -13,15 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.hardware.soundtrigger.V2_4.cli;
+package android.hardware.soundtrigger.V2_3.cli;
import android.hardware.soundtrigger.V2_0.PhraseRecognitionExtra;
import android.hardware.soundtrigger.V2_0.RecognitionMode;
import android.hardware.soundtrigger.V2_0.SoundModelType;
import android.hardware.soundtrigger.V2_3.OptionalModelParameterRange;
-import android.hardware.soundtrigger.V2_4.ISoundTriggerHw;
-import android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback;
-import android.hardware.soundtrigger.V2_4.ISoundTriggerHwGlobalCallback;
+import android.hardware.soundtrigger.V2_3.ISoundTriggerHw;
+import android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback;
import android.os.HidlMemoryUtil;
import android.os.HwBinder;
import android.os.RemoteException;
@@ -51,7 +50,7 @@
*/
public class SthalCli {
private static SoundTriggerImpl mService;
- private static final Scanner scanner = new Scanner(System.in);
+ private static final Scanner mScanner = new Scanner(System.in);
public static void main(String[] args) {
try {
@@ -79,7 +78,7 @@
}
private static boolean processCommand() {
- String line = scanner.nextLine();
+ String line = mScanner.nextLine();
String[] tokens = line.split("\\s+");
if (tokens.length < 1) {
return false;
@@ -88,14 +87,6 @@
case "q":
return false;
- case "a":
- mService.sendOnResourcesAvailable();
- return true;
-
- case "u":
- mService.sendModelUnloaded(Integer.parseInt(tokens[1]));
- return true;
-
case "r":
mService.sendRecognitionEvent(Integer.parseInt(tokens[1]),
Integer.parseInt(tokens[2]));
@@ -112,8 +103,6 @@
case "h":
System.out.print("Available commands:\n" + "h - help\n" + "q - quit\n"
- + "a - send onResourcesAvailable event\n"
- + "u <model> - send modelUnloaded event\n"
+ "r <model> <status> - send recognitionEvent\n"
+ "p <model> <status> - send phraseRecognitionEvent\n"
+ "d - dump models\n");
@@ -143,7 +132,6 @@
}
}
- private ISoundTriggerHwGlobalCallback mGlobalCallback;
private final ConcurrentMap<Integer, Model> mLoadedModels = new ConcurrentHashMap<>();
private int mHandleCounter = 1;
@@ -161,16 +149,6 @@
});
}
- public void sendOnResourcesAvailable() {
- if (mGlobalCallback != null) {
- try {
- mGlobalCallback.onResourcesAvailable();
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- }
-
public void sendRecognitionEvent(int modelHandle, int status) {
Model model = mLoadedModels.get(modelHandle);
if (model != null && model.config != null) {
@@ -225,46 +203,31 @@
}
}
- public void sendModelUnloaded(int modelHandle) {
- Model model = mLoadedModels.remove(modelHandle);
- if (model != null) {
- try {
- model.callback.modelUnloaded(modelHandle);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- }
-
@Override
- public void registerGlobalCallback(ISoundTriggerHwGlobalCallback callback) {
- System.out.println("registerGlobalCallback()");
- mGlobalCallback = callback;
- }
-
- @Override
- public void loadSoundModel_2_4(SoundModel soundModel, ISoundTriggerHwCallback callback,
- loadSoundModel_2_4Callback _hidl_cb) {
+ public void loadSoundModel_2_1(SoundModel soundModel,
+ android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback callback, int cookie,
+ loadSoundModel_2_1Callback _hidl_cb) {
int handle = mHandleCounter++;
- System.out.printf("loadSoundModel_2_4(soundModel=%s) -> %d%n", soundModel, handle);
+ System.out.printf("loadSoundModel_2_1(soundModel=%s) -> %d%n", soundModel, handle);
mLoadedModels.put(handle, new Model(callback, soundModel));
_hidl_cb.onValues(0, handle);
}
@Override
- public void loadPhraseSoundModel_2_4(PhraseSoundModel soundModel,
- ISoundTriggerHwCallback callback, loadPhraseSoundModel_2_4Callback _hidl_cb) {
- int handle = mHandleCounter++;
- System.out.printf("loadPhraseSoundModel_2_4(soundModel=%s) -> %d%n", soundModel,
+ public void loadPhraseSoundModel_2_1(PhraseSoundModel soundModel,
+ android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback callback, int cookie,
+ loadPhraseSoundModel_2_1Callback _hidl_cb) {
+ int handle = mHandleCounter++;
+ System.out.printf("loadPhraseSoundModel_2_1(soundModel=%s) -> %d%n", soundModel,
handle);
mLoadedModels.put(handle, new Model(callback, soundModel));
_hidl_cb.onValues(0, handle);
}
@Override
- public int startRecognition_2_4(int modelHandle,
+ public int startRecognition_2_3(int modelHandle,
android.hardware.soundtrigger.V2_3.RecognitionConfig config) {
- System.out.printf("startRecognition_2_4(modelHandle=%d)%n", modelHandle);
+ System.out.printf("startRecognition_2_3(modelHandle=%d)%n", modelHandle);
Model model = mLoadedModels.get(modelHandle);
if (model != null) {
model.config = config;
@@ -330,12 +293,6 @@
// Everything below is not implemented and not expected to be called.
@Override
- public int startRecognition_2_3(int modelHandle,
- android.hardware.soundtrigger.V2_3.RecognitionConfig config) {
- throw new UnsupportedOperationException();
- }
-
- @Override
public int setParameter(int modelHandle, int modelParam, int value) {
throw new UnsupportedOperationException();
}
@@ -346,20 +303,6 @@
}
@Override
- public void loadSoundModel_2_1(SoundModel soundModel,
- android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback callback, int cookie,
- loadSoundModel_2_1Callback _hidl_cb) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void loadPhraseSoundModel_2_1(PhraseSoundModel soundModel,
- android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback callback, int cookie,
- loadPhraseSoundModel_2_1Callback _hidl_cb) {
- throw new UnsupportedOperationException();
- }
-
- @Override
public int startRecognition_2_1(int modelHandle, RecognitionConfig config,
android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback callback, int cookie) {
throw new UnsupportedOperationException();
diff --git a/soundtrigger/2.3/cli/sthal_cli_2.3 b/soundtrigger/2.3/cli/sthal_cli_2.3
new file mode 100644
index 0000000..78e9f9b
--- /dev/null
+++ b/soundtrigger/2.3/cli/sthal_cli_2.3
@@ -0,0 +1,7 @@
+#!/system/bin/sh
+# Script to start "sthal_cli_2.3" on the device
+#
+base=/system
+export CLASSPATH=$base/framework/sthal_cli_2.3.jar
+exec app_process $base/bin android.hardware.soundtrigger.V2_3.cli.SthalCli "$@"
+
diff --git a/soundtrigger/2.4/Android.bp b/soundtrigger/2.4/Android.bp
deleted file mode 100644
index 44befc3..0000000
--- a/soundtrigger/2.4/Android.bp
+++ /dev/null
@@ -1,30 +0,0 @@
-// This file is autogenerated by hidl-gen -Landroidbp.
-
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "hardware_interfaces_license"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- default_applicable_licenses: ["hardware_interfaces_license"],
-}
-
-hidl_interface {
- name: "android.hardware.soundtrigger@2.4",
- root: "android.hardware",
- srcs: [
- "ISoundTriggerHw.hal",
- "ISoundTriggerHwCallback.hal",
- "ISoundTriggerHwGlobalCallback.hal",
- ],
- interfaces: [
- "android.hardware.audio.common@2.0",
- "android.hardware.soundtrigger@2.0",
- "android.hardware.soundtrigger@2.1",
- "android.hardware.soundtrigger@2.2",
- "android.hardware.soundtrigger@2.3",
- "android.hidl.base@1.0",
- "android.hidl.safe_union@1.0",
- ],
- gen_java: true,
-}
diff --git a/soundtrigger/2.4/ISoundTriggerHw.hal b/soundtrigger/2.4/ISoundTriggerHw.hal
deleted file mode 100644
index fd39303..0000000
--- a/soundtrigger/2.4/ISoundTriggerHw.hal
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.soundtrigger@2.4;
-
-import @2.0::SoundModelHandle;
-import @2.1::ISoundTriggerHw.SoundModel;
-import @2.1::ISoundTriggerHw.PhraseSoundModel;
-import @2.3::ISoundTriggerHw;
-import @2.3::RecognitionConfig;
-import ISoundTriggerHwCallback;
-import ISoundTriggerHwGlobalCallback;
-
-/**
- * SoundTrigger HAL interface. Used for hardware recognition of hotwords
- * and other sounds.
- *
- * Important notes about the threading model:
- * ==========================================
- * Both this interface and the corresponding callback interface use a synchronized calling
- * convention. This model comes with some advantages, but also with some risks of deadlocks if the
- * implementation does not handle this correctly. Please consider the following:
- * - After stopRecognition() returns no more recognition events for that model may be sent. This
- * implies that any queues holding such events must be flushed before the call returns and that
- * may imply that callback from the HAL to the client are done while stopRecognition() is blocked.
- * This is OK, and supported by the framework.
- * - Similarly, the same relationship applies between unloadModel() and subsequent callbacks to
- * modelUnloaded().
- * - Other than these two cases, calls into the HAL *MAY NOT* block on callbacks from the HAL, or
- * else deadlock conditions may result, which may be handled by rebooting of the HAL process and
- * cause service outages.
- *
- * Similarly, it is expected that a single call to startRecognition() generates at most one event
- * (the model automatically becomes stopped when the event occurs, until explicitly started again)
- * and that after a modelUnloaded() event no more events would be sent regarding the model.
- * Note that a getModelState() call may generate a recognition event, but this event DOES NOT modify
- * the model state - the model remains started.
- *
- * The HAL is expected to correctly handle a stopRecognition() call even after it sent an event
- * indicating that recognition is stopped and an unloadModel() call even after it sent an event
- * indicating that it has been unloaded. This is required in order to prevent race conditions
- * between these calls. This also implies that model handles should generally not be reused until
- * explicitly unloaded. To avoid the rare possibility of running out of handles, the framework will
- * call unloadModel() on models that have been preemptively unloaded by the HAL.
- *
- * Due to the asynchronous nature of recognition events and preemptive model unloading, the HAL must
- * correctly handle requests that would have been valid before an event has been delivered, but
- * became moot as result of the event. Namely:
- * - stopRecognition() may be called on a model that has already delivered an event and became
- * inactive as a result. The HAL must return a successful return code in this case.
- * - Furthermore, if a model is preemptively unloaded after it triggers (typically, this would
- * happen when it is first aborted and immediately preemptively unloaded), stopRecognition() may
- * be called on it. The HAL must return a successful return code in this case.
- * - startRecognition() may be called on a model that has been preemptively unloaded. In this case,
- * the HAL must return -EBUSY to indicate that the operation is temporarily unsuccessful.
- * - unloadSoundModel() may be called on a model that has been preemptively unloaded. The HAL must
- * return a successful return code in this case.
- *
- * Important notes about resource constraints and concurrency
- * =========================================================
- * Up until this version, the framework would enforce concurrency constraints expressed by the
- * Properties presented by the soundtrigger instance. These include constraints on the maximum
- * amount of models that can be loaded at the same time and on running recognition while capturing
- * from the microphone.
- * This version changes the approach for how these constraints are modeled, both offering the HAL
- * implementation more flexibility and simplifying the framework's job in enforcing these
- * limitations. Note that there is no change for how the framework behaves with earlier versions,
- * everything described below only applies to this version and onward.
- * The way this is achieved is as following:
- * - The framework will no longer enforce constraints on concurrent loading of models, as expressed
- * in the Properties.maxSoundModels field (this property is merely a hint at this point and may be
- * deprecated in the future.
- * - The framework will no longer enforce constraints on concurrency of audio recording and
- * soundtrigger operation, as expressed in the Properties.concurrentCapture field (this property
- * is merely a hint at this point and may be deprecated in the future).
- * - The framework will no longer enforce constraints on concurrent loading of models, as expressed
- * in the Properties (these properties are merely hints at this point and may be deprecated in the
- * future.
- * - The HAL implementation is free to reject starting of any model at any time by having the
- * respective start*() method return -EBUSY.
- * - The HAL implementation is free to reject loading of any model at any time by having the
- * respective load*() method return -EBUSY.
- * - The HAL implementation is free to preemptively stop a previously started model at its own
- * discretion (for example, if a higher priority use-case which cannot coexist with detection
- * has been requested). The HAL must notify the framework of the preemption by sending a
- * recognition event with an `ABORT` status. The implementation must NOT attempt to restart the
- * recognition automatically when conditions change.
- * - The HAL implementation is free to preemptively unload a previously loaded model at its own
- * discretion (for example, if a higher-priority model is being loaded and the two cannot
- * coexist). When doing so, it must first abort the detection if active (as per above) and then
- * notify the framework of the unload using the newly added modelUnloaded callback.
- * - When conditions change, such that a model that couldn't previously load or start or that had
- * previously been preemptively stopped or unloaded, the HAL must notify the framework via the
- * newly added tryAgain() callback. This callback is not a guarantee that any operation would now
- * succeed, but merely a hint that retrying something that had previously failed, now MAY succeed.
- * Until this callback arrives, the framework may assume that any operation that had previously
- * failed or aborted would still fail if retried, so the implementation should not forget to
- * deliver it. There are no guarantees regarding how the framework may respond to this event and
- * the order in which it may choose to reload/restart its models. Typically, as result of this
- * event the framework will make a single attempt per model to bring this model to its desired
- * state (loaded, started).
- */
-interface ISoundTriggerHw extends @2.3::ISoundTriggerHw {
- /**
- * This will get called at most once per every attachment to the service.
- *
- * All events not tied to a specific model should go through this callback.
- */
- registerGlobalCallback(ISoundTriggerHwGlobalCallback callback);
-
- /**
- * Load a sound model. Once loaded, recognition of this model can be
- * started and stopped.
- * The implementation returns a unique handle used by other functions
- * (unloadSoundModel(), startRecognition*(), etc...
- *
- * Must have the exact same semantics as loadSoundModel from ISoundTriggerHw@2.3 except that the
- * return values have changed and that there is no cookie provided (the implementation may pass
- * any value to the callback, as it is ignored).
- *
- * @param soundModel A SoundModel structure describing the sound model
- * to load.
- * @param callback The callback interface on which the soundModelCallback*()
- * method must be called upon completion and modelUnloaded() upon preempted unload.
- * @return retval Operation completion status: 0 in case of success,
- * -EBUSY in case the operation is temporarily unavailable (but possible in general).
- * @return modelHandle A unique handle assigned by the HAL for use by the
- * framework when controlling activity for this sound model.
- */
- loadSoundModel_2_4(SoundModel soundModel, ISoundTriggerHwCallback callback)
- generates (int32_t retval, SoundModelHandle modelHandle);
-
- /**
- * Load a key phrase sound model. Once loaded, recognition of this model can
- * be started and stopped. Only one active recognition per model at a time.
- * The SoundTrigger service must handle concurrent recognition requests by
- * different users/applications on the same model.
- * The implementation returns a unique handle used by other functions
- * (unloadSoundModel(), startRecognition*(), etc...
- *
- * Must have the exact same semantics as loadPhraseSoundModel from ISoundTriggerHw@2.3 except
- * that the return values have changed and that there is no cookie provided (the implementation
- * may pass any value to the callback, as it is ignored).
- *
- * @param soundModel A PhraseSoundModel structure describing the sound model
- * to load.
- * @param callback The callback interface on which the soundModelCallback*()
- * method must be called upon completion and modelUnloaded() upon preempted unload.
- * @return retval Operation completion status: 0 in case of success,
- * -EBUSY in case the operation is temporarily unavailable (but possible in general).
- * @return modelHandle A unique handle assigned by the HAL for use by the
- * framework when controlling activity for this sound model.
- */
- loadPhraseSoundModel_2_4(PhraseSoundModel soundModel, ISoundTriggerHwCallback callback)
- generates (int32_t retval, SoundModelHandle modelHandle);
-
- /**
- * Start recognition on a given model. Only one recognition active
- * at a time per model. Once recognition succeeds or fails, the callback
- * associated with the model handle is called.
- *
- * Must have the exact same semantics as startRecognition from ISoundTriggerHw@2.3 except that
- * there are different expectations of the return value and that there is no cookie provided
- * (the implementation may pass any value to the callback, as it is ignored).
- *
- * @param modelHandle the handle of the sound model to use for recognition
- * @param config A RecognitionConfig structure containing attributes of the
- * recognition to perform
- * @param callback The callback interface on which the recognitionCallback()
- * method must be called upon recognition.
- * @return retval Operation completion status: 0 in case of success,
- * -EBUSY in case the operation is temporarily unavailable (but possible in general), or in
- * case model has been preemtively unloaded.
- */
- startRecognition_2_4(SoundModelHandle modelHandle, RecognitionConfig config)
- generates (int32_t retval);
-};
diff --git a/soundtrigger/2.4/ISoundTriggerHwCallback.hal b/soundtrigger/2.4/ISoundTriggerHwCallback.hal
deleted file mode 100644
index 594deb0..0000000
--- a/soundtrigger/2.4/ISoundTriggerHwCallback.hal
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.soundtrigger@2.4;
-
-import @2.0::SoundModelHandle;
-import @2.1::ISoundTriggerHwCallback;
-
-/**
- * SoundTrigger HAL per-model Callback interface.
- */
-interface ISoundTriggerHwCallback extends @2.1::ISoundTriggerHwCallback {
- /**
- * Callback method called by the HAL when a model has been unloaded at the HAL implementation's
- * discretion. Only a stopped model may be unloaded.
- * This event is NOT sent as part of an unload sequence initiated by the client.
- *
- * @param model The model handle.
- */
- modelUnloaded(SoundModelHandle model);
-};
diff --git a/soundtrigger/2.4/ISoundTriggerHwGlobalCallback.hal b/soundtrigger/2.4/ISoundTriggerHwGlobalCallback.hal
deleted file mode 100644
index 2f1a977..0000000
--- a/soundtrigger/2.4/ISoundTriggerHwGlobalCallback.hal
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.soundtrigger@2.4;
-
-/**
- * SoundTrigger HAL callback interface for events not associated with a particular model.
- */
-interface ISoundTriggerHwGlobalCallback {
- /**
- * Callback method called by the HAL whenever internal conditions have been made available, such
- * that a call that would previously have failed with an -EBUSY status may now succeed.
- * There is no guarantee that any call would succeed following this event. It is merely a hint
- * to the client that it may retry.
- * Conversely, any call that have failed previously with -EBUSY is guaranteed to fail again if
- * retried, until this callback is delivered.
- */
- onResourcesAvailable();
-};
diff --git a/soundtrigger/2.4/cli/OWNERS b/soundtrigger/2.4/cli/OWNERS
deleted file mode 100644
index e21b66e..0000000
--- a/soundtrigger/2.4/cli/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /media/java/android/media/soundtrigger_middleware/OWNERS
diff --git a/soundtrigger/2.4/cli/sthal_cli_2.4 b/soundtrigger/2.4/cli/sthal_cli_2.4
deleted file mode 100644
index 0801464..0000000
--- a/soundtrigger/2.4/cli/sthal_cli_2.4
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/system/bin/sh
-# Script to start "sthal_cli_2.4" on the device
-#
-base=/system
-export CLASSPATH=$base/framework/sthal_cli_2.4.jar
-exec app_process $base/bin android.hardware.soundtrigger.V2_4.cli.SthalCli "$@"
-
diff --git a/soundtrigger/2.4/vts/functional/Android.bp b/soundtrigger/2.4/vts/functional/Android.bp
deleted file mode 100644
index 4b7ae91..0000000
--- a/soundtrigger/2.4/vts/functional/Android.bp
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Copyright (C) 2021 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "hardware_interfaces_license"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- default_applicable_licenses: ["hardware_interfaces_license"],
-}
-
-cc_test {
- name: "VtsHalSoundtriggerV2_4TargetTest",
- defaults: ["VtsHalTargetTestDefaults"],
- srcs: ["VtsHalSoundtriggerV2_4TargetTest.cpp"],
- static_libs: [
- "android.hardware.soundtrigger@2.0",
- "android.hardware.soundtrigger@2.1",
- "android.hardware.soundtrigger@2.2",
- "android.hardware.soundtrigger@2.3",
- "android.hardware.soundtrigger@2.4",
- ],
- test_suites: [
- "general-tests",
- "vts",
- ],
-}
diff --git a/soundtrigger/2.4/vts/functional/VtsHalSoundtriggerV2_4TargetTest.cpp b/soundtrigger/2.4/vts/functional/VtsHalSoundtriggerV2_4TargetTest.cpp
deleted file mode 100644
index 13d7005..0000000
--- a/soundtrigger/2.4/vts/functional/VtsHalSoundtriggerV2_4TargetTest.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define LOG_TAG "SoundTriggerHidlHalTest"
-
-#include <android-base/logging.h>
-#include <android/hardware/audio/common/2.0/types.h>
-#include <android/hardware/soundtrigger/2.4/ISoundTriggerHwGlobalCallback.h>
-#include <android/hardware/soundtrigger/2.4/ISoundTriggerHw.h>
-#include <gtest/gtest.h>
-#include <hidl/GtestPrinter.h>
-#include <hidl/ServiceManagement.h>
-
-using ::android::sp;
-using ::android::hardware::Return;
-using ::android::hardware::Status;
-using ::android::hardware::soundtrigger::V2_4::ISoundTriggerHw;
-using ::android::hardware::soundtrigger::V2_4::ISoundTriggerHwGlobalCallback;
-
-/**
- * Test class holding the instance of the SoundTriggerHW service to test.
- * The passed parameter is the registered name of the implementing service
- * supplied by INSTANTIATE_TEST_SUITE_P() call.
- */
-class SoundTriggerHidlTest : public testing::TestWithParam<std::string> {
-public:
- void SetUp() override {
- mSoundtrigger = ISoundTriggerHw::getService(GetParam());
-
- ASSERT_NE(mSoundtrigger, nullptr);
- LOG(INFO) << "Test is remote " << mSoundtrigger->isRemote();
- }
-
-protected:
- sp<ISoundTriggerHw> mSoundtrigger;
-};
-
-/**
- * Empty test is in place to ensure service is initialized.
- * Due to the nature of SoundTrigger HAL providing an interface for
- * proprietary or vendor specific implementations, limited testing on
- * individual APIs is possible.
- */
-TEST_P(SoundTriggerHidlTest, ServiceIsInstantiated) {}
-
-class GlobalCallback : public ISoundTriggerHwGlobalCallback {
- Return<void> onResourcesAvailable() override {
- return Status::ok();
- }
-};
-
-/**
- * Test ISoundTriggerHw::registerGlobalCallback method
- *
- * Verifies that:
- * - the implementation implements the method
- * - the method returns no error
- */
-TEST_P(SoundTriggerHidlTest, RegisterGlobalCallback) {
- Return<void> hidlReturn;
- sp<ISoundTriggerHwGlobalCallback> callback = new GlobalCallback();
- hidlReturn = mSoundtrigger->registerGlobalCallback(callback);
- EXPECT_TRUE(hidlReturn.isOk());
-}
-
-GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SoundTriggerHidlTest);
-
-INSTANTIATE_TEST_SUITE_P(
- PerInstance, SoundTriggerHidlTest,
- testing::ValuesIn(android::hardware::getAllHalInstanceNames(ISoundTriggerHw::descriptor)),
- android::hardware::PrintInstanceNameToString);
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb/current/android/hardware/uwb/IUwb.aidl b/uwb/aidl/aidl_api/android.hardware.uwb/current/android/hardware/uwb/IUwb.aidl
index 229ef7c..9553ffc 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb/current/android/hardware/uwb/IUwb.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb/current/android/hardware/uwb/IUwb.aidl
@@ -36,8 +36,6 @@
package android.hardware.uwb;
@VintfStability
interface IUwb {
- void close();
- void coreInit();
- void open(in android.hardware.uwb.IUwbClientCallback clientCallback);
- int write(in byte[] data);
+ List<String> getChips();
+ android.hardware.uwb.IUwbChip getChip(String name);
}
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb/current/android/hardware/uwb/IUwbChip.aidl b/uwb/aidl/aidl_api/android.hardware.uwb/current/android/hardware/uwb/IUwbChip.aidl
new file mode 100644
index 0000000..7074753
--- /dev/null
+++ b/uwb/aidl/aidl_api/android.hardware.uwb/current/android/hardware/uwb/IUwbChip.aidl
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Copyright 2021 NXP.
+ *
+ * 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.uwb;
+@VintfStability
+interface IUwbChip {
+ String getName();
+ void open(in android.hardware.uwb.IUwbClientCallback clientCallback);
+ void close();
+ void coreInit();
+ int getSupportedVendorUciVersion();
+ int sendUciMessage(in byte[] data);
+}
diff --git a/uwb/aidl/android/hardware/uwb/IUwb.aidl b/uwb/aidl/android/hardware/uwb/IUwb.aidl
index 5d888bc..fda726c 100755
--- a/uwb/aidl/android/hardware/uwb/IUwb.aidl
+++ b/uwb/aidl/android/hardware/uwb/IUwb.aidl
@@ -18,8 +18,7 @@
package android.hardware.uwb;
-import android.hardware.uwb.IUwbClientCallback;
-import android.hardware.uwb.UwbStatus;
+import android.hardware.uwb.IUwbChip;
/**
* HAL Interface for UWB (Ultrawideband) subsystem.
@@ -28,38 +27,14 @@
@VintfStability
interface IUwb {
/**
- * Close the UWB Subsystem. Should free all resources.
- *
+ * Returns list of IUwbChip instance names representing each UWB chip on the device.
*/
- void close();
+ List<String> getChips();
/**
- * Perform UWB Subsystem initialization by applying all vendor configuration.
+ * Returns IUwbChip instance corresponding to the name.
*
+ * @param Unique identifier of the chip.
*/
- void coreInit();
-
- /**
- * Performs the UWB HAL initialization and power on UWB Subsystem. If open completes
- * successfully, then UWB Subsystem is ready to accept UCI message through write() API
- *
- * @param clientCallback Client callback instance.
- */
- void open(in IUwbClientCallback clientCallback);
-
- /**
- * Write the UCI message to the UWB Subsystem.
- * The UCI message format is as per UCI protocol and it is
- * defined in "FiRa Consortium - UCI Generic Specification_v1.0" specification at FiRa
- * consortium.
- * WIP doc link: https://groups.firaconsortium.org/wg/Technical/document/folder/127.
- * TODO(b/196004116): Link to the published specification.
- *
- * This method may queue writes and return immediately, or it may block until data is written.
- * Implementation must guarantee that writes are executed in order.
- *
- * @param data UCI packet to write.
- * @return number of bytes written to the UWB Subsystem
- */
- int write(in byte[] data);
+ IUwbChip getChip(String name);
}
diff --git a/uwb/aidl/android/hardware/uwb/IUwbChip.aidl b/uwb/aidl/android/hardware/uwb/IUwbChip.aidl
new file mode 100755
index 0000000..5f1a59e
--- /dev/null
+++ b/uwb/aidl/android/hardware/uwb/IUwbChip.aidl
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Copyright 2021 NXP.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.uwb;
+
+import android.hardware.uwb.IUwbClientCallback;
+import android.hardware.uwb.UwbStatus;
+
+/**
+ * Controls a UWB chip on the device. On some devices, there could be multiple UWB chips.
+ */
+@VintfStability
+interface IUwbChip {
+ /**
+ * Get unique idenitifer for the chip.
+ */
+ String getName();
+
+ /**
+ * Performs the UWB HAL initialization and power on UWB Subsystem. If open completes
+ * successfully, then UWB Subsystem is ready to accept UCI message through write() API
+ *
+ * @param clientCallback Client callback instance.
+ */
+ void open(in IUwbClientCallback clientCallback);
+
+ /**
+ * Close the UWB Subsystem. Should free all resources.
+ */
+ void close();
+
+ /**
+ * Perform UWB Subsystem initialization by applying all vendor configuration.
+ */
+ void coreInit();
+
+ /**
+ * Supported version of vendor UCI specification.
+ */
+ int getSupportedVendorUciVersion();
+
+ /**
+ * Write the UCI message to the UWB Subsystem.
+ * The UCI message format is as per UCI protocol and it is
+ * defined in "FiRa Consortium - UCI Generic Specification_v1.0" specification at FiRa
+ * consortium.
+ * WIP doc link: https://groups.firaconsortium.org/wg/Technical/document/folder/127.
+ * TODO(b/196004116): Link to the published specification.
+ *
+ * This method may queue writes and return immediately, or it may block until data is written.
+ * Implementation must guarantee that writes are executed in order.
+ *
+ * @param data UCI packet to write.
+ * @return number of bytes written to the UWB Subsystem
+ */
+ int sendUciMessage(in byte[] data);
+}
diff --git a/uwb/aidl/android/hardware/uwb/IUwbClientCallback.aidl b/uwb/aidl/android/hardware/uwb/IUwbClientCallback.aidl
index 32c36a8..75853cd 100755
--- a/uwb/aidl/android/hardware/uwb/IUwbClientCallback.aidl
+++ b/uwb/aidl/android/hardware/uwb/IUwbClientCallback.aidl
@@ -25,7 +25,8 @@
oneway interface IUwbClientCallback {
/**
* The callback passed in from the UWB stack that the HAL
- * can use to pass incomming data to the stack.
+ * can use to pass incoming data to the stack. These include UCI
+ * responses and notifications from the UWB subsystem.
*
* WIP doc link: https://groups.firaconsortium.org/wg/Technical/document/folder/127.
* TODO(b/196004116): Link to the published specification.