ApiCouncil review round3 / setHidden, Query.getExtras

Bug: 186756959
Test: atest CtsSearchUiServiceTestCases
Change-Id: I2d13556fd71ddf8ae4e44879a91039a698667001
This commit is contained in:
Hyunyoung Song
2021-05-21 11:42:36 -07:00
parent 666d445123
commit c94e76051f
4 changed files with 54 additions and 14 deletions

View File

@@ -1457,6 +1457,7 @@ package android.app.search {
method public long getTimestampMillis();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.app.search.Query> CREATOR;
field public static final String EXTRA_IME_HEIGHT = "android.app.search.extra.IME_HEIGHT";
}
public final class SearchAction implements android.os.Parcelable {
@@ -1525,7 +1526,7 @@ package android.app.search {
method @Nullable public android.content.pm.ShortcutInfo getShortcutInfo();
method @Nullable public android.net.Uri getSliceUri();
method @NonNull public android.os.UserHandle getUserHandle();
method public boolean shouldHide();
method public boolean isHidden();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.app.search.SearchTarget> CREATOR;
field public static final int RESULT_TYPE_APPLICATION = 1; // 0x1
@@ -1539,12 +1540,12 @@ package android.app.search {
method @NonNull public android.app.search.SearchTarget build();
method @NonNull public android.app.search.SearchTarget.Builder setAppWidgetProviderInfo(@NonNull android.appwidget.AppWidgetProviderInfo);
method @NonNull public android.app.search.SearchTarget.Builder setExtras(@NonNull android.os.Bundle);
method @NonNull public android.app.search.SearchTarget.Builder setHidden(boolean);
method @NonNull public android.app.search.SearchTarget.Builder setPackageName(@NonNull String);
method @NonNull public android.app.search.SearchTarget.Builder setParentId(@NonNull String);
method @NonNull public android.app.search.SearchTarget.Builder setScore(float);
method @NonNull public android.app.search.SearchTarget.Builder setSearchAction(@Nullable android.app.search.SearchAction);
method @NonNull public android.app.search.SearchTarget.Builder setShortcutInfo(@NonNull android.content.pm.ShortcutInfo);
method @NonNull public android.app.search.SearchTarget.Builder setShouldHide(boolean);
method @NonNull public android.app.search.SearchTarget.Builder setSliceUri(@NonNull android.net.Uri);
method @NonNull public android.app.search.SearchTarget.Builder setUserHandle(@NonNull android.os.UserHandle);
}

View File

@@ -58,6 +58,14 @@ package android.app.search {
method @Deprecated public void destroy();
}
public final class SearchTarget implements android.os.Parcelable {
method @Deprecated public boolean shouldHide();
}
public static final class SearchTarget.Builder {
method @Deprecated @NonNull public android.app.search.SearchTarget.Builder setShouldHide(boolean);
}
}
package android.bluetooth {

View File

@@ -36,6 +36,14 @@ import android.os.Parcelable;
@SystemApi
public final class Query implements Parcelable {
/**
* The lookup key for a integer that indicates what the height of the soft keyboard
* (e.g., IME, also known as Input Method Editor) was on the client window
* in dp (density-independent pixels). This information is to be used by the consumer
* of the API in estimating how many search results will be visible above the keyboard.
*/
public static final String EXTRA_IME_HEIGHT = "android.app.search.extra.IME_HEIGHT";
/**
* string typed from the client.
*/
@@ -45,7 +53,7 @@ public final class Query implements Parcelable {
private final long mTimestampMillis;
/**
* Contains other client UI constraints related data
* Contains other client UI constraints related data (e.g., {@link #EXTRA_IME_HEIGHT}.
*/
@NonNull
private final Bundle mExtras;

View File

@@ -48,7 +48,7 @@ import java.util.Objects;
* can recommend which layout this target should be rendered in.
*
* The service can also use fields such as {@link #getScore()} to indicate
* how confidence the search result is and {@link #shouldHide()} to indicate
* how confidence the search result is and {@link #isHidden()} to indicate
* whether it is recommended to be shown by default.
*
* Finally, {@link #getId()} is the unique identifier of this search target and a single
@@ -94,7 +94,7 @@ public final class SearchTarget implements Parcelable {
private final float mScore;
private final boolean mShouldHide;
private final boolean mHidden;
@NonNull
private final String mPackageName;
@@ -118,7 +118,7 @@ public final class SearchTarget implements Parcelable {
mId = parcel.readString();
mParentId = parcel.readString();
mScore = parcel.readFloat();
mShouldHide = parcel.readBoolean();
mHidden = parcel.readBoolean();
mPackageName = parcel.readString();
mUserHandle = UserHandle.of(parcel.readInt());
@@ -134,7 +134,7 @@ public final class SearchTarget implements Parcelable {
@NonNull String layoutType,
@NonNull String id,
@Nullable String parentId,
float score, boolean shouldHide,
float score, boolean hidden,
@NonNull String packageName,
@NonNull UserHandle userHandle,
@Nullable SearchAction action,
@@ -147,7 +147,7 @@ public final class SearchTarget implements Parcelable {
mId = Objects.requireNonNull(id);
mParentId = parentId;
mScore = score;
mShouldHide = shouldHide;
mHidden = hidden;
mPackageName = Objects.requireNonNull(packageName);
mUserHandle = Objects.requireNonNull(userHandle);
mSearchAction = action;
@@ -207,9 +207,20 @@ public final class SearchTarget implements Parcelable {
/**
* Indicates whether this object should be hidden and shown only on demand.
*
* @deprecated will be removed once SDK drops
* @removed
*/
@Deprecated
public boolean shouldHide() {
return mShouldHide;
return mHidden;
}
/**
* Indicates whether this object should be hidden and shown only on demand.
*/
public boolean isHidden() {
return mHidden;
}
/**
@@ -280,7 +291,7 @@ public final class SearchTarget implements Parcelable {
parcel.writeString(mId);
parcel.writeString(mParentId);
parcel.writeFloat(mScore);
parcel.writeBoolean(mShouldHide);
parcel.writeBoolean(mHidden);
parcel.writeString(mPackageName);
parcel.writeInt(mUserHandle.getIdentifier());
parcel.writeTypedObject(mSearchAction, flags);
@@ -320,7 +331,7 @@ public final class SearchTarget implements Parcelable {
@Nullable
private String mParentId;
private float mScore;
private boolean mShouldHide;
private boolean mHidden;
@NonNull
private String mPackageName;
@NonNull
@@ -343,7 +354,7 @@ public final class SearchTarget implements Parcelable {
mLayoutType = Objects.requireNonNull(layoutType);
mResultType = resultType;
mScore = 1f;
mShouldHide = false;
mHidden = false;
}
/**
@@ -442,8 +453,20 @@ public final class SearchTarget implements Parcelable {
* Sets whether the result should be hidden by default inside client.
*/
@NonNull
public Builder setHidden(boolean hidden) {
mHidden = hidden;
return this;
}
/**
* Sets whether the result should be hidden by default inside client.
* @deprecated will be removed once SDK drops
* @removed
*/
@NonNull
@Deprecated
public Builder setShouldHide(boolean shouldHide) {
mShouldHide = shouldHide;
mHidden = shouldHide;
return this;
}
@@ -454,7 +477,7 @@ public final class SearchTarget implements Parcelable {
*/
@NonNull
public SearchTarget build() {
return new SearchTarget(mResultType, mLayoutType, mId, mParentId, mScore, mShouldHide,
return new SearchTarget(mResultType, mLayoutType, mId, mParentId, mScore, mHidden,
mPackageName, mUserHandle,
mSearchAction, mShortcutInfo, mSliceUri, mAppWidgetProviderInfo,
mExtras);