Merge "Update the documentation for inline suggestion APIs" into rvc-dev am: d725389a55

Change-Id: If3100d8ecde9ebdb197243f3f263e82307e6cf13
This commit is contained in:
TreeHugger Robot
2020-05-01 01:44:03 +00:00
committed by Automerger Merge Worker
3 changed files with 74 additions and 2 deletions

View File

@@ -72,6 +72,9 @@ public final class InlineSuggestionsRequest implements Parcelable {
/**
* The extras state propagated from the IME to pass extra data.
*
* <p>Note: There should be no remote objects in the bundle, all included remote objects will
* be removed from the bundle before transmission.</p>
*/
private @NonNull Bundle mExtras;
@@ -261,6 +264,9 @@ public final class InlineSuggestionsRequest implements Parcelable {
/**
* The extras state propagated from the IME to pass extra data.
*
* <p>Note: There should be no remote objects in the bundle, all included remote objects will
* be removed from the bundle before transmission.</p>
*/
@DataClass.Generated.Member
public @NonNull Bundle getExtras() {
@@ -513,6 +519,9 @@ public final class InlineSuggestionsRequest implements Parcelable {
/**
* The extras state propagated from the IME to pass extra data.
*
* <p>Note: There should be no remote objects in the bundle, all included remote objects will
* be removed from the bundle before transmission.</p>
*/
@DataClass.Generated.Member
public @NonNull Builder setExtras(@NonNull Bundle value) {
@@ -595,7 +604,7 @@ public final class InlineSuggestionsRequest implements Parcelable {
}
@DataClass.Generated(
time = 1587537617922L,
time = 1588109685838L,
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.widget.inline.InlinePresentationSpec> mInlinePresentationSpecs\nprivate @android.annotation.NonNull java.lang.String mHostPackageName\nprivate @android.annotation.NonNull android.os.LocaleList mSupportedLocales\nprivate @android.annotation.NonNull android.os.Bundle mExtras\nprivate @android.annotation.Nullable android.os.IBinder mHostInputToken\nprivate int mHostDisplayId\npublic void setHostInputToken(android.os.IBinder)\nprivate boolean extrasEquals(android.os.Bundle)\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()\npublic void filterContentTypes()\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.NonNull 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 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 []")

View File

@@ -44,6 +44,9 @@ public final class InlinePresentationSpec implements Parcelable {
/**
* The extras encoding the UI style information. Defaults to {@code Bundle.Empty} in which case
* the default system UI style will be used.
*
* <p>Note: There should be no remote objects in the bundle, all included remote objects will
* be removed from the bundle before transmission.</p>
*/
@NonNull
private final Bundle mStyle;
@@ -122,6 +125,9 @@ public final class InlinePresentationSpec implements Parcelable {
/**
* The extras encoding the UI style information. Defaults to {@code Bundle.Empty} in which case
* the default system UI style will be used.
*
* <p>Note: There should be no remote objects in the bundle, all included remote objects will
* be removed from the bundle before transmission.</p>
*/
@DataClass.Generated.Member
public @NonNull Bundle getStyle() {
@@ -260,6 +266,9 @@ public final class InlinePresentationSpec implements Parcelable {
/**
* The extras encoding the UI style information. Defaults to {@code Bundle.Empty} in which case
* the default system UI style will be used.
*
* <p>Note: There should be no remote objects in the bundle, all included remote objects will
* be removed from the bundle before transmission.</p>
*/
@DataClass.Generated.Member
public @NonNull Builder setStyle(@NonNull Bundle value) {
@@ -293,7 +302,7 @@ public final class InlinePresentationSpec implements Parcelable {
}
@DataClass.Generated(
time = 1586935491105L,
time = 1588109681295L,
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.NonNull android.os.Bundle mStyle\nprivate static @android.annotation.NonNull android.os.Bundle defaultStyle()\nprivate boolean styleEquals(android.os.Bundle)\npublic void filterContentTypes()\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

@@ -16,9 +16,13 @@
package com.android.internal.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import android.os.Binder;
import android.os.Bundle;
import androidx.test.filters.SmallTest;
@@ -110,4 +114,54 @@ public class InlinePresentationStyleUtilsTest {
bundle2.putInt("KEY", 22);
assertFalse(InlinePresentationStyleUtils.bundleEquals(bundle1, bundle2));
}
@Test
public void testFilterContentTypes_nullOrEmpty() {
InlinePresentationStyleUtils.filterContentTypes(null);
InlinePresentationStyleUtils.filterContentTypes(new Bundle());
}
@Test
public void testFilterContentTypes_basic() {
Bundle bundle = new Bundle();
bundle.putInt("int", 11);
bundle.putString("str", "test");
bundle.putString("null", null);
InlinePresentationStyleUtils.filterContentTypes(bundle);
assertEquals(11, bundle.getInt("int"));
assertEquals("test", bundle.getString("str"));
assertTrue(bundle.keySet().contains("null"));
}
@Test
public void testFilterContentTypes_binder_removedBinder() {
Bundle bundle = new Bundle();
bundle.putInt("int", 11);
bundle.putString("str", "test");
bundle.putString("null", null);
bundle.putBinder("binder", new Binder());
InlinePresentationStyleUtils.filterContentTypes(bundle);
assertEquals(11, bundle.getInt("int"));
assertEquals("test", bundle.getString("str"));
assertTrue(bundle.keySet().contains("null"));
assertNull(bundle.getBinder("binder"));
}
@Test
public void testFilterContentTypes_binderInChild_removedBinder() {
Bundle child = new Bundle();
child.putBinder("binder", new Binder());
Bundle bundle = new Bundle();
bundle.putBundle("child", child);
InlinePresentationStyleUtils.filterContentTypes(bundle);
Bundle child2 = bundle.getBundle("child");
assertNotNull(child2);
assertNull(child2.getBinder("binder"));
}
}