Merge "Add ability to get soundtrigger props from dsp"
This commit is contained in:
committed by
Android (Google) Code Review
commit
d8c549a0e9
@@ -3029,6 +3029,26 @@ package android.hardware.soundtrigger {
|
||||
field public static final int STATUS_OK = 0; // 0x0
|
||||
}
|
||||
|
||||
public static final class SoundTrigger.ModuleProperties implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.hardware.soundtrigger.SoundTrigger.ModuleProperties> CREATOR;
|
||||
field @NonNull public final String description;
|
||||
field public final int id;
|
||||
field @NonNull public final String implementor;
|
||||
field public final int maxBufferMs;
|
||||
field public final int maxKeyphrases;
|
||||
field public final int maxSoundModels;
|
||||
field public final int maxUsers;
|
||||
field public final int powerConsumptionMw;
|
||||
field public final int recognitionModes;
|
||||
field public final boolean returnsTriggerInEvent;
|
||||
field public final boolean supportsCaptureTransition;
|
||||
field public final boolean supportsConcurrentCapture;
|
||||
field @NonNull public final java.util.UUID uuid;
|
||||
field public final int version;
|
||||
}
|
||||
|
||||
public static class SoundTrigger.RecognitionEvent {
|
||||
method @Nullable public android.media.AudioFormat getCaptureFormat();
|
||||
method public int getCaptureSession();
|
||||
@@ -3771,6 +3791,7 @@ package android.media.soundtrigger {
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public void deleteModel(java.util.UUID);
|
||||
method public int getDetectionServiceOperationsTimeout();
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public android.media.soundtrigger.SoundTriggerManager.Model getModel(java.util.UUID);
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) @Nullable public android.hardware.soundtrigger.SoundTrigger.ModuleProperties getModuleProperties();
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER) public void updateModel(android.media.soundtrigger.SoundTriggerManager.Model);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,28 +71,27 @@ public class SoundTrigger {
|
||||
* ID used to target any API call to this paricular module. Module
|
||||
* properties are returned by listModules() method.
|
||||
*
|
||||
* @hide
|
||||
****************************************************************************/
|
||||
public static class ModuleProperties implements Parcelable {
|
||||
public static final class ModuleProperties implements Parcelable {
|
||||
/** Unique module ID provided by the native service */
|
||||
@UnsupportedAppUsage
|
||||
public final int id;
|
||||
|
||||
/** human readable voice detection engine implementor */
|
||||
@NonNull
|
||||
public final String implementor;
|
||||
|
||||
/** human readable voice detection engine description */
|
||||
@NonNull
|
||||
public final String description;
|
||||
|
||||
/** Unique voice engine Id (changes with each version) */
|
||||
@UnsupportedAppUsage
|
||||
@NonNull
|
||||
public final UUID uuid;
|
||||
|
||||
/** Voice detection engine version */
|
||||
public final int version;
|
||||
|
||||
/** Maximum number of active sound models */
|
||||
@UnsupportedAppUsage
|
||||
public final int maxSoundModels;
|
||||
|
||||
/** Maximum number of key phrases */
|
||||
@@ -120,7 +119,6 @@ public class SoundTrigger {
|
||||
* recognition callback event */
|
||||
public final boolean returnsTriggerInEvent;
|
||||
|
||||
@UnsupportedAppUsage
|
||||
ModuleProperties(int id, String implementor, String description,
|
||||
String uuid, int version, int maxSoundModels, int maxKeyphrases,
|
||||
int maxUsers, int recognitionModes, boolean supportsCaptureTransition,
|
||||
|
||||
@@ -54,4 +54,6 @@ interface ISoundTriggerService {
|
||||
boolean isRecognitionActive(in ParcelUuid parcelUuid);
|
||||
|
||||
int getModelState(in ParcelUuid soundModelId);
|
||||
|
||||
@nullable SoundTrigger.ModuleProperties getModuleProperties();
|
||||
}
|
||||
|
||||
@@ -383,4 +383,20 @@ public final class SoundTriggerManager {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the hardware sound trigger module properties currently loaded.
|
||||
*
|
||||
* @return The properties currently loaded. Returns null if no supported hardware loaded.
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.MANAGE_SOUND_TRIGGER)
|
||||
@Nullable
|
||||
public SoundTrigger.ModuleProperties getModuleProperties() {
|
||||
|
||||
try {
|
||||
return mSoundTriggerService.getModuleProperties();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -666,6 +666,23 @@ public class SoundTriggerService extends SystemService {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ModuleProperties getModuleProperties() {
|
||||
enforceCallingPermission(Manifest.permission.MANAGE_SOUND_TRIGGER);
|
||||
if (!isInitialized()) return null;
|
||||
if (DEBUG) {
|
||||
Slog.i(TAG, "getModuleProperties()");
|
||||
}
|
||||
|
||||
synchronized (mLock) {
|
||||
ModuleProperties properties = mSoundTriggerHelper.getModuleProperties();
|
||||
sEventLogger.log(new SoundTriggerLogger.StringEvent(
|
||||
"getModuleProperties(): " + properties.toString()));
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user