Merge "Zero jank IMF 4/N" into main
diff --git a/core/api/current.txt b/core/api/current.txt
index e8eace1..3fd67db 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -56279,7 +56279,7 @@
     method public boolean acceptStylusHandwritingDelegation(@NonNull android.view.View);
     method public boolean acceptStylusHandwritingDelegation(@NonNull android.view.View, @NonNull String);
     method @FlaggedApi("android.view.inputmethod.use_zero_jank_proxy") public void acceptStylusHandwritingDelegation(@NonNull android.view.View, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
-    method @FlaggedApi("android.view.inputmethod.home_screen_handwriting_delegator") public boolean acceptStylusHandwritingDelegation(@NonNull android.view.View, @NonNull String, int);
+    method @FlaggedApi("android.view.inputmethod.home_screen_handwriting_delegator") public void acceptStylusHandwritingDelegation(@NonNull android.view.View, @NonNull String, int, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
     method public void dispatchKeyEventFromInputMethod(@Nullable android.view.View, @NonNull android.view.KeyEvent);
     method public void displayCompletions(android.view.View, android.view.inputmethod.CompletionInfo[]);
     method @Nullable public android.view.inputmethod.InputMethodInfo getCurrentInputMethodInfo();
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index 5238479..3bce155 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -462,8 +462,8 @@
      * Flag indicating that views from the default home screen ({@link Intent#CATEGORY_HOME}) may
      * act as a handwriting delegator for the delegate editor view. If set, views from the home
      * screen package will be trusted for handwriting delegation, in addition to views in the {@code
-     * delegatorPackageName} passed to {@link #acceptStylusHandwritingDelegation(View, String,
-     * int)}.
+     * delegatorPackageName} passed to
+     * {@link #acceptStylusHandwritingDelegation(View, String, int, Executor, Consumer)} .
      */
     @FlaggedApi(FLAG_HOME_SCREEN_HANDWRITING_DELEGATOR)
     public static final int HANDWRITING_DELEGATE_FLAG_HOME_DELEGATOR_ALLOWED = 0x0001;
@@ -2896,6 +2896,8 @@
      * @param delegateView delegate view capable of receiving input via {@link InputConnection}
      * @param delegatorPackageName package name of the delegator that handled initial stylus stroke.
      * @param flags {@link #HANDWRITING_DELEGATE_FLAG_HOME_DELEGATOR_ALLOWED} or {@code 0}
+     * @param executor The executor to run the callback on.
+     * @param callback {@code true>} would be received if delegation was accepted.
      * @return {@code true} if view belongs to allowed delegate package declared in {@link
      *     #prepareStylusHandwritingDelegation(View, String)} and delegation is accepted
      * @see #prepareStylusHandwritingDelegation(View, String)
@@ -2908,13 +2910,16 @@
     // session to the delegate view.
     // @see #startConnectionlessStylusHandwritingForDelegation(View, ResultReceiver,
     //     CursorAnchorInfo, String)
+    //
     @FlaggedApi(FLAG_HOME_SCREEN_HANDWRITING_DELEGATOR)
-    public boolean acceptStylusHandwritingDelegation(
+    public void acceptStylusHandwritingDelegation(
             @NonNull View delegateView, @NonNull String delegatorPackageName,
-            @HandwritingDelegateFlags int flags) {
+            @HandwritingDelegateFlags int flags, @NonNull @CallbackExecutor Executor executor,
+            @NonNull Consumer<Boolean> callback) {
         Objects.requireNonNull(delegatorPackageName);
 
-        return startStylusHandwritingInternal(delegateView, delegatorPackageName, flags);
+        startStylusHandwritingInternal(
+                delegateView, delegatorPackageName, flags, executor, callback);
     }
 
     /**