Merge "Remove remaining deepCopy() usages in TextClassifier" into qt-dev
am: ac3d917aa3
Change-Id: I6abf490577424d6f8f9d83ecc9b15d027ec3773d
This commit is contained in:
@@ -266,7 +266,7 @@ public final class ConversationAction implements Parcelable {
|
||||
mAction,
|
||||
mTextReply,
|
||||
mScore,
|
||||
mExtras == null ? Bundle.EMPTY : mExtras.deepCopy());
|
||||
mExtras == null ? Bundle.EMPTY : mExtras);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ public final class ConversationActions implements Parcelable {
|
||||
mAuthor,
|
||||
mReferenceTime,
|
||||
mText == null ? null : new SpannedString(mText),
|
||||
mExtras == null ? new Bundle() : mExtras.deepCopy());
|
||||
mExtras == null ? Bundle.EMPTY : mExtras);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ public final class TextClassification implements Parcelable {
|
||||
}
|
||||
|
||||
private Bundle buildExtras(EntityConfidence entityConfidence) {
|
||||
final Bundle extras = mExtras == null ? new Bundle() : mExtras.deepCopy();
|
||||
final Bundle extras = mExtras == null ? new Bundle() : mExtras;
|
||||
if (mActionIntents.stream().anyMatch(Objects::nonNull)) {
|
||||
ExtrasUtils.putActionsIntents(extras, mActionIntents);
|
||||
}
|
||||
@@ -713,7 +713,7 @@ public final class TextClassification implements Parcelable {
|
||||
public Request build() {
|
||||
return new Request(new SpannedString(mText), mStartIndex, mEndIndex,
|
||||
mDefaultLocales, mReferenceTime,
|
||||
mExtras == null ? Bundle.EMPTY : mExtras.deepCopy());
|
||||
mExtras == null ? Bundle.EMPTY : mExtras);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,12 +113,11 @@ public final class TextLanguage implements Parcelable {
|
||||
* Returns a bundle containing non-structured extra information about this result. What is
|
||||
* returned in the extras is specific to the {@link TextClassifier} implementation.
|
||||
*
|
||||
* <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should prefer
|
||||
* to hold a reference to the returned bundle rather than frequently calling this method.
|
||||
* <p><b>NOTE: </b>Do not modify this bundle.
|
||||
*/
|
||||
@NonNull
|
||||
public Bundle getExtras() {
|
||||
return mBundle.deepCopy();
|
||||
return mBundle;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -199,7 +198,7 @@ public final class TextLanguage implements Parcelable {
|
||||
*/
|
||||
@NonNull
|
||||
public TextLanguage build() {
|
||||
mBundle = mBundle == null ? new Bundle() : mBundle.deepCopy();
|
||||
mBundle = mBundle == null ? Bundle.EMPTY : mBundle;
|
||||
return new TextLanguage(
|
||||
mId,
|
||||
new EntityConfidence(mEntityConfidenceMap),
|
||||
@@ -263,13 +262,11 @@ public final class TextLanguage implements Parcelable {
|
||||
/**
|
||||
* Returns a bundle containing non-structured extra information about this request.
|
||||
*
|
||||
* <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should
|
||||
* prefer to hold a reference to the returned bundle rather than frequently calling this
|
||||
* method.
|
||||
* <p><b>NOTE: </b>Do not modify this bundle.
|
||||
*/
|
||||
@NonNull
|
||||
public Bundle getExtras() {
|
||||
return mExtra.deepCopy();
|
||||
return mExtra;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -327,8 +324,7 @@ public final class TextLanguage implements Parcelable {
|
||||
*/
|
||||
@NonNull
|
||||
public Request build() {
|
||||
mBundle = mBundle == null ? new Bundle() : mBundle.deepCopy();
|
||||
return new Request(mText.toString(), mBundle);
|
||||
return new Request(mText.toString(), mBundle == null ? Bundle.EMPTY : mBundle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ public final class TextLinks implements Parcelable {
|
||||
return new Request(
|
||||
mText, mDefaultLocales, mEntityConfig,
|
||||
mLegacyFallback,
|
||||
mExtras == null ? Bundle.EMPTY : mExtras.deepCopy());
|
||||
mExtras == null ? Bundle.EMPTY : mExtras);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -702,7 +702,7 @@ public final class TextLinks implements Parcelable {
|
||||
@NonNull
|
||||
public TextLinks build() {
|
||||
return new TextLinks(mFullText, mLinks,
|
||||
mExtras == null ? Bundle.EMPTY : mExtras.deepCopy());
|
||||
mExtras == null ? Bundle.EMPTY : mExtras);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ public final class TextSelection implements Parcelable {
|
||||
public TextSelection build() {
|
||||
return new TextSelection(
|
||||
mStartIndex, mEndIndex, mEntityConfidence, mId,
|
||||
mExtras == null ? Bundle.EMPTY : mExtras.deepCopy());
|
||||
mExtras == null ? Bundle.EMPTY : mExtras);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ public final class TextSelection implements Parcelable {
|
||||
public Request build() {
|
||||
return new Request(new SpannedString(mText), mStartIndex, mEndIndex,
|
||||
mDefaultLocales, mDarkLaunchAllowed,
|
||||
mExtras == null ? Bundle.EMPTY : mExtras.deepCopy());
|
||||
mExtras == null ? Bundle.EMPTY : mExtras);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user