Migrate android.view.inline to android.widget.inline

Old APIs are kept and marked as @hide + @removed to maintain
compatibility.

Bug: 151262653
Test: manual verification
Change-Id: Ia50a1f87c194211be5256e948d43fb54c1cbf941
This commit is contained in:
Adam He
2020-03-25 15:11:18 -07:00
parent d658ab5971
commit f27433af0f
13 changed files with 732 additions and 108 deletions

View File

@@ -43141,9 +43141,9 @@ package android.service.autofill {
}
public final class InlinePresentation implements android.os.Parcelable {
ctor public InlinePresentation(@NonNull android.app.slice.Slice, @NonNull android.view.inline.InlinePresentationSpec, boolean);
ctor public InlinePresentation(@NonNull android.app.slice.Slice, @NonNull android.widget.inline.InlinePresentationSpec, boolean);
method public int describeContents();
method @NonNull public android.view.inline.InlinePresentationSpec getInlinePresentationSpec();
method @NonNull public android.widget.inline.InlinePresentationSpec getInlinePresentationSpec();
method @NonNull public android.app.slice.Slice getSlice();
method public boolean isPinned();
method public void writeToParcel(@NonNull android.os.Parcel, int);
@@ -56767,38 +56767,6 @@ package android.view.contentcapture {
}
package android.view.inline {
public class InlineContentView extends android.view.ViewGroup {
method @Nullable public android.view.SurfaceControl getSurfaceControl();
method public boolean isZOrderedOnTop();
method public void onLayout(boolean, int, int, int, int);
method public void setSurfaceControlCallback(@Nullable android.view.inline.InlineContentView.SurfaceControlCallback);
method public boolean setZOrderedOnTop(boolean);
}
public static interface InlineContentView.SurfaceControlCallback {
method public void onCreated(@NonNull android.view.SurfaceControl);
method public void onDestroyed(@NonNull android.view.SurfaceControl);
}
public final class InlinePresentationSpec implements android.os.Parcelable {
method public int describeContents();
method @NonNull public android.util.Size getMaxSize();
method @NonNull public android.util.Size getMinSize();
method @Nullable public android.os.Bundle getStyle();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.view.inline.InlinePresentationSpec> CREATOR;
}
public static final class InlinePresentationSpec.Builder {
ctor public InlinePresentationSpec.Builder(@NonNull android.util.Size, @NonNull android.util.Size);
method @NonNull public android.view.inline.InlinePresentationSpec build();
method @NonNull public android.view.inline.InlinePresentationSpec.Builder setStyle(@NonNull android.os.Bundle);
}
}
package android.view.inputmethod {
public class BaseInputConnection implements android.view.inputmethod.InputConnection {
@@ -56970,7 +56938,7 @@ package android.view.inputmethod {
public final class InlineSuggestion implements android.os.Parcelable {
method public int describeContents();
method @NonNull public android.view.inputmethod.InlineSuggestionInfo getInfo();
method public void inflate(@NonNull android.content.Context, @NonNull android.util.Size, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.view.inline.InlineContentView>);
method public void inflate(@NonNull android.content.Context, @NonNull android.util.Size, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.widget.inline.InlineContentView>);
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.InlineSuggestion> CREATOR;
}
@@ -56978,7 +56946,7 @@ package android.view.inputmethod {
public final class InlineSuggestionInfo implements android.os.Parcelable {
method public int describeContents();
method @Nullable public String[] getAutofillHints();
method @NonNull public android.view.inline.InlinePresentationSpec getPresentationSpec();
method @NonNull public android.widget.inline.InlinePresentationSpec getInlinePresentationSpec();
method @NonNull public String getSource();
method @NonNull public String getType();
method public boolean isPinned();
@@ -56994,8 +56962,8 @@ package android.view.inputmethod {
method public int describeContents();
method @Nullable public android.os.Bundle getExtras();
method @NonNull public String getHostPackageName();
method @NonNull public java.util.List<android.widget.inline.InlinePresentationSpec> getInlinePresentationSpecs();
method public int getMaxSuggestionCount();
method @NonNull public java.util.List<android.view.inline.InlinePresentationSpec> getPresentationSpecs();
method @NonNull public android.os.LocaleList getSupportedLocales();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.InlineSuggestionsRequest> CREATOR;
@@ -57003,10 +56971,11 @@ package android.view.inputmethod {
}
public static final class InlineSuggestionsRequest.Builder {
ctor public InlineSuggestionsRequest.Builder(@NonNull java.util.List<android.view.inline.InlinePresentationSpec>);
method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder addPresentationSpecs(@NonNull android.view.inline.InlinePresentationSpec);
ctor public InlineSuggestionsRequest.Builder(@NonNull java.util.List<android.widget.inline.InlinePresentationSpec>);
method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder addInlinePresentationSpecs(@NonNull android.widget.inline.InlinePresentationSpec);
method @NonNull public android.view.inputmethod.InlineSuggestionsRequest build();
method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder setExtras(@NonNull android.os.Bundle);
method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder setInlinePresentationSpecs(@NonNull java.util.List<android.widget.inline.InlinePresentationSpec>);
method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder setMaxSuggestionCount(int);
method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder setSupportedLocales(@NonNull android.os.LocaleList);
}
@@ -61600,6 +61569,38 @@ package android.widget {
}
package android.widget.inline {
public class InlineContentView extends android.view.ViewGroup {
method @Nullable public android.view.SurfaceControl getSurfaceControl();
method public boolean isZOrderedOnTop();
method public void onLayout(boolean, int, int, int, int);
method public void setSurfaceControlCallback(@Nullable android.widget.inline.InlineContentView.SurfaceControlCallback);
method public boolean setZOrderedOnTop(boolean);
}
public static interface InlineContentView.SurfaceControlCallback {
method public void onCreated(@NonNull android.view.SurfaceControl);
method public void onDestroyed(@NonNull android.view.SurfaceControl);
}
public final class InlinePresentationSpec implements android.os.Parcelable {
method public int describeContents();
method @NonNull public android.util.Size getMaxSize();
method @NonNull public android.util.Size getMinSize();
method @Nullable public android.os.Bundle getStyle();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.widget.inline.InlinePresentationSpec> CREATOR;
}
public static final class InlinePresentationSpec.Builder {
ctor public InlinePresentationSpec.Builder(@NonNull android.util.Size, @NonNull android.util.Size);
method @NonNull public android.widget.inline.InlinePresentationSpec build();
method @NonNull public android.widget.inline.InlinePresentationSpec.Builder setStyle(@NonNull android.os.Bundle);
}
}
package dalvik.annotation {
@Deprecated @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.ANNOTATION_TYPE}) public @interface TestTarget {

View File

@@ -5052,7 +5052,7 @@ package android.view.inputmethod {
}
public final class InlineSuggestionInfo implements android.os.Parcelable {
method @NonNull public static android.view.inputmethod.InlineSuggestionInfo newInlineSuggestionInfo(@NonNull android.view.inline.InlinePresentationSpec, @NonNull String, @Nullable String[], @NonNull String, boolean);
method @NonNull public static android.view.inputmethod.InlineSuggestionInfo newInlineSuggestionInfo(@NonNull android.widget.inline.InlinePresentationSpec, @NonNull String, @Nullable String[], @NonNull String, boolean);
}
public final class InlineSuggestionsResponse implements android.os.Parcelable {

View File

@@ -21,7 +21,7 @@ import android.annotation.Size;
import android.app.slice.Slice;
import android.os.Parcel;
import android.os.Parcelable;
import android.view.inline.InlinePresentationSpec;
import android.widget.inline.InlinePresentationSpec;
import com.android.internal.util.DataClass;
@@ -233,7 +233,7 @@ public final class InlinePresentation implements Parcelable {
time = 1582753782651L,
codegenVersion = "1.0.14",
sourceFile = "frameworks/base/core/java/android/service/autofill/InlinePresentation.java",
inputSignatures = "private final @android.annotation.NonNull android.app.slice.Slice mSlice\nprivate final @android.annotation.NonNull android.view.inline.InlinePresentationSpec mInlinePresentationSpec\nprivate final boolean mPinned\npublic @android.annotation.NonNull @android.annotation.Size(min=0L) java.lang.String[] getAutofillHints()\nclass InlinePresentation extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genHiddenConstDefs=true, genEqualsHashCode=true)")
inputSignatures = "private final @android.annotation.NonNull android.app.slice.Slice mSlice\nprivate final @android.annotation.NonNull android.widget.inline.InlinePresentationSpec mInlinePresentationSpec\nprivate final boolean mPinned\npublic @android.annotation.NonNull @android.annotation.Size(min=0L) java.lang.String[] getAutofillHints()\nclass InlinePresentation extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genHiddenConstDefs=true, genEqualsHashCode=true)")
@Deprecated
private void __metadata() {}

View File

@@ -45,6 +45,9 @@ import android.view.ViewGroup;
* under the hosting window which could be useful in some cases, e.g. animating transitions.
* At this point the inlined content will not be interactive and the touch events would
* be delivered to your app.
*
* @hide
* @removed
*/
public class InlineContentView extends ViewGroup {

View File

@@ -16,4 +16,8 @@
package android.view.inline;
/**
* @hide
* @removed
*/
parcelable InlinePresentationSpec;

View File

@@ -29,6 +29,9 @@ import com.android.internal.util.DataClass;
* should abide when constructing its UI. Since suggestions are inlined in a
* host application while provided by another source, they need to be consistent
* with the host's look at feel to allow building smooth and integrated UIs.
*
* @hide
* @removed
*/
@DataClass(genEqualsHashCode = true, genToString = true, genBuilder = true)
public final class InlinePresentationSpec implements Parcelable {
@@ -279,7 +282,7 @@ public final class InlinePresentationSpec implements Parcelable {
}
@DataClass.Generated(
time = 1584067238741L,
time = 1585177087499L,
codegenVersion = "1.0.15",
sourceFile = "frameworks/base/core/java/android/view/inline/InlinePresentationSpec.java",
inputSignatures = "private final @android.annotation.NonNull android.util.Size mMinSize\nprivate final @android.annotation.NonNull android.util.Size mMaxSize\nprivate final @android.annotation.Nullable android.os.Bundle mStyle\nprivate static android.os.Bundle defaultStyle()\nclass InlinePresentationSpec extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genToString=true, genBuilder=true)\nclass BaseBuilder extends java.lang.Object implements []")

View File

@@ -29,8 +29,7 @@ import android.os.RemoteException;
import android.util.Size;
import android.util.Slog;
import android.view.SurfaceControlViewHost;
import android.view.inline.InlineContentView;
import android.view.inline.InlinePresentationSpec;
import android.widget.inline.InlineContentView;
import com.android.internal.util.DataClass;
import com.android.internal.util.Parcelling;
@@ -95,9 +94,10 @@ public final class InlineSuggestion implements Parcelable {
/**
* Inflates a view with the content of this suggestion at a specific size.
* The size must be between the {@link InlinePresentationSpec#getMinSize() min size}
* and the {@link InlinePresentationSpec#getMaxSize() max size} of the presentation
* spec returned by {@link InlineSuggestionInfo#getPresentationSpec()}.
* The size must be between the
* {@link android.widget.inline.InlinePresentationSpec#getMinSize() min size} and the
* {@link android.widget.inline.InlinePresentationSpec#getMaxSize() max size} of the
* presentation spec returned by {@link InlineSuggestionInfo#getInlinePresentationSpec()}.
*
* <p> The caller can attach an {@link android.view.View.OnClickListener} and/or an
* {@link android.view.View.OnLongClickListener} to the view in the
@@ -113,8 +113,8 @@ public final class InlineSuggestion implements Parcelable {
public void inflate(@NonNull Context context, @NonNull Size size,
@NonNull @CallbackExecutor Executor callbackExecutor,
@NonNull Consumer<InlineContentView> callback) {
final Size minSize = mInfo.getPresentationSpec().getMinSize();
final Size maxSize = mInfo.getPresentationSpec().getMaxSize();
final Size minSize = mInfo.getInlinePresentationSpec().getMinSize();
final Size maxSize = mInfo.getInlinePresentationSpec().getMaxSize();
if (size.getHeight() < minSize.getHeight() || size.getHeight() > maxSize.getHeight()
|| size.getWidth() < minSize.getWidth() || size.getWidth() > maxSize.getWidth()) {
throw new IllegalArgumentException("size not between min:"
@@ -398,10 +398,10 @@ public final class InlineSuggestion implements Parcelable {
};
@DataClass.Generated(
time = 1584679775946L,
time = 1585180783541L,
codegenVersion = "1.0.15",
sourceFile = "frameworks/base/core/java/android/view/inputmethod/InlineSuggestion.java",
inputSignatures = "private static final java.lang.String TAG\nprivate final @android.annotation.NonNull android.view.inputmethod.InlineSuggestionInfo mInfo\nprivate final @android.annotation.Nullable com.android.internal.view.inline.IInlineContentProvider mContentProvider\nprivate @com.android.internal.util.DataClass.ParcelWith(android.view.inputmethod.InlineSuggestion.InlineContentCallbackImplParceling.class) @android.annotation.Nullable android.view.inputmethod.InlineSuggestion.InlineContentCallbackImpl mInlineContentCallback\npublic static @android.annotation.TestApi @android.annotation.NonNull android.view.inputmethod.InlineSuggestion newInlineSuggestion(android.view.inputmethod.InlineSuggestionInfo)\npublic void inflate(android.content.Context,android.util.Size,java.util.concurrent.Executor,java.util.function.Consumer<android.view.inline.InlineContentView>)\nprivate synchronized android.view.inputmethod.InlineSuggestion.InlineContentCallbackImpl getInlineContentCallback(android.content.Context,java.util.concurrent.Executor,java.util.function.Consumer<android.view.inline.InlineContentView>)\nclass InlineSuggestion extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genToString=true, genHiddenConstDefs=true, genHiddenConstructor=true)")
inputSignatures = "private static final java.lang.String TAG\nprivate final @android.annotation.NonNull android.view.inputmethod.InlineSuggestionInfo mInfo\nprivate final @android.annotation.Nullable com.android.internal.view.inline.IInlineContentProvider mContentProvider\nprivate @com.android.internal.util.DataClass.ParcelWith(android.view.inputmethod.InlineSuggestion.InlineContentCallbackImplParceling.class) @android.annotation.Nullable android.view.inputmethod.InlineSuggestion.InlineContentCallbackImpl mInlineContentCallback\npublic static @android.annotation.TestApi @android.annotation.NonNull android.view.inputmethod.InlineSuggestion newInlineSuggestion(android.view.inputmethod.InlineSuggestionInfo)\npublic void inflate(android.content.Context,android.util.Size,java.util.concurrent.Executor,java.util.function.Consumer<android.widget.inline.InlineContentView>)\nprivate synchronized android.view.inputmethod.InlineSuggestion.InlineContentCallbackImpl getInlineContentCallback(android.content.Context,java.util.concurrent.Executor,java.util.function.Consumer<android.widget.inline.InlineContentView>)\nclass InlineSuggestion extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genToString=true, genHiddenConstDefs=true, genHiddenConstructor=true)")
@Deprecated
private void __metadata() {}

View File

@@ -20,8 +20,9 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.TestApi;
import android.os.Bundle;
import android.os.Parcelable;
import android.view.inline.InlinePresentationSpec;
import android.widget.inline.InlinePresentationSpec;
import com.android.internal.util.DataClass;
@@ -58,7 +59,7 @@ public final class InlineSuggestionInfo implements Parcelable {
public static final @Type String TYPE_ACTION = "android:autofill:action";
/** The presentation spec to which the inflated suggestion view abides. */
private final @NonNull InlinePresentationSpec mPresentationSpec;
private final @NonNull InlinePresentationSpec mInlinePresentationSpec;
/** The source from which the suggestion is provided. */
private final @NonNull @Source String mSource;
@@ -86,9 +87,26 @@ public final class InlineSuggestionInfo implements Parcelable {
return new InlineSuggestionInfo(presentationSpec, source, autofillHints, type, isPinned);
}
/**
* The presentation spec to which the inflated suggestion view abides.
*
* @hide
* @removed
*/
public @NonNull android.view.inline.InlinePresentationSpec getPresentationSpec() {
final android.view.inline.InlinePresentationSpec.Builder builder =
new android.view.inline.InlinePresentationSpec.Builder(
mInlinePresentationSpec.getMinSize(), mInlinePresentationSpec.getMaxSize());
final Bundle style = mInlinePresentationSpec.getStyle();
if (style != null) {
builder.setStyle(style);
}
return builder.build();
}
// Code below generated by codegen v1.0.14.
// Code below generated by codegen v1.0.15.
//
// DO NOT MODIFY!
// CHECKSTYLE:OFF Generated code
@@ -122,7 +140,7 @@ public final class InlineSuggestionInfo implements Parcelable {
/**
* Creates a new InlineSuggestionInfo.
*
* @param presentationSpec
* @param inlinePresentationSpec
* The presentation spec to which the inflated suggestion view abides.
* @param source
* The source from which the suggestion is provided.
@@ -136,14 +154,14 @@ public final class InlineSuggestionInfo implements Parcelable {
*/
@DataClass.Generated.Member
public InlineSuggestionInfo(
@NonNull InlinePresentationSpec presentationSpec,
@NonNull InlinePresentationSpec inlinePresentationSpec,
@NonNull @Source String source,
@Nullable String[] autofillHints,
@NonNull @Type String type,
boolean pinned) {
this.mPresentationSpec = presentationSpec;
this.mInlinePresentationSpec = inlinePresentationSpec;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mPresentationSpec);
NonNull.class, null, mInlinePresentationSpec);
this.mSource = source;
if (!(java.util.Objects.equals(mSource, SOURCE_AUTOFILL))
@@ -178,8 +196,8 @@ public final class InlineSuggestionInfo implements Parcelable {
* The presentation spec to which the inflated suggestion view abides.
*/
@DataClass.Generated.Member
public @NonNull InlinePresentationSpec getPresentationSpec() {
return mPresentationSpec;
public @NonNull InlinePresentationSpec getInlinePresentationSpec() {
return mInlinePresentationSpec;
}
/**
@@ -221,7 +239,7 @@ public final class InlineSuggestionInfo implements Parcelable {
// String fieldNameToString() { ... }
return "InlineSuggestionInfo { " +
"presentationSpec = " + mPresentationSpec + ", " +
"inlinePresentationSpec = " + mInlinePresentationSpec + ", " +
"source = " + mSource + ", " +
"autofillHints = " + java.util.Arrays.toString(mAutofillHints) + ", " +
"type = " + mType + ", " +
@@ -242,7 +260,7 @@ public final class InlineSuggestionInfo implements Parcelable {
InlineSuggestionInfo that = (InlineSuggestionInfo) o;
//noinspection PointlessBooleanExpression
return true
&& java.util.Objects.equals(mPresentationSpec, that.mPresentationSpec)
&& java.util.Objects.equals(mInlinePresentationSpec, that.mInlinePresentationSpec)
&& java.util.Objects.equals(mSource, that.mSource)
&& java.util.Arrays.equals(mAutofillHints, that.mAutofillHints)
&& java.util.Objects.equals(mType, that.mType)
@@ -256,7 +274,7 @@ public final class InlineSuggestionInfo implements Parcelable {
// int fieldNameHashCode() { ... }
int _hash = 1;
_hash = 31 * _hash + java.util.Objects.hashCode(mPresentationSpec);
_hash = 31 * _hash + java.util.Objects.hashCode(mInlinePresentationSpec);
_hash = 31 * _hash + java.util.Objects.hashCode(mSource);
_hash = 31 * _hash + java.util.Arrays.hashCode(mAutofillHints);
_hash = 31 * _hash + java.util.Objects.hashCode(mType);
@@ -274,7 +292,7 @@ public final class InlineSuggestionInfo implements Parcelable {
if (mPinned) flg |= 0x10;
if (mAutofillHints != null) flg |= 0x4;
dest.writeByte(flg);
dest.writeTypedObject(mPresentationSpec, flags);
dest.writeTypedObject(mInlinePresentationSpec, flags);
dest.writeString(mSource);
if (mAutofillHints != null) dest.writeStringArray(mAutofillHints);
dest.writeString(mType);
@@ -293,14 +311,14 @@ public final class InlineSuggestionInfo implements Parcelable {
byte flg = in.readByte();
boolean pinned = (flg & 0x10) != 0;
InlinePresentationSpec presentationSpec = (InlinePresentationSpec) in.readTypedObject(InlinePresentationSpec.CREATOR);
InlinePresentationSpec inlinePresentationSpec = (InlinePresentationSpec) in.readTypedObject(InlinePresentationSpec.CREATOR);
String source = in.readString();
String[] autofillHints = (flg & 0x4) == 0 ? null : in.createStringArray();
String type = in.readString();
this.mPresentationSpec = presentationSpec;
this.mInlinePresentationSpec = inlinePresentationSpec;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mPresentationSpec);
NonNull.class, null, mInlinePresentationSpec);
this.mSource = source;
if (!(java.util.Objects.equals(mSource, SOURCE_AUTOFILL))
@@ -346,10 +364,10 @@ public final class InlineSuggestionInfo implements Parcelable {
};
@DataClass.Generated(
time = 1582753084046L,
codegenVersion = "1.0.14",
time = 1585528157244L,
codegenVersion = "1.0.15",
sourceFile = "frameworks/base/core/java/android/view/inputmethod/InlineSuggestionInfo.java",
inputSignatures = "public static final @android.view.inputmethod.InlineSuggestionInfo.Source java.lang.String SOURCE_AUTOFILL\npublic static final @android.view.inputmethod.InlineSuggestionInfo.Source java.lang.String SOURCE_PLATFORM\npublic static final @android.view.inputmethod.InlineSuggestionInfo.Type java.lang.String TYPE_SUGGESTION\npublic static final @android.annotation.SuppressLint({\"IntentName\"}) @android.view.inputmethod.InlineSuggestionInfo.Type java.lang.String TYPE_ACTION\nprivate final @android.annotation.NonNull android.view.inline.InlinePresentationSpec mPresentationSpec\nprivate final @android.annotation.NonNull @android.view.inputmethod.InlineSuggestionInfo.Source java.lang.String mSource\nprivate final @android.annotation.Nullable java.lang.String[] mAutofillHints\nprivate final @android.annotation.NonNull @android.view.inputmethod.InlineSuggestionInfo.Type java.lang.String mType\nprivate final boolean mPinned\npublic static @android.annotation.TestApi @android.annotation.NonNull android.view.inputmethod.InlineSuggestionInfo newInlineSuggestionInfo(android.view.inline.InlinePresentationSpec,java.lang.String,java.lang.String[],java.lang.String,boolean)\nclass InlineSuggestionInfo extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genToString=true, genHiddenConstDefs=true, genHiddenConstructor=true)")
inputSignatures = "public static final @android.view.inputmethod.InlineSuggestionInfo.Source java.lang.String SOURCE_AUTOFILL\npublic static final @android.view.inputmethod.InlineSuggestionInfo.Source java.lang.String SOURCE_PLATFORM\npublic static final @android.view.inputmethod.InlineSuggestionInfo.Type java.lang.String TYPE_SUGGESTION\npublic static final @android.annotation.SuppressLint({\"IntentName\"}) @android.view.inputmethod.InlineSuggestionInfo.Type java.lang.String TYPE_ACTION\nprivate final @android.annotation.NonNull android.widget.inline.InlinePresentationSpec mInlinePresentationSpec\nprivate final @android.annotation.NonNull @android.view.inputmethod.InlineSuggestionInfo.Source java.lang.String mSource\nprivate final @android.annotation.Nullable java.lang.String[] mAutofillHints\nprivate final @android.annotation.NonNull @android.view.inputmethod.InlineSuggestionInfo.Type java.lang.String mType\nprivate final boolean mPinned\npublic static @android.annotation.TestApi @android.annotation.NonNull android.view.inputmethod.InlineSuggestionInfo newInlineSuggestionInfo(android.widget.inline.InlinePresentationSpec,java.lang.String,java.lang.String[],java.lang.String,boolean)\npublic @android.annotation.NonNull android.view.inline.InlinePresentationSpec getPresentationSpec()\nclass InlineSuggestionInfo extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genToString=true, genHiddenConstDefs=true, genHiddenConstructor=true)")
@Deprecated
private void __metadata() {}

View File

@@ -25,7 +25,7 @@ import android.os.LocaleList;
import android.os.Parcel;
import android.os.Parcelable;
import android.view.Display;
import android.view.inline.InlinePresentationSpec;
import android.widget.inline.InlinePresentationSpec;
import com.android.internal.util.DataClass;
import com.android.internal.util.Preconditions;
@@ -54,7 +54,7 @@ public final class InlineSuggestionsRequest implements Parcelable {
* count is larger than the number of specs in the list, then the last spec is used for the
* remainder of the suggestions. The list should not be empty.
*/
private final @NonNull List<InlinePresentationSpec> mPresentationSpecs;
private final @NonNull List<InlinePresentationSpec> mInlinePresentationSpecs;
/**
* The package name of the app that requests for the inline suggestions and will host the
@@ -90,6 +90,32 @@ public final class InlineSuggestionsRequest implements Parcelable {
*/
private int mHostDisplayId;
/**
* The {@link InlinePresentationSpec} for each suggestion in the response. If the max suggestion
* count is larger than the number of specs in the list, then the last spec is used for the
* remainder of the suggestions. The list should not be empty.
*
* @hide
* @removed
*/
public @NonNull List<android.view.inline.InlinePresentationSpec> getPresentationSpecs() {
final ArrayList<android.view.inline.InlinePresentationSpec> convertedSpecs =
new ArrayList<>();
for (int i = 0; i < mInlinePresentationSpecs.size(); i++) {
final android.widget.inline.InlinePresentationSpec currSpec =
mInlinePresentationSpecs.get(i);
final android.view.inline.InlinePresentationSpec.Builder builder =
new android.view.inline.InlinePresentationSpec.Builder(
currSpec.getMinSize(), currSpec.getMaxSize());
final Bundle style = currSpec.getStyle();
if (style != null) {
builder.setStyle(style);
}
convertedSpecs.add(builder.build());
}
return convertedSpecs;
}
/**
* @hide
* @see {@link #mHostInputToken}.
@@ -117,8 +143,8 @@ public final class InlineSuggestionsRequest implements Parcelable {
}
private void onConstructed() {
Preconditions.checkState(!mPresentationSpecs.isEmpty());
Preconditions.checkState(mMaxSuggestionCount >= mPresentationSpecs.size());
Preconditions.checkState(!mInlinePresentationSpecs.isEmpty());
Preconditions.checkState(mMaxSuggestionCount >= mInlinePresentationSpecs.size());
}
private static int defaultMaxSuggestionCount() {
@@ -148,11 +174,64 @@ public final class InlineSuggestionsRequest implements Parcelable {
return null;
}
/** @hide */
abstract static class BaseBuilder {
abstract Builder setPresentationSpecs(@NonNull List<InlinePresentationSpec> value);
/**
* The {@link android.view.inline.InlinePresentationSpec} for each suggestion in the
* response. If the max suggestion count is larger than the number of specs in the list,
* then the last spec is used for the remainder of the suggestions.
* The list should not be empty.
*
* @hide
* @removed
*/
@NonNull Builder setPresentationSpecs(
@NonNull List<android.view.inline.InlinePresentationSpec> specs) {
((Builder) this).checkNotUsed();
((Builder) this).mBuilderFieldsSet |= 0x2;
final ArrayList<android.widget.inline.InlinePresentationSpec> convertedSpecs =
new ArrayList<>();
for (int i = 0; i < specs.size(); i++) {
final android.view.inline.InlinePresentationSpec currSpec = specs.get(i);
final android.widget.inline.InlinePresentationSpec.Builder builder =
new android.widget.inline.InlinePresentationSpec.Builder(
currSpec.getMinSize(), currSpec.getMaxSize());
final Bundle style = currSpec.getStyle();
if (style != null) {
builder.setStyle(style);
}
convertedSpecs.add(builder.build());
}
((Builder) this).mInlinePresentationSpecs = convertedSpecs;
return ((Builder) this);
}
/**
* @see #setPresentationSpecs
*
* @hide
* @removed
*/
public @NonNull Builder addPresentationSpecs(
@NonNull android.view.inline.InlinePresentationSpec value) {
if (((Builder) this).mInlinePresentationSpecs == null) {
setPresentationSpecs(new ArrayList<>());
}
final android.widget.inline.InlinePresentationSpec.Builder builder =
new android.widget.inline.InlinePresentationSpec.Builder(
value.getMinSize(), value.getMaxSize());
final Bundle style = value.getStyle();
if (style != null) {
builder.setStyle(style);
}
((Builder) this).mInlinePresentationSpecs.add(builder.build());
return ((Builder) this);
}
abstract Builder setInlinePresentationSpecs(
@NonNull List<android.widget.inline.InlinePresentationSpec> specs);
abstract Builder setHostPackageName(@Nullable String value);
@@ -179,16 +258,16 @@ public final class InlineSuggestionsRequest implements Parcelable {
@DataClass.Generated.Member
/* package-private */ InlineSuggestionsRequest(
int maxSuggestionCount,
@NonNull List<InlinePresentationSpec> presentationSpecs,
@NonNull List<InlinePresentationSpec> inlinePresentationSpecs,
@NonNull String hostPackageName,
@NonNull LocaleList supportedLocales,
@Nullable Bundle extras,
@Nullable IBinder hostInputToken,
int hostDisplayId) {
this.mMaxSuggestionCount = maxSuggestionCount;
this.mPresentationSpecs = presentationSpecs;
this.mInlinePresentationSpecs = inlinePresentationSpecs;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mPresentationSpecs);
NonNull.class, null, mInlinePresentationSpecs);
this.mHostPackageName = hostPackageName;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mHostPackageName);
@@ -217,8 +296,8 @@ public final class InlineSuggestionsRequest implements Parcelable {
* remainder of the suggestions. The list should not be empty.
*/
@DataClass.Generated.Member
public @NonNull List<InlinePresentationSpec> getPresentationSpecs() {
return mPresentationSpecs;
public @NonNull List<InlinePresentationSpec> getInlinePresentationSpecs() {
return mInlinePresentationSpecs;
}
/**
@@ -278,7 +357,7 @@ public final class InlineSuggestionsRequest implements Parcelable {
return "InlineSuggestionsRequest { " +
"maxSuggestionCount = " + mMaxSuggestionCount + ", " +
"presentationSpecs = " + mPresentationSpecs + ", " +
"inlinePresentationSpecs = " + mInlinePresentationSpecs + ", " +
"hostPackageName = " + mHostPackageName + ", " +
"supportedLocales = " + mSupportedLocales + ", " +
"extras = " + mExtras + ", " +
@@ -301,7 +380,7 @@ public final class InlineSuggestionsRequest implements Parcelable {
//noinspection PointlessBooleanExpression
return true
&& mMaxSuggestionCount == that.mMaxSuggestionCount
&& java.util.Objects.equals(mPresentationSpecs, that.mPresentationSpecs)
&& java.util.Objects.equals(mInlinePresentationSpecs, that.mInlinePresentationSpecs)
&& java.util.Objects.equals(mHostPackageName, that.mHostPackageName)
&& java.util.Objects.equals(mSupportedLocales, that.mSupportedLocales)
&& java.util.Objects.equals(mExtras, that.mExtras)
@@ -317,7 +396,7 @@ public final class InlineSuggestionsRequest implements Parcelable {
int _hash = 1;
_hash = 31 * _hash + mMaxSuggestionCount;
_hash = 31 * _hash + java.util.Objects.hashCode(mPresentationSpecs);
_hash = 31 * _hash + java.util.Objects.hashCode(mInlinePresentationSpecs);
_hash = 31 * _hash + java.util.Objects.hashCode(mHostPackageName);
_hash = 31 * _hash + java.util.Objects.hashCode(mSupportedLocales);
_hash = 31 * _hash + java.util.Objects.hashCode(mExtras);
@@ -337,7 +416,7 @@ public final class InlineSuggestionsRequest implements Parcelable {
if (mHostInputToken != null) flg |= 0x20;
dest.writeByte(flg);
dest.writeInt(mMaxSuggestionCount);
dest.writeParcelableList(mPresentationSpecs, flags);
dest.writeParcelableList(mInlinePresentationSpecs, flags);
dest.writeString(mHostPackageName);
dest.writeTypedObject(mSupportedLocales, flags);
if (mExtras != null) dest.writeBundle(mExtras);
@@ -358,8 +437,8 @@ public final class InlineSuggestionsRequest implements Parcelable {
byte flg = in.readByte();
int maxSuggestionCount = in.readInt();
List<InlinePresentationSpec> presentationSpecs = new ArrayList<>();
in.readParcelableList(presentationSpecs, InlinePresentationSpec.class.getClassLoader());
List<InlinePresentationSpec> inlinePresentationSpecs = new ArrayList<>();
in.readParcelableList(inlinePresentationSpecs, InlinePresentationSpec.class.getClassLoader());
String hostPackageName = in.readString();
LocaleList supportedLocales = (LocaleList) in.readTypedObject(LocaleList.CREATOR);
Bundle extras = (flg & 0x10) == 0 ? null : in.readBundle();
@@ -367,9 +446,9 @@ public final class InlineSuggestionsRequest implements Parcelable {
int hostDisplayId = in.readInt();
this.mMaxSuggestionCount = maxSuggestionCount;
this.mPresentationSpecs = presentationSpecs;
this.mInlinePresentationSpecs = inlinePresentationSpecs;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mPresentationSpecs);
NonNull.class, null, mInlinePresentationSpecs);
this.mHostPackageName = hostPackageName;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mHostPackageName);
@@ -405,7 +484,7 @@ public final class InlineSuggestionsRequest implements Parcelable {
public static final class Builder extends BaseBuilder {
private int mMaxSuggestionCount;
private @NonNull List<InlinePresentationSpec> mPresentationSpecs;
private @NonNull List<InlinePresentationSpec> mInlinePresentationSpecs;
private @NonNull String mHostPackageName;
private @NonNull LocaleList mSupportedLocales;
private @Nullable Bundle mExtras;
@@ -417,16 +496,16 @@ public final class InlineSuggestionsRequest implements Parcelable {
/**
* Creates a new Builder.
*
* @param presentationSpecs
* @param inlinePresentationSpecs
* The {@link InlinePresentationSpec} for each suggestion in the response. If the max suggestion
* count is larger than the number of specs in the list, then the last spec is used for the
* remainder of the suggestions. The list should not be empty.
*/
public Builder(
@NonNull List<InlinePresentationSpec> presentationSpecs) {
mPresentationSpecs = presentationSpecs;
@NonNull List<InlinePresentationSpec> inlinePresentationSpecs) {
mInlinePresentationSpecs = inlinePresentationSpecs;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mPresentationSpecs);
NonNull.class, null, mInlinePresentationSpecs);
}
/**
@@ -447,22 +526,21 @@ public final class InlineSuggestionsRequest implements Parcelable {
* remainder of the suggestions. The list should not be empty.
*/
@DataClass.Generated.Member
@Override
@NonNull Builder setPresentationSpecs(@NonNull List<InlinePresentationSpec> value) {
public @NonNull Builder setInlinePresentationSpecs(@NonNull List<InlinePresentationSpec> value) {
checkNotUsed();
mBuilderFieldsSet |= 0x2;
mPresentationSpecs = value;
mInlinePresentationSpecs = value;
return this;
}
/** @see #setPresentationSpecs */
/** @see #setInlinePresentationSpecs */
@DataClass.Generated.Member
public @NonNull Builder addPresentationSpecs(@NonNull InlinePresentationSpec value) {
public @NonNull Builder addInlinePresentationSpecs(@NonNull InlinePresentationSpec value) {
// You can refine this method's name by providing item's singular name, e.g.:
// @DataClass.PluralOf("item")) mItems = ...
if (mPresentationSpecs == null) setPresentationSpecs(new ArrayList<>());
mPresentationSpecs.add(value);
if (mInlinePresentationSpecs == null) setInlinePresentationSpecs(new ArrayList<>());
mInlinePresentationSpecs.add(value);
return this;
}
@@ -558,7 +636,7 @@ public final class InlineSuggestionsRequest implements Parcelable {
}
InlineSuggestionsRequest o = new InlineSuggestionsRequest(
mMaxSuggestionCount,
mPresentationSpecs,
mInlinePresentationSpecs,
mHostPackageName,
mSupportedLocales,
mExtras,
@@ -576,10 +654,10 @@ public final class InlineSuggestionsRequest implements Parcelable {
}
@DataClass.Generated(
time = 1584067152935L,
time = 1585528160885L,
codegenVersion = "1.0.15",
sourceFile = "frameworks/base/core/java/android/view/inputmethod/InlineSuggestionsRequest.java",
inputSignatures = "public static final int SUGGESTION_COUNT_UNLIMITED\nprivate final int mMaxSuggestionCount\nprivate final @android.annotation.NonNull java.util.List<android.view.inline.InlinePresentationSpec> mPresentationSpecs\nprivate @android.annotation.NonNull java.lang.String mHostPackageName\nprivate @android.annotation.NonNull android.os.LocaleList mSupportedLocales\nprivate @android.annotation.Nullable android.os.Bundle mExtras\nprivate @android.annotation.Nullable android.os.IBinder mHostInputToken\nprivate int mHostDisplayId\npublic void setHostInputToken(android.os.IBinder)\nprivate void parcelHostInputToken(android.os.Parcel,int)\nprivate @android.annotation.Nullable android.os.IBinder unparcelHostInputToken(android.os.Parcel)\npublic void setHostDisplayId(int)\nprivate void onConstructed()\nprivate static int defaultMaxSuggestionCount()\nprivate static java.lang.String defaultHostPackageName()\nprivate static android.os.LocaleList defaultSupportedLocales()\nprivate static @android.annotation.Nullable android.os.IBinder defaultHostInputToken()\nprivate static @android.annotation.Nullable int defaultHostDisplayId()\nprivate static @android.annotation.Nullable android.os.Bundle defaultExtras()\nclass InlineSuggestionsRequest extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genToString=true, genBuilder=true)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setPresentationSpecs(java.util.List<android.view.inline.InlinePresentationSpec>)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setHostPackageName(java.lang.String)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setHostInputToken(android.os.IBinder)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setHostDisplayId(int)\nclass BaseBuilder extends java.lang.Object implements []")
inputSignatures = "public static final int SUGGESTION_COUNT_UNLIMITED\nprivate final int mMaxSuggestionCount\nprivate final @android.annotation.NonNull java.util.List<android.widget.inline.InlinePresentationSpec> mInlinePresentationSpecs\nprivate @android.annotation.NonNull java.lang.String mHostPackageName\nprivate @android.annotation.NonNull android.os.LocaleList mSupportedLocales\nprivate @android.annotation.Nullable android.os.Bundle mExtras\nprivate @android.annotation.Nullable android.os.IBinder mHostInputToken\nprivate int mHostDisplayId\npublic @android.annotation.NonNull java.util.List<android.view.inline.InlinePresentationSpec> getPresentationSpecs()\npublic void setHostInputToken(android.os.IBinder)\nprivate void parcelHostInputToken(android.os.Parcel,int)\nprivate @android.annotation.Nullable android.os.IBinder unparcelHostInputToken(android.os.Parcel)\npublic void setHostDisplayId(int)\nprivate void onConstructed()\nprivate static int defaultMaxSuggestionCount()\nprivate static java.lang.String defaultHostPackageName()\nprivate static android.os.LocaleList defaultSupportedLocales()\nprivate static @android.annotation.Nullable android.os.IBinder defaultHostInputToken()\nprivate static @android.annotation.Nullable int defaultHostDisplayId()\nprivate static @android.annotation.Nullable android.os.Bundle defaultExtras()\nclass InlineSuggestionsRequest extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genToString=true, genBuilder=true)\n @android.annotation.NonNull android.view.inputmethod.InlineSuggestionsRequest.Builder setPresentationSpecs(java.util.List<android.view.inline.InlinePresentationSpec>)\npublic @android.annotation.NonNull android.view.inputmethod.InlineSuggestionsRequest.Builder addPresentationSpecs(android.view.inline.InlinePresentationSpec)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setInlinePresentationSpecs(java.util.List<android.widget.inline.InlinePresentationSpec>)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setHostPackageName(java.lang.String)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setHostInputToken(android.os.IBinder)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setHostDisplayId(int)\nclass BaseBuilder extends java.lang.Object implements []")
@Deprecated
private void __metadata() {}

View File

@@ -0,0 +1,205 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.widget.inline;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.graphics.PixelFormat;
import android.util.AttributeSet;
import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.ViewGroup;
/**
* This class represents a view that holds opaque content from another app that
* you can inline in your UI.
*
* <p>Since the content presented by this view is from another security domain,it is
* shown on a remote surface preventing the host application from accessing that content.
* Also the host application cannot interact with the inlined content by injecting touch
* events or clicking programmatically.
*
* <p>This view can be overlaid by other windows, i.e. redressed, but if this is the case
* the inined UI would not be interactive. Sometimes this is desirable, e.g. animating
* transitions.
*
* <p>By default the surface backing this view is shown on top of the hosting window such
* that the inlined content is interactive. However, you can temporarily move the surface
* under the hosting window which could be useful in some cases, e.g. animating transitions.
* At this point the inlined content will not be interactive and the touch events would
* be delivered to your app.
*/
public class InlineContentView extends ViewGroup {
/**
* Callback for observing the lifecycle of the surface control
* that manipulates the backing secure embedded UI surface.
*/
public interface SurfaceControlCallback {
/**
* Called when the backing surface is being created.
*
* @param surfaceControl The surface control to manipulate the surface.
*/
void onCreated(@NonNull SurfaceControl surfaceControl);
/**
* Called when the backing surface is being destroyed.
*
* @param surfaceControl The surface control to manipulate the surface.
*/
void onDestroyed(@NonNull SurfaceControl surfaceControl);
}
private final @NonNull SurfaceHolder.Callback mSurfaceCallback = new SurfaceHolder.Callback() {
@Override
public void surfaceCreated(@NonNull SurfaceHolder holder) {
mSurfaceControlCallback.onCreated(mSurfaceView.getSurfaceControl());
}
@Override
public void surfaceChanged(@NonNull SurfaceHolder holder,
int format, int width, int height) {
/* do nothing */
}
@Override
public void surfaceDestroyed(@NonNull SurfaceHolder holder) {
mSurfaceControlCallback.onDestroyed(mSurfaceView.getSurfaceControl());
}
};
private final @NonNull SurfaceView mSurfaceView;
private @Nullable SurfaceControlCallback mSurfaceControlCallback;
/**
* @inheritDoc
*
* @hide
*/
public InlineContentView(@NonNull Context context) {
this(context, null);
}
/**
* @inheritDoc
*
* @hide
*/
public InlineContentView(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
/**
* @inheritDoc
*
* @hide
*/
public InlineContentView(@NonNull Context context, @Nullable AttributeSet attrs,
int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
/**
* Gets the surface control. If the surface is not created this method
* returns {@code null}.
*
* @return The surface control.
*
* @see #setSurfaceControlCallback(SurfaceControlCallback)
*/
public @Nullable SurfaceControl getSurfaceControl() {
return mSurfaceView.getSurfaceControl();
}
/**
* @inheritDoc
*
* @hide
*/
public InlineContentView(@NonNull Context context, @Nullable AttributeSet attrs,
int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
mSurfaceView = new SurfaceView(context, attrs, defStyleAttr, defStyleRes);
mSurfaceView.setZOrderOnTop(true);
mSurfaceView.getHolder().setFormat(PixelFormat.TRANSPARENT);
addView(mSurfaceView);
}
/**
* Sets the embedded UI.
* @param surfacePackage The embedded UI.
*
* @hide
*/
public void setChildSurfacePackage(
@Nullable SurfaceControlViewHost.SurfacePackage surfacePackage) {
mSurfaceView.setChildSurfacePackage(surfacePackage);
}
@Override
public void onLayout(boolean changed, int l, int t, int r, int b) {
mSurfaceView.layout(l, t, r, b);
}
/**
* Sets a callback to observe the lifecycle of the surface control for
* managing the backing surface.
*
* @param callback The callback to set or {@code null} to clear.
*/
public void setSurfaceControlCallback(@Nullable SurfaceControlCallback callback) {
if (mSurfaceControlCallback != null) {
mSurfaceView.getHolder().removeCallback(mSurfaceCallback);
}
mSurfaceControlCallback = callback;
if (mSurfaceControlCallback != null) {
mSurfaceView.getHolder().addCallback(mSurfaceCallback);
}
}
/**
* @return Whether the surface backing this view appears on top of its parent.
*
* @see #setZOrderedOnTop(boolean)
*/
public boolean isZOrderedOnTop() {
return mSurfaceView.isZOrderedOnTop();
}
/**
* Controls whether the backing surface is placed on top of this view's window.
* Normally, it is placed on top of the window, to allow interaction
* with the inlined UI. Via this method, you can place the surface below the
* window. This means that all of the contents of the window this view is in
* will be visible on top of its surface.
*
* <p> The Z ordering can be changed dynamically if the backing surface is
* created, otherwise the ordering would be applied at surface construction time.
*
* @param onTop Whether to show the surface on top of this view's window.
*
* @see #isZOrderedOnTop()
*/
public boolean setZOrderedOnTop(boolean onTop) {
return mSurfaceView.setZOrderedOnTop(onTop, /*allowDynamicChange*/ true);
}
}

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.widget.inline;
parcelable InlinePresentationSpec;

View File

@@ -0,0 +1,293 @@
/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.widget.inline;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.Size;
import com.android.internal.util.DataClass;
/**
* This class represents the presentation specification by which an inline suggestion
* should abide when constructing its UI. Since suggestions are inlined in a
* host application while provided by another source, they need to be consistent
* with the host's look at feel to allow building smooth and integrated UIs.
*/
@DataClass(genEqualsHashCode = true, genToString = true, genBuilder = true)
public final class InlinePresentationSpec implements Parcelable {
/** The minimal size of the suggestion. */
@NonNull
private final Size mMinSize;
/** The maximal size of the suggestion. */
@NonNull
private final Size mMaxSize;
/**
* The extras encoding the UI style information. Defaults to {@code null} in which case the
* default system UI style will be used.
*/
@Nullable
private final Bundle mStyle;
private static Bundle defaultStyle() {
return null;
}
/** @hide */
@DataClass.Suppress({"setMaxSize", "setMinSize"})
abstract static class BaseBuilder {
}
// Code below generated by codegen v1.0.15.
//
// DO NOT MODIFY!
// CHECKSTYLE:OFF Generated code
//
// To regenerate run:
// $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/widget/inline/InlinePresentationSpec.java
//
// To exclude the generated code from IntelliJ auto-formatting enable (one-time):
// Settings > Editor > Code Style > Formatter Control
//@formatter:off
@DataClass.Generated.Member
/* package-private */ InlinePresentationSpec(
@NonNull Size minSize,
@NonNull Size maxSize,
@Nullable Bundle style) {
this.mMinSize = minSize;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mMinSize);
this.mMaxSize = maxSize;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mMaxSize);
this.mStyle = style;
// onConstructed(); // You can define this method to get a callback
}
/**
* The minimal size of the suggestion.
*/
@DataClass.Generated.Member
public @NonNull Size getMinSize() {
return mMinSize;
}
/**
* The maximal size of the suggestion.
*/
@DataClass.Generated.Member
public @NonNull Size getMaxSize() {
return mMaxSize;
}
/**
* The extras encoding the UI style information. Defaults to {@code null} in which case the
* default system UI style will be used.
*/
@DataClass.Generated.Member
public @Nullable Bundle getStyle() {
return mStyle;
}
@Override
@DataClass.Generated.Member
public String toString() {
// You can override field toString logic by defining methods like:
// String fieldNameToString() { ... }
return "InlinePresentationSpec { " +
"minSize = " + mMinSize + ", " +
"maxSize = " + mMaxSize + ", " +
"style = " + mStyle +
" }";
}
@Override
@DataClass.Generated.Member
public boolean equals(@Nullable Object o) {
// You can override field equality logic by defining either of the methods like:
// boolean fieldNameEquals(InlinePresentationSpec other) { ... }
// boolean fieldNameEquals(FieldType otherValue) { ... }
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
@SuppressWarnings("unchecked")
InlinePresentationSpec that = (InlinePresentationSpec) o;
//noinspection PointlessBooleanExpression
return true
&& java.util.Objects.equals(mMinSize, that.mMinSize)
&& java.util.Objects.equals(mMaxSize, that.mMaxSize)
&& java.util.Objects.equals(mStyle, that.mStyle);
}
@Override
@DataClass.Generated.Member
public int hashCode() {
// You can override field hashCode logic by defining methods like:
// int fieldNameHashCode() { ... }
int _hash = 1;
_hash = 31 * _hash + java.util.Objects.hashCode(mMinSize);
_hash = 31 * _hash + java.util.Objects.hashCode(mMaxSize);
_hash = 31 * _hash + java.util.Objects.hashCode(mStyle);
return _hash;
}
@Override
@DataClass.Generated.Member
public void writeToParcel(@NonNull android.os.Parcel dest, int flags) {
// You can override field parcelling by defining methods like:
// void parcelFieldName(Parcel dest, int flags) { ... }
byte flg = 0;
if (mStyle != null) flg |= 0x4;
dest.writeByte(flg);
dest.writeSize(mMinSize);
dest.writeSize(mMaxSize);
if (mStyle != null) dest.writeBundle(mStyle);
}
@Override
@DataClass.Generated.Member
public int describeContents() { return 0; }
/** @hide */
@SuppressWarnings({"unchecked", "RedundantCast"})
@DataClass.Generated.Member
/* package-private */ InlinePresentationSpec(@NonNull android.os.Parcel in) {
// You can override field unparcelling by defining methods like:
// static FieldType unparcelFieldName(Parcel in) { ... }
byte flg = in.readByte();
Size minSize = (Size) in.readSize();
Size maxSize = (Size) in.readSize();
Bundle style = (flg & 0x4) == 0 ? null : in.readBundle();
this.mMinSize = minSize;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mMinSize);
this.mMaxSize = maxSize;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mMaxSize);
this.mStyle = style;
// onConstructed(); // You can define this method to get a callback
}
@DataClass.Generated.Member
public static final @NonNull Parcelable.Creator<InlinePresentationSpec> CREATOR
= new Parcelable.Creator<InlinePresentationSpec>() {
@Override
public InlinePresentationSpec[] newArray(int size) {
return new InlinePresentationSpec[size];
}
@Override
public InlinePresentationSpec createFromParcel(@NonNull android.os.Parcel in) {
return new InlinePresentationSpec(in);
}
};
/**
* A builder for {@link InlinePresentationSpec}
*/
@SuppressWarnings("WeakerAccess")
@DataClass.Generated.Member
public static final class Builder extends BaseBuilder {
private @NonNull Size mMinSize;
private @NonNull Size mMaxSize;
private @Nullable Bundle mStyle;
private long mBuilderFieldsSet = 0L;
/**
* Creates a new Builder.
*
* @param minSize
* The minimal size of the suggestion.
* @param maxSize
* The maximal size of the suggestion.
*/
public Builder(
@NonNull Size minSize,
@NonNull Size maxSize) {
mMinSize = minSize;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mMinSize);
mMaxSize = maxSize;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mMaxSize);
}
/**
* The extras encoding the UI style information. Defaults to {@code null} in which case the
* default system UI style will be used.
*/
@DataClass.Generated.Member
public @NonNull Builder setStyle(@NonNull Bundle value) {
checkNotUsed();
mBuilderFieldsSet |= 0x4;
mStyle = value;
return this;
}
/** Builds the instance. This builder should not be touched after calling this! */
public @NonNull InlinePresentationSpec build() {
checkNotUsed();
mBuilderFieldsSet |= 0x8; // Mark builder used
if ((mBuilderFieldsSet & 0x4) == 0) {
mStyle = defaultStyle();
}
InlinePresentationSpec o = new InlinePresentationSpec(
mMinSize,
mMaxSize,
mStyle);
return o;
}
private void checkNotUsed() {
if ((mBuilderFieldsSet & 0x8) != 0) {
throw new IllegalStateException(
"This Builder should not be reused. Use a new Builder instance instead");
}
}
}
@DataClass.Generated(
time = 1585174247896L,
codegenVersion = "1.0.15",
sourceFile = "frameworks/base/core/java/android/widget/inline/InlinePresentationSpec.java",
inputSignatures = "private final @android.annotation.NonNull android.util.Size mMinSize\nprivate final @android.annotation.NonNull android.util.Size mMaxSize\nprivate final @android.annotation.Nullable android.os.Bundle mStyle\nprivate static android.os.Bundle defaultStyle()\nclass InlinePresentationSpec extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genToString=true, genBuilder=true)\nclass BaseBuilder extends java.lang.Object implements []")
@Deprecated
private void __metadata() {}
//@formatter:on
// End of generated code
}

View File

@@ -35,11 +35,11 @@ import android.view.SurfaceControlViewHost;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillValue;
import android.view.inline.InlinePresentationSpec;
import android.view.inputmethod.InlineSuggestion;
import android.view.inputmethod.InlineSuggestionInfo;
import android.view.inputmethod.InlineSuggestionsRequest;
import android.view.inputmethod.InlineSuggestionsResponse;
import android.widget.inline.InlinePresentationSpec;
import com.android.internal.view.inline.IInlineContentCallback;
import com.android.internal.view.inline.IInlineContentProvider;
@@ -263,7 +263,7 @@ public final class InlineSuggestionFactory {
private static InlinePresentation mergedInlinePresentation(
@NonNull InlineSuggestionsRequest request,
int index, @NonNull InlinePresentation inlinePresentation) {
final List<InlinePresentationSpec> specs = request.getPresentationSpecs();
final List<InlinePresentationSpec> specs = request.getInlinePresentationSpecs();
if (specs.isEmpty()) {
return inlinePresentation;
}