diff --git a/core/api/system-current.txt b/core/api/system-current.txt index aaf371f83421f..9befc3b4e1af9 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -1458,6 +1458,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 CREATOR; + field public static final String EXTRA_IME_HEIGHT = "android.app.search.extra.IME_HEIGHT"; } public final class SearchAction implements android.os.Parcelable { @@ -1526,7 +1527,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 CREATOR; field public static final String LAYOUT_TYPE_ICON = "icon"; @@ -1543,12 +1544,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(@FloatRange(from=0.0f, to=1.0f) 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); } diff --git a/core/api/system-removed.txt b/core/api/system-removed.txt index 304f4fe1df337..7cf007640b1a4 100644 --- a/core/api/system-removed.txt +++ b/core/api/system-removed.txt @@ -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 { diff --git a/core/java/android/app/search/Query.java b/core/java/android/app/search/Query.java index 34ace48148e6d..c64e10723ca68 100644 --- a/core/java/android/app/search/Query.java +++ b/core/java/android/app/search/Query.java @@ -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; diff --git a/core/java/android/app/search/SearchTarget.java b/core/java/android/app/search/SearchTarget.java index 6d638d47f5258..a590a5d7b767b 100644 --- a/core/java/android/app/search/SearchTarget.java +++ b/core/java/android/app/search/SearchTarget.java @@ -50,7 +50,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 @@ -125,7 +125,7 @@ public final class SearchTarget implements Parcelable { private final float mScore; - private final boolean mShouldHide; + private final boolean mHidden; @NonNull private final String mPackageName; @@ -149,7 +149,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()); @@ -165,7 +165,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, @@ -178,7 +178,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; @@ -238,9 +238,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; } /** @@ -311,7 +322,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); @@ -351,7 +362,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 @@ -374,7 +385,7 @@ public final class SearchTarget implements Parcelable { mLayoutType = Objects.requireNonNull(layoutType); mResultType = resultType; mScore = 1f; - mShouldHide = false; + mHidden = false; } /** @@ -473,8 +484,20 @@ public final class SearchTarget implements Parcelable { * Sets whether the result should be hidden (e.g. not visible) 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; } @@ -485,7 +508,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);