Merge "ApiCouncil review round3 / setHidden, Query.getExtras" into sc-dev

This commit is contained in:
Hyunyoung Song
2021-05-24 21:14:10 +00:00
committed by Android (Google) Code Review
4 changed files with 54 additions and 14 deletions

View File

@@ -1458,6 +1458,7 @@ package android.app.search {
method public long getTimestampMillis(); method public long getTimestampMillis();
method public void writeToParcel(@NonNull android.os.Parcel, int); method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.app.search.Query> CREATOR; 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 { 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.content.pm.ShortcutInfo getShortcutInfo();
method @Nullable public android.net.Uri getSliceUri(); method @Nullable public android.net.Uri getSliceUri();
method @NonNull public android.os.UserHandle getUserHandle(); method @NonNull public android.os.UserHandle getUserHandle();
method public boolean shouldHide(); method public boolean isHidden();
method public void writeToParcel(@NonNull android.os.Parcel, int); method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.app.search.SearchTarget> CREATOR; field @NonNull public static final android.os.Parcelable.Creator<android.app.search.SearchTarget> CREATOR;
field public static final String LAYOUT_TYPE_ICON = "icon"; 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 build();
method @NonNull public android.app.search.SearchTarget.Builder setAppWidgetProviderInfo(@NonNull android.appwidget.AppWidgetProviderInfo); 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 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 setPackageName(@NonNull String);
method @NonNull public android.app.search.SearchTarget.Builder setParentId(@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 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 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 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 setSliceUri(@NonNull android.net.Uri);
method @NonNull public android.app.search.SearchTarget.Builder setUserHandle(@NonNull android.os.UserHandle); 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(); 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 { package android.bluetooth {

View File

@@ -36,6 +36,14 @@ import android.os.Parcelable;
@SystemApi @SystemApi
public final class Query implements 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. * string typed from the client.
*/ */
@@ -45,7 +53,7 @@ public final class Query implements Parcelable {
private final long mTimestampMillis; 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 @NonNull
private final Bundle mExtras; private final Bundle mExtras;

View File

@@ -50,7 +50,7 @@ import java.util.Objects;
* can recommend which layout this target should be rendered in. * can recommend which layout this target should be rendered in.
* *
* The service can also use fields such as {@link #getScore()} to indicate * 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. * whether it is recommended to be shown by default.
* *
* Finally, {@link #getId()} is the unique identifier of this search target and a single * 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 float mScore;
private final boolean mShouldHide; private final boolean mHidden;
@NonNull @NonNull
private final String mPackageName; private final String mPackageName;
@@ -149,7 +149,7 @@ public final class SearchTarget implements Parcelable {
mId = parcel.readString(); mId = parcel.readString();
mParentId = parcel.readString(); mParentId = parcel.readString();
mScore = parcel.readFloat(); mScore = parcel.readFloat();
mShouldHide = parcel.readBoolean(); mHidden = parcel.readBoolean();
mPackageName = parcel.readString(); mPackageName = parcel.readString();
mUserHandle = UserHandle.of(parcel.readInt()); mUserHandle = UserHandle.of(parcel.readInt());
@@ -165,7 +165,7 @@ public final class SearchTarget implements Parcelable {
@NonNull String layoutType, @NonNull String layoutType,
@NonNull String id, @NonNull String id,
@Nullable String parentId, @Nullable String parentId,
float score, boolean shouldHide, float score, boolean hidden,
@NonNull String packageName, @NonNull String packageName,
@NonNull UserHandle userHandle, @NonNull UserHandle userHandle,
@Nullable SearchAction action, @Nullable SearchAction action,
@@ -178,7 +178,7 @@ public final class SearchTarget implements Parcelable {
mId = Objects.requireNonNull(id); mId = Objects.requireNonNull(id);
mParentId = parentId; mParentId = parentId;
mScore = score; mScore = score;
mShouldHide = shouldHide; mHidden = hidden;
mPackageName = Objects.requireNonNull(packageName); mPackageName = Objects.requireNonNull(packageName);
mUserHandle = Objects.requireNonNull(userHandle); mUserHandle = Objects.requireNonNull(userHandle);
mSearchAction = action; mSearchAction = action;
@@ -238,9 +238,20 @@ public final class SearchTarget implements Parcelable {
/** /**
* Indicates whether this object should be hidden and shown only on demand. * Indicates whether this object should be hidden and shown only on demand.
*
* @deprecated will be removed once SDK drops
* @removed
*/ */
@Deprecated
public boolean shouldHide() { 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(mId);
parcel.writeString(mParentId); parcel.writeString(mParentId);
parcel.writeFloat(mScore); parcel.writeFloat(mScore);
parcel.writeBoolean(mShouldHide); parcel.writeBoolean(mHidden);
parcel.writeString(mPackageName); parcel.writeString(mPackageName);
parcel.writeInt(mUserHandle.getIdentifier()); parcel.writeInt(mUserHandle.getIdentifier());
parcel.writeTypedObject(mSearchAction, flags); parcel.writeTypedObject(mSearchAction, flags);
@@ -351,7 +362,7 @@ public final class SearchTarget implements Parcelable {
@Nullable @Nullable
private String mParentId; private String mParentId;
private float mScore; private float mScore;
private boolean mShouldHide; private boolean mHidden;
@NonNull @NonNull
private String mPackageName; private String mPackageName;
@NonNull @NonNull
@@ -374,7 +385,7 @@ public final class SearchTarget implements Parcelable {
mLayoutType = Objects.requireNonNull(layoutType); mLayoutType = Objects.requireNonNull(layoutType);
mResultType = resultType; mResultType = resultType;
mScore = 1f; 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. * Sets whether the result should be hidden (e.g. not visible) by default inside client.
*/ */
@NonNull @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) { public Builder setShouldHide(boolean shouldHide) {
mShouldHide = shouldHide; mHidden = shouldHide;
return this; return this;
} }
@@ -485,7 +508,7 @@ public final class SearchTarget implements Parcelable {
*/ */
@NonNull @NonNull
public SearchTarget build() { public SearchTarget build() {
return new SearchTarget(mResultType, mLayoutType, mId, mParentId, mScore, mShouldHide, return new SearchTarget(mResultType, mLayoutType, mId, mParentId, mScore, mHidden,
mPackageName, mUserHandle, mPackageName, mUserHandle,
mSearchAction, mShortcutInfo, mSliceUri, mAppWidgetProviderInfo, mSearchAction, mShortcutInfo, mSliceUri, mAppWidgetProviderInfo,
mExtras); mExtras);