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