Loading api/system-current.txt +8 −0 Original line number Diff line number Diff line Loading @@ -14064,6 +14064,14 @@ package android.view.contentcapture { } package android.view.inline { public final class InlinePresentationSpec implements android.os.Parcelable { method @Nullable public String getStyle(); } } package android.webkit { public abstract class CookieManager { core/java/android/inputmethodservice/InputMethodService.java +13 −0 Original line number Diff line number Diff line Loading @@ -789,6 +789,7 @@ public class InputMethodService extends AbstractInputMethodService { Log.w(TAG, "onCreateInlineSuggestionsRequest() returned null request"); requestCallback.onInlineSuggestionsUnsupported(); } else { request.setHostInputToken(getHostInputToken()); final IInlineSuggestionsResponseCallback inlineSuggestionsResponseCallback = new InlineSuggestionsResponseCallbackImpl(this, mInlineSuggestionsRequestInfo.mComponentName, Loading Loading @@ -833,6 +834,18 @@ public class InputMethodService extends AbstractInputMethodService { onInlineSuggestionsResponse(response); } /** * Returns the {@link IBinder} input token from the host view root. */ @Nullable private IBinder getHostInputToken() { ViewRootImpl viewRoot = null; if (mRootView != null) { viewRoot = mRootView.getViewRootImpl(); } return viewRoot == null ? null : viewRoot.getInputToken(); } private void notifyImeHidden() { setImeWindowStatus(IME_ACTIVE | IME_INVISIBLE, mBackDisposition); onPreRenderedWindowVisibilityChanged(false /* setVisible */); Loading core/java/android/service/autofill/IInlineSuggestionRenderService.aidl +4 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.service.autofill; import android.os.IBinder; import android.service.autofill.IInlineSuggestionUiCallback; import android.service.autofill.InlinePresentation; Loading @@ -25,6 +26,7 @@ import android.service.autofill.InlinePresentation; * @hide */ oneway interface IInlineSuggestionRenderService { void renderSuggestion(in IInlineSuggestionUiCallback callback, in InlinePresentation presentation, int width, int height); void renderSuggestion(in IInlineSuggestionUiCallback callback, in InlinePresentation presentation, int width, int height, in IBinder hostInputToken); } core/java/android/service/autofill/IInlineSuggestionUiCallback.aidl +4 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.service.autofill; import android.os.IBinder; import android.view.SurfaceControl; /** Loading @@ -24,6 +25,8 @@ import android.view.SurfaceControl; * @hide */ oneway interface IInlineSuggestionUiCallback { void autofill(); void onAutofill(); void onContent(in SurfaceControl surface); void onError(); void onTransferTouchFocusToImeWindow(in IBinder sourceInputToken, int displayId); } core/java/android/service/autofill/InlineSuggestionRenderService.java +42 −4 Original line number Diff line number Diff line Loading @@ -24,11 +24,16 @@ import android.annotation.TestApi; import android.app.Service; import android.app.slice.Slice; import android.content.Intent; import android.graphics.PixelFormat; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.RemoteException; import android.util.Log; import android.view.SurfaceControl; import android.view.SurfaceControlViewHost; import android.view.View; import android.view.WindowManager; /** * A service that renders an inline presentation given the {@link InlinePresentation} containing Loading @@ -55,8 +60,40 @@ public abstract class InlineSuggestionRenderService extends Service { private final Handler mHandler = new Handler(Looper.getMainLooper(), null, true); private void handleRenderSuggestion(IInlineSuggestionUiCallback callback, InlinePresentation presentation, int width, int height) { //TODO(b/146453086): implementation in ExtService InlinePresentation presentation, int width, int height, IBinder hostInputToken) { if (hostInputToken == null) { try { callback.onError(); } catch (RemoteException e) { Log.w(TAG, "RemoteException calling onError()"); } return; } final SurfaceControlViewHost host = new SurfaceControlViewHost(this, this.getDisplay(), hostInputToken); final SurfaceControl surface = host.getSurfacePackage().getSurfaceControl(); final View suggestionView = onRenderSuggestion(presentation, width, height); final InlineSuggestionRoot suggestionRoot = new InlineSuggestionRoot(this, callback); suggestionRoot.addView(suggestionView); suggestionRoot.setOnClickListener((v) -> { try { callback.onAutofill(); } catch (RemoteException e) { Log.w(TAG, "RemoteException calling onAutofill()"); } }); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(width, height, WindowManager.LayoutParams.TYPE_APPLICATION, 0, PixelFormat.TRANSPARENT); host.addView(suggestionRoot, lp); try { callback.onContent(surface); } catch (RemoteException e) { Log.w(TAG, "RemoteException calling onContent(" + surface + ")"); } } @Override Loading @@ -66,11 +103,12 @@ public abstract class InlineSuggestionRenderService extends Service { return new IInlineSuggestionRenderService.Stub() { @Override public void renderSuggestion(@NonNull IInlineSuggestionUiCallback callback, @NonNull InlinePresentation presentation, int width, int height) { @NonNull InlinePresentation presentation, int width, int height, @Nullable IBinder hostInputToken) { mHandler.sendMessage(obtainMessage( InlineSuggestionRenderService::handleRenderSuggestion, InlineSuggestionRenderService.this, callback, presentation, width, height)); width, height, hostInputToken)); } }.asBinder(); } Loading Loading
api/system-current.txt +8 −0 Original line number Diff line number Diff line Loading @@ -14064,6 +14064,14 @@ package android.view.contentcapture { } package android.view.inline { public final class InlinePresentationSpec implements android.os.Parcelable { method @Nullable public String getStyle(); } } package android.webkit { public abstract class CookieManager {
core/java/android/inputmethodservice/InputMethodService.java +13 −0 Original line number Diff line number Diff line Loading @@ -789,6 +789,7 @@ public class InputMethodService extends AbstractInputMethodService { Log.w(TAG, "onCreateInlineSuggestionsRequest() returned null request"); requestCallback.onInlineSuggestionsUnsupported(); } else { request.setHostInputToken(getHostInputToken()); final IInlineSuggestionsResponseCallback inlineSuggestionsResponseCallback = new InlineSuggestionsResponseCallbackImpl(this, mInlineSuggestionsRequestInfo.mComponentName, Loading Loading @@ -833,6 +834,18 @@ public class InputMethodService extends AbstractInputMethodService { onInlineSuggestionsResponse(response); } /** * Returns the {@link IBinder} input token from the host view root. */ @Nullable private IBinder getHostInputToken() { ViewRootImpl viewRoot = null; if (mRootView != null) { viewRoot = mRootView.getViewRootImpl(); } return viewRoot == null ? null : viewRoot.getInputToken(); } private void notifyImeHidden() { setImeWindowStatus(IME_ACTIVE | IME_INVISIBLE, mBackDisposition); onPreRenderedWindowVisibilityChanged(false /* setVisible */); Loading
core/java/android/service/autofill/IInlineSuggestionRenderService.aidl +4 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.service.autofill; import android.os.IBinder; import android.service.autofill.IInlineSuggestionUiCallback; import android.service.autofill.InlinePresentation; Loading @@ -25,6 +26,7 @@ import android.service.autofill.InlinePresentation; * @hide */ oneway interface IInlineSuggestionRenderService { void renderSuggestion(in IInlineSuggestionUiCallback callback, in InlinePresentation presentation, int width, int height); void renderSuggestion(in IInlineSuggestionUiCallback callback, in InlinePresentation presentation, int width, int height, in IBinder hostInputToken); }
core/java/android/service/autofill/IInlineSuggestionUiCallback.aidl +4 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.service.autofill; import android.os.IBinder; import android.view.SurfaceControl; /** Loading @@ -24,6 +25,8 @@ import android.view.SurfaceControl; * @hide */ oneway interface IInlineSuggestionUiCallback { void autofill(); void onAutofill(); void onContent(in SurfaceControl surface); void onError(); void onTransferTouchFocusToImeWindow(in IBinder sourceInputToken, int displayId); }
core/java/android/service/autofill/InlineSuggestionRenderService.java +42 −4 Original line number Diff line number Diff line Loading @@ -24,11 +24,16 @@ import android.annotation.TestApi; import android.app.Service; import android.app.slice.Slice; import android.content.Intent; import android.graphics.PixelFormat; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.RemoteException; import android.util.Log; import android.view.SurfaceControl; import android.view.SurfaceControlViewHost; import android.view.View; import android.view.WindowManager; /** * A service that renders an inline presentation given the {@link InlinePresentation} containing Loading @@ -55,8 +60,40 @@ public abstract class InlineSuggestionRenderService extends Service { private final Handler mHandler = new Handler(Looper.getMainLooper(), null, true); private void handleRenderSuggestion(IInlineSuggestionUiCallback callback, InlinePresentation presentation, int width, int height) { //TODO(b/146453086): implementation in ExtService InlinePresentation presentation, int width, int height, IBinder hostInputToken) { if (hostInputToken == null) { try { callback.onError(); } catch (RemoteException e) { Log.w(TAG, "RemoteException calling onError()"); } return; } final SurfaceControlViewHost host = new SurfaceControlViewHost(this, this.getDisplay(), hostInputToken); final SurfaceControl surface = host.getSurfacePackage().getSurfaceControl(); final View suggestionView = onRenderSuggestion(presentation, width, height); final InlineSuggestionRoot suggestionRoot = new InlineSuggestionRoot(this, callback); suggestionRoot.addView(suggestionView); suggestionRoot.setOnClickListener((v) -> { try { callback.onAutofill(); } catch (RemoteException e) { Log.w(TAG, "RemoteException calling onAutofill()"); } }); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(width, height, WindowManager.LayoutParams.TYPE_APPLICATION, 0, PixelFormat.TRANSPARENT); host.addView(suggestionRoot, lp); try { callback.onContent(surface); } catch (RemoteException e) { Log.w(TAG, "RemoteException calling onContent(" + surface + ")"); } } @Override Loading @@ -66,11 +103,12 @@ public abstract class InlineSuggestionRenderService extends Service { return new IInlineSuggestionRenderService.Stub() { @Override public void renderSuggestion(@NonNull IInlineSuggestionUiCallback callback, @NonNull InlinePresentation presentation, int width, int height) { @NonNull InlinePresentation presentation, int width, int height, @Nullable IBinder hostInputToken) { mHandler.sendMessage(obtainMessage( InlineSuggestionRenderService::handleRenderSuggestion, InlineSuggestionRenderService.this, callback, presentation, width, height)); width, height, hostInputToken)); } }.asBinder(); } Loading