diff options
author | Sandeep Siddhartha <sansid@google.com> | 2014-10-16 16:17:11 -0700 |
---|---|---|
committer | Sandeep Siddhartha <sansid@google.com> | 2014-11-12 09:57:27 -0800 |
commit | 45c00b5877e908f44853783b42deb437cfd30d94 (patch) | |
tree | a1777be0bddcc8c405bb2a197f6f79020a6469a5 /core/java/android/hardware | |
parent | 4fc2ea8402b62001b225bf4e1a335c4cbf3b65ea (diff) | |
download | frameworks_base-45c00b5877e908f44853783b42deb437cfd30d94.zip frameworks_base-45c00b5877e908f44853783b42deb437cfd30d94.tar.gz frameworks_base-45c00b5877e908f44853783b42deb437cfd30d94.tar.bz2 |
Don't unload the sound model on stopRecognition
This helps us in majority of the scenarios where the sound model doesn't
change across start/stop calls.
Bug: 17954633
Change-Id: Ibff817bb69bc69d2bb3a2603460fed596688b892
Diffstat (limited to 'core/java/android/hardware')
-rw-r--r-- | core/java/android/hardware/soundtrigger/SoundTrigger.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/core/java/android/hardware/soundtrigger/SoundTrigger.java b/core/java/android/hardware/soundtrigger/SoundTrigger.java index 746ead2..c85e97b 100644 --- a/core/java/android/hardware/soundtrigger/SoundTrigger.java +++ b/core/java/android/hardware/soundtrigger/SoundTrigger.java @@ -211,6 +211,43 @@ public class SoundTrigger { this.type = type; this.data = data; } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + 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()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof SoundModel)) + return false; + SoundModel other = (SoundModel) obj; + if (!Arrays.equals(data, other.data)) + return false; + if (type != other.type) + return false; + if (uuid == null) { + if (other.uuid != null) + return false; + } else if (!uuid.equals(other.uuid)) + return false; + if (vendorUuid == null) { + if (other.vendorUuid != null) + return false; + } else if (!vendorUuid.equals(other.vendorUuid)) + return false; + return true; + } } /***************************************************************************** @@ -395,6 +432,28 @@ public class SoundTrigger { + ", uuid=" + uuid + ", vendorUuid=" + vendorUuid + ", type=" + type + ", data=" + (data == null ? 0 : data.length) + "]"; } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + Arrays.hashCode(keyphrases); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof KeyphraseSoundModel)) + return false; + KeyphraseSoundModel other = (KeyphraseSoundModel) obj; + if (!Arrays.equals(keyphrases, other.keyphrases)) + return false; + return true; + } } /** |