summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2022-11-25 08:50:28 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-11-25 08:50:28 +0000
commitdad85c36a8a6013516ccd947cb3acfa3468f2c08 (patch)
treec55c6507e8015f12cc460686f1482753a9ed42c9
parentd7c440b1967b0cec57837f6d92d4e7fd1a48ef0f (diff)
parent874c074ad407e5716cc3db2bdba7ef89e180c91d (diff)
Merge "Hotword: Update HotwordAudioStream for AudioTimestamp"
-rw-r--r--core/java/android/service/voice/HotwordAudioStream.java45
1 files changed, 5 insertions, 40 deletions
diff --git a/core/java/android/service/voice/HotwordAudioStream.java b/core/java/android/service/voice/HotwordAudioStream.java
index bf8ee47261fd..1c57700d38e1 100644
--- a/core/java/android/service/voice/HotwordAudioStream.java
+++ b/core/java/android/service/voice/HotwordAudioStream.java
@@ -92,41 +92,6 @@ public final class HotwordAudioStream implements Parcelable {
return new PersistableBundle();
}
- private String timestampToString() {
- if (mTimestamp == null) {
- return "";
- }
- return "TimeStamp:"
- + " framePos=" + mTimestamp.framePosition
- + " nanoTime=" + mTimestamp.nanoTime;
- }
-
- private void parcelTimestamp(Parcel dest, int flags) {
- if (mTimestamp != null) {
- // mTimestamp is not null, we write it to the parcel, set true.
- dest.writeBoolean(true);
- dest.writeLong(mTimestamp.framePosition);
- dest.writeLong(mTimestamp.nanoTime);
- } else {
- // mTimestamp is null, we don't write any value out, set false.
- dest.writeBoolean(false);
- }
- }
-
- @Nullable
- private static AudioTimestamp unparcelTimestamp(Parcel in) {
- // If it is true, it means we wrote the value to the parcel before, parse it.
- // Otherwise, return null.
- if (in.readBoolean()) {
- final AudioTimestamp timeStamp = new AudioTimestamp();
- timeStamp.framePosition = in.readLong();
- timeStamp.nanoTime = in.readLong();
- return timeStamp;
- } else {
- return null;
- }
- }
-
/**
* Provides an instance of {@link Builder} with state corresponding to this instance.
* @hide
@@ -229,7 +194,7 @@ public final class HotwordAudioStream implements Parcelable {
return "HotwordAudioStream { " +
"audioFormat = " + mAudioFormat + ", " +
"audioStreamParcelFileDescriptor = " + mAudioStreamParcelFileDescriptor + ", " +
- "timestamp = " + timestampToString() + ", " +
+ "timestamp = " + mTimestamp + ", " +
"metadata = " + mMetadata +
" }";
}
@@ -278,7 +243,7 @@ public final class HotwordAudioStream implements Parcelable {
dest.writeByte(flg);
dest.writeTypedObject(mAudioFormat, flags);
dest.writeTypedObject(mAudioStreamParcelFileDescriptor, flags);
- parcelTimestamp(dest, flags);
+ if (mTimestamp != null) dest.writeTypedObject(mTimestamp, flags);
dest.writeTypedObject(mMetadata, flags);
}
@@ -296,7 +261,7 @@ public final class HotwordAudioStream implements Parcelable {
byte flg = in.readByte();
AudioFormat audioFormat = (AudioFormat) in.readTypedObject(AudioFormat.CREATOR);
ParcelFileDescriptor audioStreamParcelFileDescriptor = (ParcelFileDescriptor) in.readTypedObject(ParcelFileDescriptor.CREATOR);
- AudioTimestamp timestamp = unparcelTimestamp(in);
+ AudioTimestamp timestamp = (flg & 0x4) == 0 ? null : (AudioTimestamp) in.readTypedObject(AudioTimestamp.CREATOR);
PersistableBundle metadata = (PersistableBundle) in.readTypedObject(PersistableBundle.CREATOR);
this.mAudioFormat = audioFormat;
@@ -449,10 +414,10 @@ public final class HotwordAudioStream implements Parcelable {
}
@DataClass.Generated(
- time = 1666342101364L,
+ time = 1669184301563L,
codegenVersion = "1.0.23",
sourceFile = "frameworks/base/core/java/android/service/voice/HotwordAudioStream.java",
- inputSignatures = "private final @android.annotation.NonNull android.media.AudioFormat mAudioFormat\nprivate final @android.annotation.NonNull android.os.ParcelFileDescriptor mAudioStreamParcelFileDescriptor\nprivate final @android.annotation.Nullable android.media.AudioTimestamp mTimestamp\nprivate final @android.annotation.NonNull android.os.PersistableBundle mMetadata\nprivate static android.media.AudioTimestamp defaultTimestamp()\nprivate static android.os.PersistableBundle defaultMetadata()\nprivate java.lang.String timestampToString()\nprivate void parcelTimestamp(android.os.Parcel,int)\nprivate static @android.annotation.Nullable android.media.AudioTimestamp unparcelTimestamp(android.os.Parcel)\npublic android.service.voice.HotwordAudioStream.Builder buildUpon()\nclass HotwordAudioStream extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genConstructor=false, genBuilder=true, genEqualsHashCode=true, genParcelable=true, genToString=true)")
+ inputSignatures = "private final @android.annotation.NonNull android.media.AudioFormat mAudioFormat\nprivate final @android.annotation.NonNull android.os.ParcelFileDescriptor mAudioStreamParcelFileDescriptor\nprivate final @android.annotation.Nullable android.media.AudioTimestamp mTimestamp\nprivate final @android.annotation.NonNull android.os.PersistableBundle mMetadata\nprivate static android.media.AudioTimestamp defaultTimestamp()\nprivate static android.os.PersistableBundle defaultMetadata()\npublic android.service.voice.HotwordAudioStream.Builder buildUpon()\nclass HotwordAudioStream extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genConstructor=false, genBuilder=true, genEqualsHashCode=true, genParcelable=true, genToString=true)")
@Deprecated
private void __metadata() {}