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