Loading core/java/android/service/autofill/IInlineSuggestionRenderService.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.service.autofill; import android.os.IBinder; import android.os.RemoteCallback; import android.service.autofill.IInlineSuggestionUiCallback; import android.service.autofill.InlinePresentation; Loading @@ -29,4 +30,5 @@ oneway interface IInlineSuggestionRenderService { void renderSuggestion(in IInlineSuggestionUiCallback callback, in InlinePresentation presentation, int width, int height, in IBinder hostInputToken, int displayId); void getInlineSuggestionsRendererInfo(in RemoteCallback callback); } core/java/android/service/autofill/InlineSuggestionRenderService.java +13 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.RemoteCallback; import android.os.RemoteException; import android.util.Log; import android.view.Display; Loading Loading @@ -128,6 +129,11 @@ public abstract class InlineSuggestionRenderService extends Service { } } private void handleGetInlineSuggestionsRendererInfo(@NonNull RemoteCallback callback) { final Bundle rendererInfo = onGetInlineSuggestionsRendererInfo(); callback.sendResult(rendererInfo); } private void sendResult(@NonNull IInlineSuggestionUiCallback callback, @Nullable SurfaceControlViewHost.SurfacePackage surface) { try { Loading @@ -151,6 +157,13 @@ public abstract class InlineSuggestionRenderService extends Service { InlineSuggestionRenderService.this, callback, presentation, width, height, hostInputToken, displayId)); } @Override public void getInlineSuggestionsRendererInfo(@NonNull RemoteCallback callback) { mHandler.sendMessage(obtainMessage( InlineSuggestionRenderService::handleGetInlineSuggestionsRendererInfo, InlineSuggestionRenderService.this, callback)); } }.asBinder(); } Loading services/autofill/java/com/android/server/autofill/RemoteInlineSuggestionRenderService.java +11 −0 Original line number Diff line number Diff line Loading @@ -27,7 +27,9 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteCallback; import android.service.autofill.IInlineSuggestionRenderService; import android.service.autofill.IInlineSuggestionUiCallback; import android.service.autofill.InlinePresentation; Loading Loading @@ -91,6 +93,15 @@ public final class RemoteInlineSuggestionRenderService extends hostInputToken, displayId)); } /** * Gets the inline suggestions renderer info as a {@link Bundle}. */ public void getInlineSuggestionsRendererInfo(@NonNull RemoteCallback callback) { scheduleAsyncRequest((s) -> s.getInlineSuggestionsRendererInfo(new RemoteCallback( (bundle) -> callback.sendResult(bundle) ))); } @Nullable private static ServiceInfo getServiceInfo(Context context, int userId) { final String packageName = Loading services/autofill/java/com/android/server/autofill/Session.java +18 −13 Original line number Diff line number Diff line Loading @@ -652,10 +652,6 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return mService.isInlineSuggestionsEnabled(); } private boolean isInlineSuggestionRenderServiceAvailable() { return mService.getRemoteInlineSuggestionRenderServiceLocked() != null; } /** * Clears the existing response for the partition, reads a new structure, and then requests a * new fill response from the fill service. Loading Loading @@ -715,14 +711,18 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState // Only ask IME to create inline suggestions request if Autofill provider supports it and // the render service is available. if (isInlineSuggestionsEnabledByAutofillProviderLocked() && isInlineSuggestionRenderServiceAvailable()) { final RemoteInlineSuggestionRenderService remoteRenderService = mService.getRemoteInlineSuggestionRenderServiceLocked(); if (isInlineSuggestionsEnabledByAutofillProviderLocked() && remoteRenderService != null) { Consumer<InlineSuggestionsRequest> inlineSuggestionsRequestConsumer = mAssistReceiver.newAutofillRequestLocked(/*isInlineRequest=*/ true); if (inlineSuggestionsRequestConsumer != null) { // TODO(b/146454892): pipe the uiExtras from the ExtServices. mInlineSessionController.onCreateInlineSuggestionsRequestLocked(mCurrentViewId, inlineSuggestionsRequestConsumer, Bundle.EMPTY); remoteRenderService.getInlineSuggestionsRendererInfo( new RemoteCallback((extras) -> { mInlineSessionController.onCreateInlineSuggestionsRequestLocked( mCurrentViewId, inlineSuggestionsRequestConsumer, extras); } )); } } else { mAssistReceiver.newAutofillRequestLocked(/*isInlineRequest=*/ false); Loading Loading @@ -3130,13 +3130,18 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState // 1. the field is augmented autofill only (when standard autofill provider is None or // when it returns null response) // 2. standard autofill provider doesn't support inline suggestion if (isInlineSuggestionRenderServiceAvailable() final RemoteInlineSuggestionRenderService remoteRenderService = mService.getRemoteInlineSuggestionRenderServiceLocked(); if (remoteRenderService != null && (mForAugmentedAutofillOnly || !isInlineSuggestionsEnabledByAutofillProviderLocked())) { if (sDebug) Slog.d(TAG, "Create inline request for augmented autofill"); // TODO(b/146454892): pipe the uiExtras from the ExtServices. mInlineSessionController.onCreateInlineSuggestionsRequestLocked(mCurrentViewId, /*requestConsumer=*/ requestAugmentedAutofill, Bundle.EMPTY); remoteRenderService.getInlineSuggestionsRendererInfo(new RemoteCallback( (extras) -> { mInlineSessionController.onCreateInlineSuggestionsRequestLocked( mCurrentViewId, /*requestConsumer=*/ requestAugmentedAutofill, extras); }, mHandler)); } else { requestAugmentedAutofill.accept( mInlineSessionController.getInlineSuggestionsRequestLocked().orElse(null)); Loading Loading
core/java/android/service/autofill/IInlineSuggestionRenderService.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.service.autofill; import android.os.IBinder; import android.os.RemoteCallback; import android.service.autofill.IInlineSuggestionUiCallback; import android.service.autofill.InlinePresentation; Loading @@ -29,4 +30,5 @@ oneway interface IInlineSuggestionRenderService { void renderSuggestion(in IInlineSuggestionUiCallback callback, in InlinePresentation presentation, int width, int height, in IBinder hostInputToken, int displayId); void getInlineSuggestionsRendererInfo(in RemoteCallback callback); }
core/java/android/service/autofill/InlineSuggestionRenderService.java +13 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.RemoteCallback; import android.os.RemoteException; import android.util.Log; import android.view.Display; Loading Loading @@ -128,6 +129,11 @@ public abstract class InlineSuggestionRenderService extends Service { } } private void handleGetInlineSuggestionsRendererInfo(@NonNull RemoteCallback callback) { final Bundle rendererInfo = onGetInlineSuggestionsRendererInfo(); callback.sendResult(rendererInfo); } private void sendResult(@NonNull IInlineSuggestionUiCallback callback, @Nullable SurfaceControlViewHost.SurfacePackage surface) { try { Loading @@ -151,6 +157,13 @@ public abstract class InlineSuggestionRenderService extends Service { InlineSuggestionRenderService.this, callback, presentation, width, height, hostInputToken, displayId)); } @Override public void getInlineSuggestionsRendererInfo(@NonNull RemoteCallback callback) { mHandler.sendMessage(obtainMessage( InlineSuggestionRenderService::handleGetInlineSuggestionsRendererInfo, InlineSuggestionRenderService.this, callback)); } }.asBinder(); } Loading
services/autofill/java/com/android/server/autofill/RemoteInlineSuggestionRenderService.java +11 −0 Original line number Diff line number Diff line Loading @@ -27,7 +27,9 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteCallback; import android.service.autofill.IInlineSuggestionRenderService; import android.service.autofill.IInlineSuggestionUiCallback; import android.service.autofill.InlinePresentation; Loading Loading @@ -91,6 +93,15 @@ public final class RemoteInlineSuggestionRenderService extends hostInputToken, displayId)); } /** * Gets the inline suggestions renderer info as a {@link Bundle}. */ public void getInlineSuggestionsRendererInfo(@NonNull RemoteCallback callback) { scheduleAsyncRequest((s) -> s.getInlineSuggestionsRendererInfo(new RemoteCallback( (bundle) -> callback.sendResult(bundle) ))); } @Nullable private static ServiceInfo getServiceInfo(Context context, int userId) { final String packageName = Loading
services/autofill/java/com/android/server/autofill/Session.java +18 −13 Original line number Diff line number Diff line Loading @@ -652,10 +652,6 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return mService.isInlineSuggestionsEnabled(); } private boolean isInlineSuggestionRenderServiceAvailable() { return mService.getRemoteInlineSuggestionRenderServiceLocked() != null; } /** * Clears the existing response for the partition, reads a new structure, and then requests a * new fill response from the fill service. Loading Loading @@ -715,14 +711,18 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState // Only ask IME to create inline suggestions request if Autofill provider supports it and // the render service is available. if (isInlineSuggestionsEnabledByAutofillProviderLocked() && isInlineSuggestionRenderServiceAvailable()) { final RemoteInlineSuggestionRenderService remoteRenderService = mService.getRemoteInlineSuggestionRenderServiceLocked(); if (isInlineSuggestionsEnabledByAutofillProviderLocked() && remoteRenderService != null) { Consumer<InlineSuggestionsRequest> inlineSuggestionsRequestConsumer = mAssistReceiver.newAutofillRequestLocked(/*isInlineRequest=*/ true); if (inlineSuggestionsRequestConsumer != null) { // TODO(b/146454892): pipe the uiExtras from the ExtServices. mInlineSessionController.onCreateInlineSuggestionsRequestLocked(mCurrentViewId, inlineSuggestionsRequestConsumer, Bundle.EMPTY); remoteRenderService.getInlineSuggestionsRendererInfo( new RemoteCallback((extras) -> { mInlineSessionController.onCreateInlineSuggestionsRequestLocked( mCurrentViewId, inlineSuggestionsRequestConsumer, extras); } )); } } else { mAssistReceiver.newAutofillRequestLocked(/*isInlineRequest=*/ false); Loading Loading @@ -3130,13 +3130,18 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState // 1. the field is augmented autofill only (when standard autofill provider is None or // when it returns null response) // 2. standard autofill provider doesn't support inline suggestion if (isInlineSuggestionRenderServiceAvailable() final RemoteInlineSuggestionRenderService remoteRenderService = mService.getRemoteInlineSuggestionRenderServiceLocked(); if (remoteRenderService != null && (mForAugmentedAutofillOnly || !isInlineSuggestionsEnabledByAutofillProviderLocked())) { if (sDebug) Slog.d(TAG, "Create inline request for augmented autofill"); // TODO(b/146454892): pipe the uiExtras from the ExtServices. mInlineSessionController.onCreateInlineSuggestionsRequestLocked(mCurrentViewId, /*requestConsumer=*/ requestAugmentedAutofill, Bundle.EMPTY); remoteRenderService.getInlineSuggestionsRendererInfo(new RemoteCallback( (extras) -> { mInlineSessionController.onCreateInlineSuggestionsRequestLocked( mCurrentViewId, /*requestConsumer=*/ requestAugmentedAutofill, extras); }, mHandler)); } else { requestAugmentedAutofill.accept( mInlineSessionController.getInlineSuggestionsRequestLocked().orElse(null)); Loading