diff options
-rw-r--r-- | core/api/system-current.txt | 5 | ||||
-rw-r--r-- | core/api/system-removed.txt | 8 | ||||
-rw-r--r-- | core/java/android/app/search/Query.java | 10 | ||||
-rw-r--r-- | core/java/android/app/search/SearchTarget.java | 45 |
4 files changed, 54 insertions, 14 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index e80615a0801a..f4bc435ea244 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -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); } diff --git a/core/api/system-removed.txt b/core/api/system-removed.txt index 65a87808b7b1..1ffaff0c5ee7 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 34ace48148e6..c64e10723ca6 100644 --- a/core/java/android/app/search/Query.java +++ b/core/java/android/app/search/Query.java @@ -37,6 +37,14 @@ import android.os.Parcelable; 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. */ @NonNull @@ -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 56c5ddf9ace7..a25cf303bccc 100644 --- a/core/java/android/app/search/SearchTarget.java +++ b/core/java/android/app/search/SearchTarget.java @@ -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); |