diff options
Diffstat (limited to 'core/java')
7 files changed, 53 insertions, 4 deletions
diff --git a/core/java/android/inputmethodservice/InlineSuggestionSession.java b/core/java/android/inputmethodservice/InlineSuggestionSession.java index 98ccbfc8aef4..26197883c32f 100644 --- a/core/java/android/inputmethodservice/InlineSuggestionSession.java +++ b/core/java/android/inputmethodservice/InlineSuggestionSession.java @@ -169,6 +169,7 @@ class InlineSuggestionSession { mCallback.onInlineSuggestionsUnsupported(); } else { request.setHostInputToken(mHostInputTokenSupplier.get()); + request.filterContentTypes(); mResponseCallback = new InlineSuggestionsResponseCallbackImpl(this); mCallback.onInlineSuggestionsRequest(request, mResponseCallback); } diff --git a/core/java/android/service/autofill/AutofillService.java b/core/java/android/service/autofill/AutofillService.java index 5a918023fdc3..188670d0df50 100644 --- a/core/java/android/service/autofill/AutofillService.java +++ b/core/java/android/service/autofill/AutofillService.java @@ -23,6 +23,7 @@ import android.annotation.Nullable; import android.annotation.SdkConstant; import android.app.Service; import android.content.Intent; +import android.os.BaseBundle; import android.os.CancellationSignal; import android.os.Handler; import android.os.IBinder; @@ -611,6 +612,7 @@ public abstract class AutofillService extends Service { public void onCreate() { super.onCreate(); mHandler = new Handler(Looper.getMainLooper(), null, true); + BaseBundle.setShouldDefuse(true); } @Override diff --git a/core/java/android/service/autofill/InlineSuggestionRenderService.java b/core/java/android/service/autofill/InlineSuggestionRenderService.java index e3ed21ff556d..d3ad1c6b8862 100644 --- a/core/java/android/service/autofill/InlineSuggestionRenderService.java +++ b/core/java/android/service/autofill/InlineSuggestionRenderService.java @@ -26,6 +26,7 @@ import android.app.slice.Slice; import android.content.Intent; import android.content.IntentSender; import android.graphics.PixelFormat; +import android.os.BaseBundle; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; @@ -146,6 +147,7 @@ public abstract class InlineSuggestionRenderService extends Service { @Override @Nullable public final IBinder onBind(@NonNull Intent intent) { + BaseBundle.setShouldDefuse(true); if (SERVICE_INTERFACE.equals(intent.getAction())) { return new IInlineSuggestionRenderService.Stub() { @Override diff --git a/core/java/android/service/autofill/augmented/AugmentedAutofillService.java b/core/java/android/service/autofill/augmented/AugmentedAutofillService.java index b47b2b41bdd9..cca45f572489 100644 --- a/core/java/android/service/autofill/augmented/AugmentedAutofillService.java +++ b/core/java/android/service/autofill/augmented/AugmentedAutofillService.java @@ -30,6 +30,7 @@ import android.app.Service; import android.content.ComponentName; import android.content.Intent; import android.graphics.Rect; +import android.os.BaseBundle; import android.os.Build; import android.os.Bundle; import android.os.CancellationSignal; @@ -132,6 +133,7 @@ public abstract class AugmentedAutofillService extends Service { public void onCreate() { super.onCreate(); mHandler = new Handler(Looper.getMainLooper(), null, true); + BaseBundle.setShouldDefuse(true); } /** @hide */ diff --git a/core/java/android/view/inputmethod/InlineSuggestionsRequest.java b/core/java/android/view/inputmethod/InlineSuggestionsRequest.java index d282b56aedb6..4d4faa4ba2a3 100644 --- a/core/java/android/view/inputmethod/InlineSuggestionsRequest.java +++ b/core/java/android/view/inputmethod/InlineSuggestionsRequest.java @@ -126,6 +126,19 @@ public final class InlineSuggestionsRequest implements Parcelable { Preconditions.checkState(mMaxSuggestionCount >= mInlinePresentationSpecs.size()); } + /** + * Removes the remote objects from the bundles within the {@Code mExtras} and the + * {@code mInlinePresentationSpecs}. + * + * @hide + */ + public void filterContentTypes() { + InlinePresentationStyleUtils.filterContentTypes(mExtras); + for (int i = 0; i < mInlinePresentationSpecs.size(); i++) { + mInlinePresentationSpecs.get(i).filterContentTypes(); + } + } + private static int defaultMaxSuggestionCount() { return SUGGESTION_COUNT_UNLIMITED; } @@ -582,10 +595,10 @@ public final class InlineSuggestionsRequest implements Parcelable { } @DataClass.Generated( - time = 1586992395497L, + time = 1587537617922L, 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()\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 []") + 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 []") @Deprecated private void __metadata() {} diff --git a/core/java/android/widget/inline/InlinePresentationSpec.java b/core/java/android/widget/inline/InlinePresentationSpec.java index 5635857154de..9f966d84eb34 100644 --- a/core/java/android/widget/inline/InlinePresentationSpec.java +++ b/core/java/android/widget/inline/InlinePresentationSpec.java @@ -57,6 +57,14 @@ public final class InlinePresentationSpec implements Parcelable { return InlinePresentationStyleUtils.bundleEquals(mStyle, style); } + /** + * Removes the remote objects from the {@code mStyle}. + * @hide + */ + public void filterContentTypes() { + InlinePresentationStyleUtils.filterContentTypes(mStyle); + } + /** @hide */ @DataClass.Suppress({"setMaxSize", "setMinSize"}) abstract static class BaseBuilder { @@ -285,10 +293,10 @@ public final class InlinePresentationSpec implements Parcelable { } @DataClass.Generated( - time = 1585768046898L, + time = 1586935491105L, 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)\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 []") + 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 []") @Deprecated private void __metadata() {} diff --git a/core/java/com/android/internal/widget/InlinePresentationStyleUtils.java b/core/java/com/android/internal/widget/InlinePresentationStyleUtils.java index 264c8bd2303a..db1725ff461c 100644 --- a/core/java/com/android/internal/widget/InlinePresentationStyleUtils.java +++ b/core/java/com/android/internal/widget/InlinePresentationStyleUtils.java @@ -17,7 +17,9 @@ package com.android.internal.widget; import android.annotation.NonNull; +import android.annotation.Nullable; import android.os.Bundle; +import android.os.IBinder; import java.util.Objects; import java.util.Set; @@ -61,6 +63,25 @@ public final class InlinePresentationStyleUtils { } /** + * Removes remote objects from the bundle. + */ + public static void filterContentTypes(@Nullable Bundle bundle) { + if (bundle == null) { + return; + } + + for (String key : bundle.keySet()) { + Object o = bundle.get(key); + + if (o instanceof Bundle) { + filterContentTypes((Bundle) o); + } else if (o instanceof IBinder) { + bundle.remove(key); + } + } + } + + /** * Private ctor to avoid constructing the class. */ private InlinePresentationStyleUtils() { |
