remove SoundTrigger public member variables
Bug: 150127026
Test: boot and verify soundtrigger hotword is functional
Change-Id: I04061cdb3eba02aac0f08de96f957e2b74c70a12
diff --git a/api/system-current.txt b/api/system-current.txt
index 369012c..00d68f56 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -3576,23 +3576,23 @@
public static final class SoundTrigger.Keyphrase implements android.os.Parcelable {
ctor public SoundTrigger.Keyphrase(int, int, @NonNull java.util.Locale, @NonNull String, @Nullable int[]);
+ method public int getId();
+ method @NonNull public java.util.Locale getLocale();
+ method public int getRecognitionModes();
+ method @NonNull public String getText();
+ method @NonNull public int[] getUsers();
method @NonNull public static android.hardware.soundtrigger.SoundTrigger.Keyphrase readFromParcel(@NonNull android.os.Parcel);
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.hardware.soundtrigger.SoundTrigger.Keyphrase> CREATOR;
- field public final int id;
- field @NonNull public final java.util.Locale locale;
- field public final int recognitionModes;
- field @NonNull public final String text;
- field @NonNull public final int[] users;
}
public static final class SoundTrigger.KeyphraseSoundModel extends android.hardware.soundtrigger.SoundTrigger.SoundModel implements android.os.Parcelable {
ctor public SoundTrigger.KeyphraseSoundModel(@NonNull java.util.UUID, @NonNull java.util.UUID, @Nullable byte[], @Nullable android.hardware.soundtrigger.SoundTrigger.Keyphrase[], int);
ctor public SoundTrigger.KeyphraseSoundModel(@NonNull java.util.UUID, @NonNull java.util.UUID, @Nullable byte[], @Nullable android.hardware.soundtrigger.SoundTrigger.Keyphrase[]);
+ method @NonNull public android.hardware.soundtrigger.SoundTrigger.Keyphrase[] getKeyphrases();
method @NonNull public static android.hardware.soundtrigger.SoundTrigger.KeyphraseSoundModel readFromParcel(@NonNull android.os.Parcel);
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.hardware.soundtrigger.SoundTrigger.KeyphraseSoundModel> CREATOR;
- field @NonNull public final android.hardware.soundtrigger.SoundTrigger.Keyphrase[] keyphrases;
}
public static final class SoundTrigger.ModelParamRange implements android.os.Parcelable {
@@ -3604,26 +3604,26 @@
public static final class SoundTrigger.ModuleProperties implements android.os.Parcelable {
method public int describeContents();
+ method public int getAudioCapabilities();
+ method @NonNull public String getDescription();
+ method public int getId();
+ method @NonNull public String getImplementor();
+ method public int getMaxBufferMillis();
+ method public int getMaxKeyphrases();
+ method public int getMaxSoundModels();
+ method public int getMaxUsers();
+ method public int getPowerConsumptionMw();
+ method public int getRecognitionModes();
+ method @NonNull public String getSupportedModelArch();
+ method @NonNull public java.util.UUID getUuid();
+ method public int getVersion();
+ method public boolean isCaptureTransitionSupported();
+ method public boolean isConcurrentCaptureSupported();
+ method public boolean isTriggerReturnedInEvent();
method public void writeToParcel(android.os.Parcel, int);
field public static final int AUDIO_CAPABILITY_ECHO_CANCELLATION = 1; // 0x1
field public static final int AUDIO_CAPABILITY_NOISE_SUPPRESSION = 2; // 0x2
field @NonNull public static final android.os.Parcelable.Creator<android.hardware.soundtrigger.SoundTrigger.ModuleProperties> CREATOR;
- field public final int audioCapabilities;
- 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 @NonNull public final String supportedModelArch;
- 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 {
@@ -3634,13 +3634,13 @@
}
public static class SoundTrigger.SoundModel {
+ method @NonNull public byte[] getData();
+ method public int getType();
+ method @NonNull public java.util.UUID getUuid();
+ method @NonNull public java.util.UUID getVendorUuid();
+ method public int getVersion();
field public static final int TYPE_GENERIC_SOUND = 1; // 0x1
field public static final int TYPE_KEYPHRASE = 0; // 0x0
- field @NonNull public final byte[] data;
- field public final int type;
- field @NonNull public final java.util.UUID uuid;
- field @NonNull public final java.util.UUID vendorUuid;
- field public final int version;
}
}
diff --git a/core/java/android/hardware/soundtrigger/ConversionUtil.java b/core/java/android/hardware/soundtrigger/ConversionUtil.java
index 3d763e6..425218a 100644
--- a/core/java/android/hardware/soundtrigger/ConversionUtil.java
+++ b/core/java/android/hardware/soundtrigger/ConversionUtil.java
@@ -106,11 +106,11 @@
public static SoundModel api2aidlSoundModel(SoundTrigger.SoundModel apiModel) {
SoundModel aidlModel = new SoundModel();
- aidlModel.type = apiModel.type;
- aidlModel.uuid = api2aidlUuid(apiModel.uuid);
- aidlModel.vendorUuid = api2aidlUuid(apiModel.vendorUuid);
- aidlModel.data = byteArrayToSharedMemory(apiModel.data, "SoundTrigger SoundModel");
- aidlModel.dataSize = apiModel.data.length;
+ aidlModel.type = apiModel.getType();
+ aidlModel.uuid = api2aidlUuid(apiModel.getUuid());
+ aidlModel.vendorUuid = api2aidlUuid(apiModel.getVendorUuid());
+ aidlModel.data = byteArrayToSharedMemory(apiModel.getData(), "SoundTrigger SoundModel");
+ aidlModel.dataSize = apiModel.getData().length;
return aidlModel;
}
@@ -122,20 +122,20 @@
SoundTrigger.KeyphraseSoundModel apiModel) {
PhraseSoundModel aidlModel = new PhraseSoundModel();
aidlModel.common = api2aidlSoundModel(apiModel);
- aidlModel.phrases = new Phrase[apiModel.keyphrases.length];
- for (int i = 0; i < apiModel.keyphrases.length; ++i) {
- aidlModel.phrases[i] = api2aidlPhrase(apiModel.keyphrases[i]);
+ aidlModel.phrases = new Phrase[apiModel.getKeyphrases().length];
+ for (int i = 0; i < apiModel.getKeyphrases().length; ++i) {
+ aidlModel.phrases[i] = api2aidlPhrase(apiModel.getKeyphrases()[i]);
}
return aidlModel;
}
public static Phrase api2aidlPhrase(SoundTrigger.Keyphrase apiPhrase) {
Phrase aidlPhrase = new Phrase();
- aidlPhrase.id = apiPhrase.id;
- aidlPhrase.recognitionModes = api2aidlRecognitionModes(apiPhrase.recognitionModes);
- aidlPhrase.users = Arrays.copyOf(apiPhrase.users, apiPhrase.users.length);
- aidlPhrase.locale = apiPhrase.locale.toLanguageTag();
- aidlPhrase.text = apiPhrase.text;
+ aidlPhrase.id = apiPhrase.getId();
+ aidlPhrase.recognitionModes = api2aidlRecognitionModes(apiPhrase.getRecognitionModes());
+ aidlPhrase.users = Arrays.copyOf(apiPhrase.getUsers(), apiPhrase.getUsers().length);
+ aidlPhrase.locale = apiPhrase.getLocale().toLanguageTag();
+ aidlPhrase.text = apiPhrase.getText();
return aidlPhrase;
}
diff --git a/core/java/android/hardware/soundtrigger/SoundTrigger.java b/core/java/android/hardware/soundtrigger/SoundTrigger.java
index a74871d2..98c4f61 100644
--- a/core/java/android/hardware/soundtrigger/SoundTrigger.java
+++ b/core/java/android/hardware/soundtrigger/SoundTrigger.java
@@ -104,76 +104,37 @@
/**
* If set the underlying module supports AEC.
- * Describes bit field {@link ModuleProperties#audioCapabilities}
+ * Describes bit field {@link ModuleProperties#mAudioCapabilities}
*/
public static final int AUDIO_CAPABILITY_ECHO_CANCELLATION = 0x1;
/**
* If set, the underlying module supports noise suppression.
- * Describes bit field {@link ModuleProperties#audioCapabilities}
+ * Describes bit field {@link ModuleProperties#mAudioCapabilities}
*/
public static final int AUDIO_CAPABILITY_NOISE_SUPPRESSION = 0x2;
- /** Unique module ID provided by the native service */
- public final int id;
-
- /** human readable voice detection engine implementor */
+ private final int mId;
@NonNull
- public final String implementor;
-
- /** human readable voice detection engine description */
+ private final String mImplementor;
@NonNull
- public final String description;
-
- /** Unique voice engine Id (changes with each version) */
+ private final String mDescription;
@NonNull
- public final UUID uuid;
-
- /** Voice detection engine version */
- public final int version;
-
- /**
- * String naming the architecture used for running the supported models.
- * (eg. a platform running models on a DSP could implement this string to convey the DSP
- * architecture used)
- */
+ private final UUID mUuid;
+ private final int mVersion;
@NonNull
- public final String supportedModelArch;
-
- /** Maximum number of active sound models */
- public final int maxSoundModels;
-
- /** Maximum number of key phrases */
- public final int maxKeyphrases;
-
- /** Maximum number of users per key phrase */
- public final int maxUsers;
-
- /** Supported recognition modes (bit field, RECOGNITION_MODE_VOICE_TRIGGER ...) */
+ private final String mSupportedModelArch;
+ private final int mMaxSoundModels;
+ private final int mMaxKeyphrases;
+ private final int mMaxUsers;
@RecognitionModes
- public final int recognitionModes;
-
- /** Supports seamless transition to capture mode after recognition */
- public final boolean supportsCaptureTransition;
-
- /** Maximum buffering capacity in ms if supportsCaptureTransition() is true */
- public final int maxBufferMs;
-
- /** Supports capture by other use cases while detection is active */
- public final boolean supportsConcurrentCapture;
-
- /** Rated power consumption when detection is active with TDB silence/sound/speech ratio */
- public final int powerConsumptionMw;
-
- /** Returns the trigger (key phrase) capture in the binary data of the
- * recognition callback event */
- public final boolean returnsTriggerInEvent;
-
- /**
- * Bit field encoding of the AudioCapabilities
- * supported by the firmware.
- */
+ private final int mRecognitionModes;
+ private final boolean mSupportsCaptureTransition;
+ private final int mMaxBufferMillis;
+ private final boolean mSupportsConcurrentCapture;
+ private final int mPowerConsumptionMw;
+ private final boolean mReturnsTriggerInEvent;
@AudioCapabilities
- public final int audioCapabilities;
+ private final int mAudioCapabilities;
ModuleProperties(int id, @NonNull String implementor, @NonNull String description,
@NonNull String uuid, int version, @NonNull String supportedModelArch,
@@ -181,22 +142,116 @@
@RecognitionModes int recognitionModes, boolean supportsCaptureTransition,
int maxBufferMs, boolean supportsConcurrentCapture, int powerConsumptionMw,
boolean returnsTriggerInEvent, int audioCapabilities) {
- this.id = id;
- this.implementor = requireNonNull(implementor);
- this.description = requireNonNull(description);
- this.uuid = UUID.fromString(requireNonNull(uuid));
- this.version = version;
- this.supportedModelArch = requireNonNull(supportedModelArch);
- this.maxSoundModels = maxSoundModels;
- this.maxKeyphrases = maxKeyphrases;
- this.maxUsers = maxUsers;
- this.recognitionModes = recognitionModes;
- this.supportsCaptureTransition = supportsCaptureTransition;
- this.maxBufferMs = maxBufferMs;
- this.supportsConcurrentCapture = supportsConcurrentCapture;
- this.powerConsumptionMw = powerConsumptionMw;
- this.returnsTriggerInEvent = returnsTriggerInEvent;
- this.audioCapabilities = audioCapabilities;
+ this.mId = id;
+ this.mImplementor = requireNonNull(implementor);
+ this.mDescription = requireNonNull(description);
+ this.mUuid = UUID.fromString(requireNonNull(uuid));
+ this.mVersion = version;
+ this.mSupportedModelArch = requireNonNull(supportedModelArch);
+ this.mMaxSoundModels = maxSoundModels;
+ this.mMaxKeyphrases = maxKeyphrases;
+ this.mMaxUsers = maxUsers;
+ this.mRecognitionModes = recognitionModes;
+ this.mSupportsCaptureTransition = supportsCaptureTransition;
+ this.mMaxBufferMillis = maxBufferMs;
+ this.mSupportsConcurrentCapture = supportsConcurrentCapture;
+ this.mPowerConsumptionMw = powerConsumptionMw;
+ this.mReturnsTriggerInEvent = returnsTriggerInEvent;
+ this.mAudioCapabilities = audioCapabilities;
+ }
+
+ /** Unique module ID provided by the native service */
+ public int getId() {
+ return mId;
+ }
+
+ /** human readable voice detection engine implementor */
+ @NonNull
+ public String getImplementor() {
+ return mImplementor;
+ }
+
+ /** human readable voice detection engine description */
+ @NonNull
+ public String getDescription() {
+ return mDescription;
+ }
+
+ /** Unique voice engine Id (changes with each version) */
+ @NonNull
+ public UUID getUuid() {
+ return mUuid;
+ }
+
+ /** Voice detection engine version */
+ public int getVersion() {
+ return mVersion;
+ }
+
+ /**
+ * String naming the architecture used for running the supported models.
+ * (eg. a platform running models on a DSP could implement this string to convey the DSP
+ * architecture used)
+ */
+ @NonNull
+ public String getSupportedModelArch() {
+ return mSupportedModelArch;
+ }
+
+ /** Maximum number of active sound models */
+ public int getMaxSoundModels() {
+ return mMaxSoundModels;
+ }
+
+ /** Maximum number of key phrases */
+ public int getMaxKeyphrases() {
+ return mMaxKeyphrases;
+ }
+
+ /** Maximum number of users per key phrase */
+ public int getMaxUsers() {
+ return mMaxUsers;
+ }
+
+ /** Supported recognition modes (bit field, RECOGNITION_MODE_VOICE_TRIGGER ...) */
+ @RecognitionModes
+ public int getRecognitionModes() {
+ return mRecognitionModes;
+ }
+
+ /** Supports seamless transition to capture mode after recognition */
+ public boolean isCaptureTransitionSupported() {
+ return mSupportsCaptureTransition;
+ }
+
+ /** Maximum buffering capacity in ms if supportsCaptureTransition() is true */
+ public int getMaxBufferMillis() {
+ return mMaxBufferMillis;
+ }
+
+ /** Supports capture by other use cases while detection is active */
+ public boolean isConcurrentCaptureSupported() {
+ return mSupportsConcurrentCapture;
+ }
+
+ /** Rated power consumption when detection is active with TDB silence/sound/speech ratio */
+ public int getPowerConsumptionMw() {
+ return mPowerConsumptionMw;
+ }
+
+ /** Returns the trigger (key phrase) capture in the binary data of the
+ * recognition callback event */
+ public boolean isTriggerReturnedInEvent() {
+ return mReturnsTriggerInEvent;
+ }
+
+ /**
+ * Bit field encoding of the AudioCapabilities
+ * supported by the firmware.
+ */
+ @AudioCapabilities
+ public int getAudioCapabilities() {
+ return mAudioCapabilities;
}
public static final @android.annotation.NonNull Parcelable.Creator<ModuleProperties> CREATOR
@@ -235,22 +290,22 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(id);
- dest.writeString(implementor);
- dest.writeString(description);
- dest.writeString(uuid.toString());
- dest.writeInt(version);
- dest.writeString(supportedModelArch);
- dest.writeInt(maxSoundModels);
- dest.writeInt(maxKeyphrases);
- dest.writeInt(maxUsers);
- dest.writeInt(recognitionModes);
- dest.writeByte((byte) (supportsCaptureTransition ? 1 : 0));
- dest.writeInt(maxBufferMs);
- dest.writeByte((byte) (supportsConcurrentCapture ? 1 : 0));
- dest.writeInt(powerConsumptionMw);
- dest.writeByte((byte) (returnsTriggerInEvent ? 1 : 0));
- dest.writeInt(audioCapabilities);
+ dest.writeInt(getId());
+ dest.writeString(getImplementor());
+ dest.writeString(getDescription());
+ dest.writeString(getUuid().toString());
+ dest.writeInt(getVersion());
+ dest.writeString(getSupportedModelArch());
+ dest.writeInt(getMaxSoundModels());
+ dest.writeInt(getMaxKeyphrases());
+ dest.writeInt(getMaxUsers());
+ dest.writeInt(getRecognitionModes());
+ dest.writeByte((byte) (isCaptureTransitionSupported() ? 1 : 0));
+ dest.writeInt(getMaxBufferMillis());
+ dest.writeByte((byte) (isConcurrentCaptureSupported() ? 1 : 0));
+ dest.writeInt(getPowerConsumptionMw());
+ dest.writeByte((byte) (isTriggerReturnedInEvent() ? 1 : 0));
+ dest.writeInt(getAudioCapabilities());
}
@Override
@@ -260,16 +315,17 @@
@Override
public String toString() {
- return "ModuleProperties [id=" + id + ", implementor=" + implementor + ", description="
- + description + ", uuid=" + uuid + ", version=" + version
- + " , supportedModelArch=" + supportedModelArch + ", maxSoundModels="
- + maxSoundModels + ", maxKeyphrases=" + maxKeyphrases + ", maxUsers="
- + maxUsers + ", recognitionModes=" + recognitionModes
- + ", supportsCaptureTransition=" + supportsCaptureTransition + ", maxBufferMs="
- + maxBufferMs + ", supportsConcurrentCapture=" + supportsConcurrentCapture
- + ", powerConsumptionMw=" + powerConsumptionMw
- + ", returnsTriggerInEvent=" + returnsTriggerInEvent
- + ", audioCapabilities=" + audioCapabilities + "]";
+ return "ModuleProperties [id=" + getId() + ", implementor=" + getImplementor()
+ + ", description=" + getDescription() + ", uuid=" + getUuid()
+ + ", version=" + getVersion() + " , supportedModelArch="
+ + getSupportedModelArch() + ", maxSoundModels=" + getMaxSoundModels()
+ + ", maxKeyphrases=" + getMaxKeyphrases() + ", maxUsers=" + getMaxUsers()
+ + ", recognitionModes=" + getRecognitionModes() + ", supportsCaptureTransition="
+ + isCaptureTransitionSupported() + ", maxBufferMs=" + getMaxBufferMillis()
+ + ", supportsConcurrentCapture=" + isConcurrentCaptureSupported()
+ + ", powerConsumptionMw=" + getPowerConsumptionMw()
+ + ", returnsTriggerInEvent=" + isTriggerReturnedInEvent()
+ + ", audioCapabilities=" + getAudioCapabilities() + "]";
}
}
@@ -305,44 +361,64 @@
*/
public static final int TYPE_GENERIC_SOUND = 1;
- /** Unique sound model identifier */
@NonNull
- public final UUID uuid;
-
- /** Sound model type (e.g. TYPE_KEYPHRASE); */
+ private final UUID mUuid;
@SoundModelType
- public final int type;
-
- /** Unique sound model vendor identifier */
+ private final int mType;
@NonNull
- public final UUID vendorUuid;
-
- /** vendor specific version number of the model */
- public final int version;
-
- /** Opaque data. For use by vendor implementation and enrollment application */
+ private final UUID mVendorUuid;
+ private final int mVersion;
@NonNull
- public final byte[] data;
+ private final byte[] mData;
/** @hide */
public SoundModel(@NonNull UUID uuid, @Nullable UUID vendorUuid, @SoundModelType int type,
@Nullable byte[] data, int version) {
- this.uuid = requireNonNull(uuid);
- this.vendorUuid = vendorUuid != null ? vendorUuid : new UUID(0, 0);
- this.type = type;
- this.version = version;
- this.data = data != null ? data : new byte[0];
+ this.mUuid = requireNonNull(uuid);
+ this.mVendorUuid = vendorUuid != null ? vendorUuid : new UUID(0, 0);
+ this.mType = type;
+ this.mVersion = version;
+ this.mData = data != null ? data : new byte[0];
+ }
+
+ /** Unique sound model identifier */
+ @NonNull
+ public UUID getUuid() {
+ return mUuid;
+ }
+
+ /** Sound model type (e.g. TYPE_KEYPHRASE); */
+ @SoundModelType
+ public int getType() {
+ return mType;
+ }
+
+ /** Unique sound model vendor identifier */
+ @NonNull
+ public UUID getVendorUuid() {
+ return mVendorUuid;
+ }
+
+ /** vendor specific version number of the model */
+ public int getVersion() {
+ return mVersion;
+ }
+
+ /** Opaque data. For use by vendor implementation and enrollment application */
+ @NonNull
+ public byte[] getData() {
+ return mData;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + version;
- result = prime * result + Arrays.hashCode(data);
- result = prime * result + type;
- result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
- result = prime * result + ((vendorUuid == null) ? 0 : vendorUuid.hashCode());
+ result = prime * result + getVersion();
+ result = prime * result + Arrays.hashCode(getData());
+ result = prime * result + getType();
+ result = prime * result + ((getUuid() == null) ? 0 : getUuid().hashCode());
+ result = prime * result + ((getVendorUuid() == null) ? 0 : getVendorUuid().hashCode());
return result;
}
@@ -358,27 +434,27 @@
return false;
}
SoundModel other = (SoundModel) obj;
- if (type != other.type) {
+ if (getType() != other.getType()) {
return false;
}
- if (uuid == null) {
- if (other.uuid != null) {
+ if (getUuid() == null) {
+ if (other.getUuid() != null) {
return false;
}
- } else if (!uuid.equals(other.uuid)) {
+ } else if (!getUuid().equals(other.getUuid())) {
return false;
}
- if (vendorUuid == null) {
- if (other.vendorUuid != null) {
+ if (getVendorUuid() == null) {
+ if (other.getVendorUuid() != null) {
return false;
}
- } else if (!vendorUuid.equals(other.vendorUuid)) {
+ } else if (!getVendorUuid().equals(other.getVendorUuid())) {
return false;
}
- if (!Arrays.equals(data, other.data)) {
+ if (!Arrays.equals(getData(), other.getData())) {
return false;
}
- if (version != other.version) {
+ if (getVersion() != other.getVersion()) {
return false;
}
return true;
@@ -390,34 +466,16 @@
* {@link KeyphraseSoundModel}
*/
public static final class Keyphrase implements Parcelable {
- /** Unique identifier for this keyphrase */
- public final int id;
- /**
- * Recognition modes supported for this key phrase in the model
- *
- * @see #RECOGNITION_MODE_VOICE_TRIGGER
- * @see #RECOGNITION_MODE_USER_IDENTIFICATION
- * @see #RECOGNITION_MODE_USER_AUTHENTICATION
- * @see #RECOGNITION_MODE_GENERIC
- */
+ private final int mId;
@RecognitionModes
- public final int recognitionModes;
-
- /** Locale of the keyphrase. */
+ private final int mRecognitionModes;
@NonNull
- public final Locale locale;
-
- /** Key phrase text */
+ private final Locale mLocale;
@NonNull
- public final String text;
-
- /**
- * Users this key phrase has been trained for. countains sound trigger specific user IDs
- * derived from system user IDs {@link android.os.UserHandle#getIdentifier()}.
- */
+ private final String mText;
@NonNull
- public final int[] users;
+ private final int[] mUsers;
/**
* Constructor for Keyphrase describes a key phrase that can be detected by a
@@ -432,11 +490,50 @@
*/
public Keyphrase(int id, @RecognitionModes int recognitionModes, @NonNull Locale locale,
@NonNull String text, @Nullable int[] users) {
- this.id = id;
- this.recognitionModes = recognitionModes;
- this.locale = requireNonNull(locale);
- this.text = requireNonNull(text);
- this.users = users != null ? users : new int[0];
+ this.mId = id;
+ this.mRecognitionModes = recognitionModes;
+ this.mLocale = requireNonNull(locale);
+ this.mText = requireNonNull(text);
+ this.mUsers = users != null ? users : new int[0];
+ }
+
+ /** Unique identifier for this keyphrase */
+ public int getId() {
+ return mId;
+ }
+
+ /**
+ * Recognition modes supported for this key phrase in the model
+ *
+ * @see #RECOGNITION_MODE_VOICE_TRIGGER
+ * @see #RECOGNITION_MODE_USER_IDENTIFICATION
+ * @see #RECOGNITION_MODE_USER_AUTHENTICATION
+ * @see #RECOGNITION_MODE_GENERIC
+ */
+ @RecognitionModes
+ public int getRecognitionModes() {
+ return mRecognitionModes;
+ }
+
+ /** Locale of the keyphrase. */
+ @NonNull
+ public Locale getLocale() {
+ return mLocale;
+ }
+
+ /** Key phrase text */
+ @NonNull
+ public String getText() {
+ return mText;
+ }
+
+ /**
+ * Users this key phrase has been trained for. countains sound trigger specific user IDs
+ * derived from system user IDs {@link android.os.UserHandle#getIdentifier()}.
+ */
+ @NonNull
+ public int[] getUsers() {
+ return mUsers;
}
public static final @NonNull Parcelable.Creator<Keyphrase> CREATOR =
@@ -472,13 +569,13 @@
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
- dest.writeInt(id);
- dest.writeInt(recognitionModes);
- dest.writeString(locale.toLanguageTag());
- dest.writeString(text);
- if (users != null) {
- dest.writeInt(users.length);
- dest.writeIntArray(users);
+ dest.writeInt(getId());
+ dest.writeInt(getRecognitionModes());
+ dest.writeString(getLocale().toLanguageTag());
+ dest.writeString(getText());
+ if (getUsers() != null) {
+ dest.writeInt(getUsers().length);
+ dest.writeIntArray(getUsers());
} else {
dest.writeInt(-1);
}
@@ -494,11 +591,11 @@
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((text == null) ? 0 : text.hashCode());
- result = prime * result + id;
- result = prime * result + ((locale == null) ? 0 : locale.hashCode());
- result = prime * result + recognitionModes;
- result = prime * result + Arrays.hashCode(users);
+ result = prime * result + ((getText() == null) ? 0 : getText().hashCode());
+ result = prime * result + getId();
+ result = prime * result + ((getLocale() == null) ? 0 : getLocale().hashCode());
+ result = prime * result + getRecognitionModes();
+ result = prime * result + Arrays.hashCode(getUsers());
return result;
}
@@ -514,27 +611,27 @@
return false;
}
Keyphrase other = (Keyphrase) obj;
- if (text == null) {
- if (other.text != null) {
+ if (getText() == null) {
+ if (other.getText() != null) {
return false;
}
- } else if (!text.equals(other.text)) {
+ } else if (!getText().equals(other.getText())) {
return false;
}
- if (id != other.id) {
+ if (getId() != other.getId()) {
return false;
}
- if (locale == null) {
- if (other.locale != null) {
+ if (getLocale() == null) {
+ if (other.getLocale() != null) {
return false;
}
- } else if (!locale.equals(other.locale)) {
+ } else if (!getLocale().equals(other.getLocale())) {
return false;
}
- if (recognitionModes != other.recognitionModes) {
+ if (getRecognitionModes() != other.getRecognitionModes()) {
return false;
}
- if (!Arrays.equals(users, other.users)) {
+ if (!Arrays.equals(getUsers(), other.getUsers())) {
return false;
}
return true;
@@ -542,9 +639,9 @@
@Override
public String toString() {
- return "Keyphrase [id=" + id + ", recognitionModes=" + recognitionModes
- + ", locale=" + locale.toLanguageTag() + ", text=" + text
- + ", users=" + Arrays.toString(users) + "]";
+ return "Keyphrase [id=" + getId() + ", recognitionModes=" + getRecognitionModes()
+ + ", locale=" + getLocale().toLanguageTag() + ", text=" + getText()
+ + ", users=" + Arrays.toString(getUsers()) + "]";
}
}
@@ -554,15 +651,15 @@
* and the list of corresponding {@link Keyphrase} descriptors.
*/
public static final class KeyphraseSoundModel extends SoundModel implements Parcelable {
- /** Key phrases in this sound model */
+
@NonNull
- public final Keyphrase[] keyphrases; // keyword phrases in model
+ private final Keyphrase[] mKeyphrases;
public KeyphraseSoundModel(
@NonNull UUID uuid, @NonNull UUID vendorUuid, @Nullable byte[] data,
@Nullable Keyphrase[] keyphrases, int version) {
super(uuid, vendorUuid, TYPE_KEYPHRASE, data, version);
- this.keyphrases = keyphrases != null ? keyphrases : new Keyphrase[0];
+ this.mKeyphrases = keyphrases != null ? keyphrases : new Keyphrase[0];
}
public KeyphraseSoundModel(@NonNull UUID uuid, @NonNull UUID vendorUuid,
@@ -570,6 +667,12 @@
this(uuid, vendorUuid, data, keyphrases, -1);
}
+ /** Key phrases in this sound model */
+ @NonNull
+ public Keyphrase[] getKeyphrases() {
+ return mKeyphrases;
+ }
+
public static final @NonNull Parcelable.Creator<KeyphraseSoundModel> CREATOR =
new Parcelable.Creator<KeyphraseSoundModel>() {
@NonNull
@@ -608,32 +711,32 @@
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
- dest.writeString(uuid.toString());
- if (vendorUuid == null) {
+ dest.writeString(getUuid().toString());
+ if (getVendorUuid() == null) {
dest.writeInt(-1);
} else {
- dest.writeInt(vendorUuid.toString().length());
- dest.writeString(vendorUuid.toString());
+ dest.writeInt(getVendorUuid().toString().length());
+ dest.writeString(getVendorUuid().toString());
}
- dest.writeInt(version);
- dest.writeBlob(data);
- dest.writeTypedArray(keyphrases, flags);
+ dest.writeInt(getVersion());
+ dest.writeBlob(getData());
+ dest.writeTypedArray(getKeyphrases(), flags);
}
@Override
public String toString() {
- return "KeyphraseSoundModel [keyphrases=" + Arrays.toString(keyphrases)
- + ", uuid=" + uuid + ", vendorUuid=" + vendorUuid
- + ", type=" + type
- + ", data=" + (data == null ? 0 : data.length)
- + ", version=" + version + "]";
+ return "KeyphraseSoundModel [keyphrases=" + Arrays.toString(getKeyphrases())
+ + ", uuid=" + getUuid() + ", vendorUuid=" + getVendorUuid()
+ + ", type=" + getType()
+ + ", data=" + (getData() == null ? 0 : getData().length)
+ + ", version=" + getVersion() + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
- result = prime * result + Arrays.hashCode(keyphrases);
+ result = prime * result + Arrays.hashCode(getKeyphrases());
return result;
}
@@ -649,7 +752,7 @@
return false;
}
KeyphraseSoundModel other = (KeyphraseSoundModel) obj;
- if (!Arrays.equals(keyphrases, other.keyphrases)) {
+ if (!Arrays.equals(getKeyphrases(), other.getKeyphrases())) {
return false;
}
return true;
@@ -706,23 +809,23 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeString(uuid.toString());
- if (vendorUuid == null) {
+ dest.writeString(getUuid().toString());
+ if (getVendorUuid() == null) {
dest.writeInt(-1);
} else {
- dest.writeInt(vendorUuid.toString().length());
- dest.writeString(vendorUuid.toString());
+ dest.writeInt(getVendorUuid().toString().length());
+ dest.writeString(getVendorUuid().toString());
}
- dest.writeBlob(data);
- dest.writeInt(version);
+ dest.writeBlob(getData());
+ dest.writeInt(getVersion());
}
@Override
public String toString() {
- return "GenericSoundModel [uuid=" + uuid + ", vendorUuid=" + vendorUuid
- + ", type=" + type
- + ", data=" + (data == null ? 0 : data.length)
- + ", version=" + version + "]";
+ return "GenericSoundModel [uuid=" + getUuid() + ", vendorUuid=" + getVendorUuid()
+ + ", type=" + getType()
+ + ", data=" + (getData() == null ? 0 : getData().length)
+ + ", version=" + getVersion() + "]";
}
}
@@ -1825,7 +1928,7 @@
/**
* Get an interface on a hardware module to control sound models and recognition on
* this module.
- * @param moduleId Sound module system identifier {@link ModuleProperties#id}. mandatory.
+ * @param moduleId Sound module system identifier {@link ModuleProperties#mId}. mandatory.
* @param listener {@link StatusListener} interface. Mandatory.
* @param handler the Handler that will receive the callabcks. Can be null if default handler
* is OK.
diff --git a/core/java/android/service/voice/AlwaysOnHotwordDetector.java b/core/java/android/service/voice/AlwaysOnHotwordDetector.java
index 7d070b1..28340a0 100644
--- a/core/java/android/service/voice/AlwaysOnHotwordDetector.java
+++ b/core/java/android/service/voice/AlwaysOnHotwordDetector.java
@@ -487,7 +487,7 @@
ModuleProperties properties =
mModelManagementService.getDspModuleProperties();
if (properties != null) {
- return properties.audioCapabilities;
+ return properties.getAudioCapabilities();
}
return 0;
diff --git a/media/java/android/media/soundtrigger/SoundTriggerManager.java b/media/java/android/media/soundtrigger/SoundTriggerManager.java
index 6a8483c..7d51b10 100644
--- a/media/java/android/media/soundtrigger/SoundTriggerManager.java
+++ b/media/java/android/media/soundtrigger/SoundTriggerManager.java
@@ -211,7 +211,7 @@
*/
@NonNull
public UUID getModelUuid() {
- return mGenericSoundModel.uuid;
+ return mGenericSoundModel.getUuid();
}
/**
@@ -221,7 +221,7 @@
*/
@NonNull
public UUID getVendorUuid() {
- return mGenericSoundModel.vendorUuid;
+ return mGenericSoundModel.getVendorUuid();
}
/**
@@ -230,7 +230,7 @@
* @return Version associated with the model
*/
public int getVersion() {
- return mGenericSoundModel.version;
+ return mGenericSoundModel.getVersion();
}
/**
@@ -240,7 +240,7 @@
*/
@Nullable
public byte[] getModelData() {
- return mGenericSoundModel.data;
+ return mGenericSoundModel.getData();
}
/**
@@ -307,7 +307,7 @@
}
try {
- switch (soundModel.type) {
+ switch (soundModel.getType()) {
case SoundModel.TYPE_GENERIC_SOUND:
return mSoundTriggerService.loadGenericSoundModel(
(GenericSoundModel) soundModel);
diff --git a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerDbHelper.java b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerDbHelper.java
index 9906585..71da8dd 100644
--- a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerDbHelper.java
+++ b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerDbHelper.java
@@ -86,10 +86,11 @@
synchronized(this) {
SQLiteDatabase db = getWritableDatabase();
ContentValues values = new ContentValues();
- values.put(GenericSoundModelContract.KEY_MODEL_UUID, soundModel.uuid.toString());
- values.put(GenericSoundModelContract.KEY_VENDOR_UUID, soundModel.vendorUuid.toString());
- values.put(GenericSoundModelContract.KEY_DATA, soundModel.data);
- values.put(GenericSoundModelContract.KEY_MODEL_VERSION, soundModel.version);
+ values.put(GenericSoundModelContract.KEY_MODEL_UUID, soundModel.getUuid().toString());
+ values.put(GenericSoundModelContract.KEY_VENDOR_UUID,
+ soundModel.getVendorUuid().toString());
+ values.put(GenericSoundModelContract.KEY_DATA, soundModel.getData());
+ values.put(GenericSoundModelContract.KEY_MODEL_VERSION, soundModel.getVersion());
try {
return db.insertWithOnConflict(GenericSoundModelContract.TABLE, null, values,
@@ -140,7 +141,7 @@
// Delete all sound models for the given keyphrase and specified user.
SQLiteDatabase db = getWritableDatabase();
String soundModelClause = GenericSoundModelContract.KEY_MODEL_UUID
- + "='" + soundModel.uuid.toString() + "'";
+ + "='" + soundModel.getUuid().toString() + "'";
try {
return db.delete(GenericSoundModelContract.TABLE, soundModelClause, null) != 0;
} finally {
diff --git a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java
index 7099c09..6c0f2b0 100644
--- a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java
+++ b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java
@@ -195,7 +195,7 @@
}
// Process existing model first.
- if (model != null && !model.getModelId().equals(soundModel.uuid)) {
+ if (model != null && !model.getModelId().equals(soundModel.getUuid())) {
// The existing model has a different UUID, should be replaced.
int status = cleanUpExistingKeyphraseModelLocked(model);
if (status != STATUS_OK) {
@@ -208,7 +208,7 @@
// We need to create a new one: either no previous models existed for given keyphrase id
// or the existing model had a different UUID and was cleaned up.
if (model == null) {
- model = createKeyphraseModelDataLocked(soundModel.uuid, keyphraseId);
+ model = createKeyphraseModelDataLocked(soundModel.getUuid(), keyphraseId);
}
return startRecognition(soundModel, model, callback, recognitionConfig,
@@ -249,7 +249,7 @@
return STATUS_ERROR;
}
if (mModule == null) {
- mModule = SoundTrigger.attachModule(mModuleProperties.id, this, null);
+ mModule = SoundTrigger.attachModule(mModuleProperties.getId(), this, null);
if (mModule == null) {
Slog.w(TAG, "startRecognition cannot attach to sound trigger module");
return STATUS_ERROR;
diff --git a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java
index 3196758..9cf6369 100644
--- a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java
+++ b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java
@@ -352,7 +352,7 @@
public int loadGenericSoundModel(GenericSoundModel soundModel) {
enforceCallingPermission(Manifest.permission.MANAGE_SOUND_TRIGGER);
if (!isInitialized()) return STATUS_ERROR;
- if (soundModel == null || soundModel.uuid == null) {
+ if (soundModel == null || soundModel.getUuid() == null) {
Slog.e(TAG, "Invalid sound model");
sEventLogger.log(new SoundTriggerLogger.StringEvent(
@@ -361,24 +361,24 @@
return STATUS_ERROR;
}
if (DEBUG) {
- Slog.i(TAG, "loadGenericSoundModel(): id = " + soundModel.uuid);
+ Slog.i(TAG, "loadGenericSoundModel(): id = " + soundModel.getUuid());
}
sEventLogger.log(new SoundTriggerLogger.StringEvent("loadGenericSoundModel(): id = "
- + soundModel.uuid));
+ + soundModel.getUuid()));
synchronized (mLock) {
- SoundModel oldModel = mLoadedModels.get(soundModel.uuid);
+ SoundModel oldModel = mLoadedModels.get(soundModel.getUuid());
// If the model we're loading is actually different than what we had loaded, we
// should unload that other model now. We don't care about return codes since we
// don't know if the other model is loaded.
if (oldModel != null && !oldModel.equals(soundModel)) {
- mSoundTriggerHelper.unloadGenericSoundModel(soundModel.uuid);
+ mSoundTriggerHelper.unloadGenericSoundModel(soundModel.getUuid());
synchronized (mCallbacksLock) {
- mCallbacks.remove(soundModel.uuid);
+ mCallbacks.remove(soundModel.getUuid());
}
}
- mLoadedModels.put(soundModel.uuid, soundModel);
+ mLoadedModels.put(soundModel.getUuid(), soundModel);
}
return STATUS_OK;
}
@@ -387,7 +387,7 @@
public int loadKeyphraseSoundModel(KeyphraseSoundModel soundModel) {
enforceCallingPermission(Manifest.permission.MANAGE_SOUND_TRIGGER);
if (!isInitialized()) return STATUS_ERROR;
- if (soundModel == null || soundModel.uuid == null) {
+ if (soundModel == null || soundModel.getUuid() == null) {
Slog.e(TAG, "Invalid sound model");
sEventLogger.log(new SoundTriggerLogger.StringEvent(
@@ -395,7 +395,7 @@
return STATUS_ERROR;
}
- if (soundModel.keyphrases == null || soundModel.keyphrases.length != 1) {
+ if (soundModel.getKeyphrases() == null || soundModel.getKeyphrases().length != 1) {
Slog.e(TAG, "Only one keyphrase per model is currently supported.");
sEventLogger.log(new SoundTriggerLogger.StringEvent(
@@ -405,24 +405,25 @@
return STATUS_ERROR;
}
if (DEBUG) {
- Slog.i(TAG, "loadKeyphraseSoundModel(): id = " + soundModel.uuid);
+ Slog.i(TAG, "loadKeyphraseSoundModel(): id = " + soundModel.getUuid());
}
sEventLogger.log(new SoundTriggerLogger.StringEvent("loadKeyphraseSoundModel(): id = "
- + soundModel.uuid));
+ + soundModel.getUuid()));
synchronized (mLock) {
- SoundModel oldModel = mLoadedModels.get(soundModel.uuid);
+ SoundModel oldModel = mLoadedModels.get(soundModel.getUuid());
// If the model we're loading is actually different than what we had loaded, we
// should unload that other model now. We don't care about return codes since we
// don't know if the other model is loaded.
if (oldModel != null && !oldModel.equals(soundModel)) {
- mSoundTriggerHelper.unloadKeyphraseSoundModel(soundModel.keyphrases[0].id);
+ mSoundTriggerHelper.unloadKeyphraseSoundModel(
+ soundModel.getKeyphrases()[0].getId());
synchronized (mCallbacksLock) {
- mCallbacks.remove(soundModel.uuid);
+ mCallbacks.remove(soundModel.getUuid());
}
}
- mLoadedModels.put(soundModel.uuid, soundModel);
+ mLoadedModels.put(soundModel.getUuid(), soundModel);
}
return STATUS_OK;
}
@@ -472,9 +473,9 @@
return STATUS_ERROR;
}
int ret;
- switch (soundModel.type) {
+ switch (soundModel.getType()) {
case SoundModel.TYPE_GENERIC_SOUND:
- ret = mSoundTriggerHelper.startGenericRecognition(soundModel.uuid,
+ ret = mSoundTriggerHelper.startGenericRecognition(soundModel.getUuid(),
(GenericSoundModel) soundModel, callback, config);
break;
default:
@@ -539,9 +540,10 @@
return STATUS_ERROR;
}
int ret;
- switch (soundModel.type) {
+ switch (soundModel.getType()) {
case SoundModel.TYPE_GENERIC_SOUND:
- ret = mSoundTriggerHelper.stopGenericRecognition(soundModel.uuid, callback);
+ ret = mSoundTriggerHelper.stopGenericRecognition(
+ soundModel.getUuid(), callback);
break;
default:
Slog.e(TAG, "Unknown model type");
@@ -591,13 +593,13 @@
return STATUS_ERROR;
}
int ret;
- switch (soundModel.type) {
+ switch (soundModel.getType()) {
case SoundModel.TYPE_KEYPHRASE:
ret = mSoundTriggerHelper.unloadKeyphraseSoundModel(
- ((KeyphraseSoundModel)soundModel).keyphrases[0].id);
+ ((KeyphraseSoundModel) soundModel).getKeyphrases()[0].getId());
break;
case SoundModel.TYPE_GENERIC_SOUND:
- ret = mSoundTriggerHelper.unloadGenericSoundModel(soundModel.uuid);
+ ret = mSoundTriggerHelper.unloadGenericSoundModel(soundModel.getUuid());
break;
default:
Slog.e(TAG, "Unknown model type");
@@ -655,16 +657,16 @@
return ret;
}
- switch (soundModel.type) {
+ switch (soundModel.getType()) {
case SoundModel.TYPE_GENERIC_SOUND:
- ret = mSoundTriggerHelper.getGenericModelState(soundModel.uuid);
+ ret = mSoundTriggerHelper.getGenericModelState(soundModel.getUuid());
break;
default:
// SoundModel.TYPE_KEYPHRASE is not supported to increase privacy.
- Slog.e(TAG, "Unsupported model type, " + soundModel.type);
+ Slog.e(TAG, "Unsupported model type, " + soundModel.getType());
sEventLogger.log(new SoundTriggerLogger.StringEvent(
"getModelState(): Unsupported model type, "
- + soundModel.type));
+ + soundModel.getType()));
break;
}
@@ -717,7 +719,7 @@
return STATUS_BAD_VALUE;
}
- return mSoundTriggerHelper.setParameter(soundModel.uuid, modelParam, value);
+ return mSoundTriggerHelper.setParameter(soundModel.getUuid(), modelParam, value);
}
}
@@ -749,7 +751,7 @@
throw new IllegalArgumentException("sound model is not loaded");
}
- return mSoundTriggerHelper.getParameter(soundModel.uuid, modelParam);
+ return mSoundTriggerHelper.getParameter(soundModel.getUuid(), modelParam);
}
}
@@ -780,7 +782,7 @@
return null;
}
- return mSoundTriggerHelper.queryParameter(soundModel.uuid, modelParam);
+ return mSoundTriggerHelper.queryParameter(soundModel.getUuid(), modelParam);
}
}
}
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/DatabaseHelper.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/DatabaseHelper.java
index be0987d..aaf7a9e 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/DatabaseHelper.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/DatabaseHelper.java
@@ -162,23 +162,26 @@
synchronized(this) {
SQLiteDatabase db = getWritableDatabase();
ContentValues values = new ContentValues();
- values.put(SoundModelContract.KEY_MODEL_UUID, soundModel.uuid.toString());
- if (soundModel.vendorUuid != null) {
- values.put(SoundModelContract.KEY_VENDOR_UUID, soundModel.vendorUuid.toString());
+ values.put(SoundModelContract.KEY_MODEL_UUID, soundModel.getUuid().toString());
+ if (soundModel.getVendorUuid() != null) {
+ values.put(SoundModelContract.KEY_VENDOR_UUID,
+ soundModel.getVendorUuid().toString());
}
values.put(SoundModelContract.KEY_TYPE, SoundTrigger.SoundModel.TYPE_KEYPHRASE);
- values.put(SoundModelContract.KEY_DATA, soundModel.data);
- values.put(SoundModelContract.KEY_MODEL_VERSION, soundModel.version);
+ values.put(SoundModelContract.KEY_DATA, soundModel.getData());
+ values.put(SoundModelContract.KEY_MODEL_VERSION, soundModel.getVersion());
- if (soundModel.keyphrases != null && soundModel.keyphrases.length == 1) {
- values.put(SoundModelContract.KEY_KEYPHRASE_ID, soundModel.keyphrases[0].id);
+ if (soundModel.getKeyphrases() != null && soundModel.getKeyphrases().length == 1) {
+ values.put(SoundModelContract.KEY_KEYPHRASE_ID,
+ soundModel.getKeyphrases()[0].getId());
values.put(SoundModelContract.KEY_RECOGNITION_MODES,
- soundModel.keyphrases[0].recognitionModes);
+ soundModel.getKeyphrases()[0].getRecognitionModes());
values.put(SoundModelContract.KEY_USERS,
- getCommaSeparatedString(soundModel.keyphrases[0].users));
+ getCommaSeparatedString(soundModel.getKeyphrases()[0].getUsers()));
values.put(SoundModelContract.KEY_LOCALE,
- soundModel.keyphrases[0].locale.toLanguageTag());
- values.put(SoundModelContract.KEY_HINT_TEXT, soundModel.keyphrases[0].text);
+ soundModel.getKeyphrases()[0].getLocale().toLanguageTag());
+ values.put(SoundModelContract.KEY_HINT_TEXT,
+ soundModel.getKeyphrases()[0].getText());
try {
return db.insertWithOnConflict(SoundModelContract.TABLE, null, values,
SQLiteDatabase.CONFLICT_REPLACE) != -1;
@@ -206,7 +209,7 @@
// Delete all sound models for the given keyphrase and specified user.
SQLiteDatabase db = getWritableDatabase();
String soundModelClause = SoundModelContract.KEY_MODEL_UUID
- + "='" + soundModel.uuid.toString() + "'";
+ + "='" + soundModel.getUuid().toString() + "'";
try {
return db.delete(SoundModelContract.TABLE, soundModelClause, null) != 0;
} finally {
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
index 18d5819..ef282ba 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
@@ -1045,12 +1045,12 @@
return null;
}
- for (SoundTrigger.Keyphrase phrase : model.keyphrases) {
- if (keyphrase.equals(phrase.text)) {
+ for (SoundTrigger.Keyphrase phrase : model.getKeyphrases()) {
+ if (keyphrase.equals(phrase.getText())) {
ArraySet<Locale> locales = new ArraySet<>();
- locales.add(phrase.locale);
- return new KeyphraseMetadata(phrase.id, phrase.text, locales,
- phrase.recognitionModes);
+ locales.add(phrase.getLocale());
+ return new KeyphraseMetadata(phrase.getId(), phrase.getText(), locales,
+ phrase.getRecognitionModes());
}
}
} finally {
@@ -1093,8 +1093,8 @@
KeyphraseSoundModel soundModel =
mDbHelper.getKeyphraseSoundModel(keyphraseId, callingUid, bcp47Locale);
if (soundModel == null
- || soundModel.uuid == null
- || soundModel.keyphrases == null) {
+ || soundModel.getUuid() == null
+ || soundModel.getKeyphrases() == null) {
Slog.w(TAG, "No matching sound model found in startRecognition");
return SoundTriggerInternal.STATUS_ERROR;
} else {
diff --git a/tests/SoundTriggerTestApp/src/com/android/test/soundtrigger/SoundTriggerTestService.java b/tests/SoundTriggerTestApp/src/com/android/test/soundtrigger/SoundTriggerTestService.java
index b185a26..9324ba0 100644
--- a/tests/SoundTriggerTestApp/src/com/android/test/soundtrigger/SoundTriggerTestService.java
+++ b/tests/SoundTriggerTestApp/src/com/android/test/soundtrigger/SoundTriggerTestService.java
@@ -250,10 +250,12 @@
boolean status = mSoundTriggerUtil.addOrUpdateSoundModel(soundModel);
if (status) {
- postToast("Successfully loaded " + modelInfo.name + ", UUID=" + soundModel.uuid);
+ postToast("Successfully loaded " + modelInfo.name + ", UUID="
+ + soundModel.getUuid());
setModelState(modelInfo, "Loaded");
} else {
- postErrorToast("Failed to load " + modelInfo.name + ", UUID=" + soundModel.uuid + "!");
+ postErrorToast("Failed to load " + modelInfo.name + ", UUID="
+ + soundModel.getUuid() + "!");
setModelState(modelInfo, "Failed to load");
}
}
@@ -275,11 +277,12 @@
modelInfo.detector = null;
boolean status = mSoundTriggerUtil.deleteSoundModel(modelUuid);
if (status) {
- postToast("Successfully unloaded " + modelInfo.name + ", UUID=" + soundModel.uuid);
+ postToast("Successfully unloaded " + modelInfo.name + ", UUID="
+ + soundModel.getUuid());
setModelState(modelInfo, "Unloaded");
} else {
postErrorToast("Failed to unload " +
- modelInfo.name + ", UUID=" + soundModel.uuid + "!");
+ modelInfo.name + ", UUID=" + soundModel.getUuid() + "!");
setModelState(modelInfo, "Failed to unload");
}
}
@@ -299,7 +302,8 @@
GenericSoundModel updated = createNewSoundModel(modelInfo);
boolean status = mSoundTriggerUtil.addOrUpdateSoundModel(updated);
if (status) {
- postToast("Successfully reloaded " + modelInfo.name + ", UUID=" + modelInfo.modelUuid);
+ postToast("Successfully reloaded " + modelInfo.name + ", UUID="
+ + modelInfo.modelUuid);
setModelState(modelInfo, "Reloaded");
} else {
postErrorToast("Failed to reload "
@@ -321,7 +325,8 @@
modelUuid, new DetectorCallback(modelInfo));
}
- postMessage("Starting recognition for " + modelInfo.name + ", UUID=" + modelInfo.modelUuid);
+ postMessage("Starting recognition for " + modelInfo.name + ", UUID="
+ + modelInfo.modelUuid);
if (modelInfo.detector.startRecognition(modelInfo.captureAudio ?
SoundTriggerDetector.RECOGNITION_FLAG_CAPTURE_TRIGGER_AUDIO :
SoundTriggerDetector.RECOGNITION_FLAG_ALLOW_MULTIPLE_TRIGGERS)) {
@@ -495,7 +500,8 @@
if (properties.containsKey("dataFile")) {
File modelDataFile = new File(
- getFilesDir().getPath() + "/" + properties.getProperty("dataFile"));
+ getFilesDir().getPath() + "/"
+ + properties.getProperty("dataFile"));
modelInfo.modelData = new byte[(int) modelDataFile.length()];
FileInputStream input = new FileInputStream(modelDataFile);
input.read(modelInfo.modelData, 0, modelInfo.modelData.length);
@@ -602,12 +608,14 @@
FileOutputStream fos = null;
try {
fos = new FileOutputStream( new File(
- getFilesDir() + File.separator + mModelInfo.name.replace(' ', '_') +
- "_capture_" + format.getChannelCount() + "ch_" +
- format.getSampleRate() + "hz_" + encoding + ".pcm"));
+ getFilesDir() + File.separator
+ + mModelInfo.name.replace(' ', '_')
+ + "_capture_" + format.getChannelCount() + "ch_"
+ + format.getSampleRate() + "hz_" + encoding + ".pcm"));
} catch (IOException e) {
Log.e(TAG, "Failed to open output for saving PCM data", e);
- postErrorToast("Failed to open output for saving PCM data: " + e.getMessage());
+ postErrorToast("Failed to open output for saving PCM data: "
+ + e.getMessage());
}
// Inform the user we're recording.
@@ -690,7 +698,8 @@
AudioFormat format = event.getCaptureAudioFormat();
result = result + "AudioFormat: " + ((format == null) ? "null" : format.toString());
byte[] triggerAudio = event.getTriggerAudio();
- result = result + ", TriggerAudio: " + (triggerAudio == null ? "null" : triggerAudio.length);
+ result = result + ", TriggerAudio: "
+ + (triggerAudio == null ? "null" : triggerAudio.length);
byte[] data = event.getData();
result = result + ", Data: " + (data == null ? "null" : data.length);
if (data != null) {
diff --git a/tests/SoundTriggerTests/src/android/hardware/soundtrigger/SoundTriggerTest.java b/tests/SoundTriggerTests/src/android/hardware/soundtrigger/SoundTriggerTest.java
index c900eae..e36f398 100644
--- a/tests/SoundTriggerTests/src/android/hardware/soundtrigger/SoundTriggerTest.java
+++ b/tests/SoundTriggerTests/src/android/hardware/soundtrigger/SoundTriggerTest.java
@@ -16,7 +16,6 @@
package android.hardware.soundtrigger;
-import android.hardware.soundtrigger.SoundTrigger;
import android.hardware.soundtrigger.SoundTrigger.ConfidenceLevel;
import android.hardware.soundtrigger.SoundTrigger.Keyphrase;
import android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionEvent;
@@ -51,10 +50,10 @@
Keyphrase unparceled = Keyphrase.CREATOR.createFromParcel(parcel);
// Verify that they are the same
- assertEquals(keyphrase.id, unparceled.id);
- assertNull(unparceled.users);
- assertEquals(keyphrase.locale, unparceled.locale);
- assertEquals(keyphrase.text, unparceled.text);
+ assertEquals(keyphrase.getId(), unparceled.getId());
+ assertNull(unparceled.getUsers());
+ assertEquals(keyphrase.getLocale(), unparceled.getLocale());
+ assertEquals(keyphrase.getText(), unparceled.getText());
}
@SmallTest
@@ -71,10 +70,10 @@
Keyphrase unparceled = Keyphrase.CREATOR.createFromParcel(parcel);
// Verify that they are the same
- assertEquals(keyphrase.id, unparceled.id);
- assertTrue(Arrays.equals(keyphrase.users, unparceled.users));
- assertEquals(keyphrase.locale, unparceled.locale);
- assertEquals(keyphrase.text, unparceled.text);
+ assertEquals(keyphrase.getId(), unparceled.getId());
+ assertTrue(Arrays.equals(keyphrase.getUsers(), unparceled.getUsers()));
+ assertEquals(keyphrase.getLocale(), unparceled.getLocale());
+ assertEquals(keyphrase.getText(), unparceled.getText());
}
@SmallTest
@@ -91,10 +90,10 @@
Keyphrase unparceled = Keyphrase.CREATOR.createFromParcel(parcel);
// Verify that they are the same
- assertEquals(keyphrase.id, unparceled.id);
- assertTrue(Arrays.equals(keyphrase.users, unparceled.users));
- assertEquals(keyphrase.locale, unparceled.locale);
- assertEquals(keyphrase.text, unparceled.text);
+ assertEquals(keyphrase.getId(), unparceled.getId());
+ assertTrue(Arrays.equals(keyphrase.getUsers(), unparceled.getUsers()));
+ assertEquals(keyphrase.getLocale(), unparceled.getLocale());
+ assertEquals(keyphrase.getText(), unparceled.getText());
}
@SmallTest
@@ -116,10 +115,10 @@
KeyphraseSoundModel unparceled = KeyphraseSoundModel.CREATOR.createFromParcel(parcel);
// Verify that they are the same
- assertEquals(ksm.uuid, unparceled.uuid);
- assertNull(unparceled.data);
- assertEquals(ksm.type, unparceled.type);
- assertTrue(Arrays.equals(keyphrases, unparceled.keyphrases));
+ assertEquals(ksm.getUuid(), unparceled.getUuid());
+ assertNull(unparceled.getData());
+ assertEquals(ksm.getType(), unparceled.getType());
+ assertTrue(Arrays.equals(keyphrases, unparceled.getKeyphrases()));
}
@SmallTest
@@ -141,10 +140,10 @@
KeyphraseSoundModel unparceled = KeyphraseSoundModel.CREATOR.createFromParcel(parcel);
// Verify that they are the same
- assertEquals(ksm.uuid, unparceled.uuid);
- assertEquals(ksm.type, unparceled.type);
- assertTrue(Arrays.equals(ksm.keyphrases, unparceled.keyphrases));
- assertTrue(Arrays.equals(ksm.data, unparceled.data));
+ assertEquals(ksm.getUuid(), unparceled.getUuid());
+ assertEquals(ksm.getType(), unparceled.getType());
+ assertTrue(Arrays.equals(ksm.getKeyphrases(), unparceled.getKeyphrases()));
+ assertTrue(Arrays.equals(ksm.getData(), unparceled.getData()));
}
@SmallTest
@@ -163,10 +162,10 @@
KeyphraseSoundModel unparceled = KeyphraseSoundModel.CREATOR.createFromParcel(parcel);
// Verify that they are the same
- assertEquals(ksm.uuid, unparceled.uuid);
- assertEquals(ksm.type, unparceled.type);
- assertNull(unparceled.keyphrases);
- assertTrue(Arrays.equals(ksm.data, unparceled.data));
+ assertEquals(ksm.getUuid(), unparceled.getUuid());
+ assertEquals(ksm.getType(), unparceled.getType());
+ assertNull(unparceled.getKeyphrases());
+ assertTrue(Arrays.equals(ksm.getData(), unparceled.getData()));
}
@SmallTest
@@ -185,10 +184,10 @@
KeyphraseSoundModel unparceled = KeyphraseSoundModel.CREATOR.createFromParcel(parcel);
// Verify that they are the same
- assertEquals(ksm.uuid, unparceled.uuid);
- assertEquals(ksm.type, unparceled.type);
- assertTrue(Arrays.equals(ksm.keyphrases, unparceled.keyphrases));
- assertTrue(Arrays.equals(ksm.data, unparceled.data));
+ assertEquals(ksm.getUuid(), unparceled.getUuid());
+ assertEquals(ksm.getType(), unparceled.getType());
+ assertTrue(Arrays.equals(ksm.getKeyphrases(), unparceled.getKeyphrases()));
+ assertTrue(Arrays.equals(ksm.getData(), unparceled.getData()));
}
@LargeTest
@@ -212,10 +211,10 @@
KeyphraseSoundModel unparceled = KeyphraseSoundModel.CREATOR.createFromParcel(parcel);
// Verify that they are the same
- assertEquals(ksm.uuid, unparceled.uuid);
- assertEquals(ksm.type, unparceled.type);
- assertTrue(Arrays.equals(ksm.data, unparceled.data));
- assertTrue(Arrays.equals(ksm.keyphrases, unparceled.keyphrases));
+ assertEquals(ksm.getUuid(), unparceled.getUuid());
+ assertEquals(ksm.getType(), unparceled.getType());
+ assertTrue(Arrays.equals(ksm.getData(), unparceled.getData()));
+ assertTrue(Arrays.equals(ksm.getKeyphrases(), unparceled.getKeyphrases()));
}
@SmallTest
diff --git a/tests/SoundTriggerTests/src/android/hardware/soundtrigger/stubhal/GenericSoundModelTest.java b/tests/SoundTriggerTests/src/android/hardware/soundtrigger/stubhal/GenericSoundModelTest.java
index c0583ce..2c3592c 100644
--- a/tests/SoundTriggerTests/src/android/hardware/soundtrigger/stubhal/GenericSoundModelTest.java
+++ b/tests/SoundTriggerTests/src/android/hardware/soundtrigger/stubhal/GenericSoundModelTest.java
@@ -17,7 +17,6 @@
package android.hardware.soundtrigger;
import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.timeout;
@@ -37,6 +36,8 @@
import com.android.internal.app.ISoundTriggerService;
+import org.mockito.MockitoAnnotations;
+
import java.io.DataOutputStream;
import java.net.InetAddress;
import java.net.Socket;
@@ -45,8 +46,6 @@
import java.util.Random;
import java.util.UUID;
-import org.mockito.MockitoAnnotations;
-
public class GenericSoundModelTest extends AndroidTestCase {
static final int MSG_DETECTION_ERROR = -1;
static final int MSG_DETECTION_RESUME = 0;
@@ -96,11 +95,11 @@
// Update sound model
soundTriggerService.updateSoundModel(model);
- loadedModelUuids.add(model.uuid);
+ loadedModelUuids.add(model.getUuid());
// Confirm it was updated
GenericSoundModel returnedModel =
- soundTriggerService.getSoundModel(new ParcelUuid(model.uuid));
+ soundTriggerService.getSoundModel(new ParcelUuid(model.getUuid()));
assertEquals(model, returnedModel);
}
@@ -110,15 +109,15 @@
// Update sound model
soundTriggerService.updateSoundModel(model);
- loadedModelUuids.add(model.uuid);
+ loadedModelUuids.add(model.getUuid());
// Delete sound model
- soundTriggerService.deleteSoundModel(new ParcelUuid(model.uuid));
- loadedModelUuids.remove(model.uuid);
+ soundTriggerService.deleteSoundModel(new ParcelUuid(model.getUuid()));
+ loadedModelUuids.remove(model.getUuid());
// Confirm it was deleted
GenericSoundModel returnedModel =
- soundTriggerService.getSoundModel(new ParcelUuid(model.uuid));
+ soundTriggerService.getSoundModel(new ParcelUuid(model.getUuid()));
assertEquals(null, returnedModel);
}
@@ -134,14 +133,14 @@
// Update and start sound model recognition
soundTriggerService.updateSoundModel(model);
- loadedModelUuids.add(model.uuid);
- int r = soundTriggerService.startRecognition(new ParcelUuid(model.uuid), spyCallback,
+ loadedModelUuids.add(model.getUuid());
+ int r = soundTriggerService.startRecognition(new ParcelUuid(model.getUuid()), spyCallback,
config);
assertEquals("Could Not Start Recognition with code: " + r,
android.hardware.soundtrigger.SoundTrigger.STATUS_OK, r);
// Stop recognition
- r = soundTriggerService.stopRecognition(new ParcelUuid(model.uuid), spyCallback);
+ r = soundTriggerService.stopRecognition(new ParcelUuid(model.getUuid()), spyCallback);
assertEquals("Could Not Stop Recognition with code: " + r,
android.hardware.soundtrigger.SoundTrigger.STATUS_OK, r);
}
@@ -158,13 +157,13 @@
// Update and start sound model
soundTriggerService.updateSoundModel(model);
- loadedModelUuids.add(model.uuid);
- soundTriggerService.startRecognition(new ParcelUuid(model.uuid), spyCallback, config);
+ loadedModelUuids.add(model.getUuid());
+ soundTriggerService.startRecognition(new ParcelUuid(model.getUuid()), spyCallback, config);
// Send trigger to stub HAL
Socket socket = new Socket(InetAddress.getLocalHost(), 14035);
DataOutputStream out = new DataOutputStream(socket.getOutputStream());
- out.writeBytes("trig " + model.uuid.toString() + "\r\n");
+ out.writeBytes("trig " + model.getUuid().toString() + "\r\n");
out.flush();
socket.close();
@@ -227,11 +226,12 @@
if (operation == 0 && modelInfo.status == STATUS_UNLOADED) {
// Update and start sound model
soundTriggerService.updateSoundModel(modelInfo.model);
- loadedModelUuids.add(modelInfo.model.uuid);
+ loadedModelUuids.add(modelInfo.model.getUuid());
modelInfo.status = STATUS_LOADED;
} else if (operation == 1 && modelInfo.status == STATUS_LOADED) {
// Start the sound model
- int r = soundTriggerService.startRecognition(new ParcelUuid(modelInfo.model.uuid),
+ int r = soundTriggerService.startRecognition(new ParcelUuid(
+ modelInfo.model.getUuid()),
spyCallback, config);
assertEquals("Could Not Start Recognition with code: " + r,
android.hardware.soundtrigger.SoundTrigger.STATUS_OK, r);
@@ -240,7 +240,7 @@
// Send trigger to stub HAL
Socket socket = new Socket(InetAddress.getLocalHost(), 14035);
DataOutputStream out = new DataOutputStream(socket.getOutputStream());
- out.writeBytes("trig " + modelInfo.model.uuid + "\r\n");
+ out.writeBytes("trig " + modelInfo.model.getUuid() + "\r\n");
out.flush();
socket.close();
@@ -249,19 +249,20 @@
reset(spyCallback);
} else if (operation == 3 && modelInfo.status == STATUS_STARTED) {
// Stop recognition
- int r = soundTriggerService.stopRecognition(new ParcelUuid(modelInfo.model.uuid),
+ int r = soundTriggerService.stopRecognition(new ParcelUuid(
+ modelInfo.model.getUuid()),
spyCallback);
assertEquals("Could Not Stop Recognition with code: " + r,
android.hardware.soundtrigger.SoundTrigger.STATUS_OK, r);
modelInfo.status = STATUS_LOADED;
} else if (operation == 4 && modelInfo.status != STATUS_UNLOADED) {
// Delete sound model
- soundTriggerService.deleteSoundModel(new ParcelUuid(modelInfo.model.uuid));
- loadedModelUuids.remove(modelInfo.model.uuid);
+ soundTriggerService.deleteSoundModel(new ParcelUuid(modelInfo.model.getUuid()));
+ loadedModelUuids.remove(modelInfo.model.getUuid());
// Confirm it was deleted
- GenericSoundModel returnedModel =
- soundTriggerService.getSoundModel(new ParcelUuid(modelInfo.model.uuid));
+ GenericSoundModel returnedModel = soundTriggerService.getSoundModel(
+ new ParcelUuid(modelInfo.model.getUuid()));
assertEquals(null, returnedModel);
modelInfo.status = STATUS_UNLOADED;
}
diff --git a/tests/VoiceEnrollment/src/com/android/test/voiceenrollment/EnrollmentUtil.java b/tests/VoiceEnrollment/src/com/android/test/voiceenrollment/EnrollmentUtil.java
index 7927ac4..287364f 100644
--- a/tests/VoiceEnrollment/src/com/android/test/voiceenrollment/EnrollmentUtil.java
+++ b/tests/VoiceEnrollment/src/com/android/test/voiceenrollment/EnrollmentUtil.java
@@ -159,36 +159,36 @@
Log.e(TAG, "KeyphraseSoundModel must be non-null");
return false;
}
- if (soundModel.uuid == null) {
+ if (soundModel.getUuid() == null) {
Log.e(TAG, "KeyphraseSoundModel must have a UUID");
return false;
}
- if (soundModel.data == null) {
+ if (soundModel.getData() == null) {
Log.e(TAG, "KeyphraseSoundModel must have data");
return false;
}
- if (soundModel.keyphrases == null || soundModel.keyphrases.length != 1) {
+ if (soundModel.getKeyphrases() == null || soundModel.getKeyphrases().length != 1) {
Log.e(TAG, "Keyphrase must be exactly 1");
return false;
}
- Keyphrase keyphrase = soundModel.keyphrases[0];
- if (keyphrase.id <= 0) {
+ Keyphrase keyphrase = soundModel.getKeyphrases()[0];
+ if (keyphrase.getId() <= 0) {
Log.e(TAG, "Keyphrase must have a valid ID");
return false;
}
- if (keyphrase.recognitionModes < 0) {
+ if (keyphrase.getRecognitionModes() < 0) {
Log.e(TAG, "Recognition modes must be valid");
return false;
}
- if (keyphrase.locale == null) {
+ if (keyphrase.getLocale() == null) {
Log.e(TAG, "Locale must not be null");
return false;
}
- if (keyphrase.text == null) {
+ if (keyphrase.getText() == null) {
Log.e(TAG, "Text must not be null");
return false;
}
- if (keyphrase.users == null || keyphrase.users.length == 0) {
+ if (keyphrase.getUsers() == null || keyphrase.getUsers().length == 0) {
Log.e(TAG, "Keyphrase must have valid user(s)");
return false;
}
diff --git a/tests/VoiceEnrollment/src/com/android/test/voiceenrollment/TestEnrollmentActivity.java b/tests/VoiceEnrollment/src/com/android/test/voiceenrollment/TestEnrollmentActivity.java
index b357ad0..e4880fd 100644
--- a/tests/VoiceEnrollment/src/com/android/test/voiceenrollment/TestEnrollmentActivity.java
+++ b/tests/VoiceEnrollment/src/com/android/test/voiceenrollment/TestEnrollmentActivity.java
@@ -91,7 +91,7 @@
}
boolean status = mEnrollmentUtil.deleteSoundModel(KEYPHRASE_ID, BCP47_LOCALE);
if (status) {
- Toast.makeText(this, "Successfully un-enrolled, model UUID=" + soundModel.uuid,
+ Toast.makeText(this, "Successfully un-enrolled, model UUID=" + soundModel.getUuid(),
Toast.LENGTH_SHORT)
.show();
} else {
@@ -112,11 +112,11 @@
// Generate a fake model to push.
byte[] data = new byte[2048];
mRandom.nextBytes(data);
- KeyphraseSoundModel updated = new KeyphraseSoundModel(soundModel.uuid,
- soundModel.vendorUuid, data, soundModel.keyphrases);
+ KeyphraseSoundModel updated = new KeyphraseSoundModel(soundModel.getUuid(),
+ soundModel.getVendorUuid(), data, soundModel.getKeyphrases());
boolean status = mEnrollmentUtil.addOrUpdateSoundModel(updated);
if (status) {
- Toast.makeText(this, "Successfully re-enrolled, model UUID=" + updated.uuid,
+ Toast.makeText(this, "Successfully re-enrolled, model UUID=" + updated.getUuid(),
Toast.LENGTH_SHORT)
.show();
} else {