Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cceb2c2e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Send autofill assist structure data to content capture"

parents 7f99ea08 4770be2d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -14131,6 +14131,10 @@ package android.view.contentcapture {
    method public boolean isContentCaptureFeatureEnabled();
  }
  public abstract class ContentCaptureSession implements java.lang.AutoCloseable {
    field public static final int NO_SESSION_ID = 0; // 0x0
  }
  public final class ViewNode extends android.app.assist.AssistStructure.ViewNode {
    method @Nullable public android.view.autofill.AutofillId getParentAutofillId();
  }
+4 −2
Original line number Diff line number Diff line
@@ -345,9 +345,11 @@ public abstract class ContentCaptureService extends Service {
    }

    /**
     * Notifies the service of {@link SnapshotData snapshot data} associated with a session.
     * Notifies the service of {@link SnapshotData snapshot data} associated with an activity.
     *
     * @param sessionId the session's Id
     * @param sessionId the session's Id. This may also be
     *                  {@link ContentCaptureSession#NO_SESSION_ID} if no content capture session
     *                  exists for the activity being snapshotted
     * @param snapshotData the data
     */
    public void onActivitySnapshot(@NonNull ContentCaptureSessionId sessionId,
+6 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.annotation.CallSuper;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.util.DebugUtils;
import android.util.Log;
import android.view.View;
@@ -50,7 +51,11 @@ public abstract class ContentCaptureSession implements AutoCloseable {

    private static final Random sIdGenerator = new Random();

    /** @hide */
    /**
    *  ID used to indicate that a session does not exist
    *  @hide
    */
    @SystemApi
    public static final int NO_SESSION_ID = 0;

    /**
+15 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ import com.android.server.LocalServices;
import com.android.server.autofill.AutofillManagerService.AutofillCompatState;
import com.android.server.autofill.RemoteAugmentedAutofillService.RemoteAugmentedAutofillServiceCallbacks;
import com.android.server.autofill.ui.AutoFillUI;
import com.android.server.contentcapture.ContentCaptureManagerInternal;
import com.android.server.infra.AbstractPerUserSystemService;
import com.android.server.inputmethod.InputMethodManagerInternal;

@@ -180,6 +181,8 @@ final class AutofillManagerServiceImpl

    private final InputMethodManagerInternal mInputMethodManagerInternal;

    private final ContentCaptureManagerInternal mContentCaptureManagerInternal;

    AutofillManagerServiceImpl(AutofillManagerService master, Object lock,
            LocalLog uiLatencyHistory, LocalLog wtfHistory, int userId, AutoFillUI ui,
            AutofillCompatState autofillCompatState,
@@ -192,10 +195,22 @@ final class AutofillManagerServiceImpl
        mFieldClassificationStrategy = new FieldClassificationStrategy(getContext(), userId);
        mAutofillCompatState = autofillCompatState;
        mInputMethodManagerInternal = LocalServices.getService(InputMethodManagerInternal.class);
        mContentCaptureManagerInternal = LocalServices.getService(
                ContentCaptureManagerInternal.class);

        updateLocked(disabled);
    }

    boolean sendActivityAssistDataToContentCapture(@NonNull IBinder activityToken,
            @NonNull Bundle data) {
        if (mContentCaptureManagerInternal != null) {
            mContentCaptureManagerInternal.sendActivityAssistData(getUserId(), activityToken, data);
            return true;
        }

        return false;
    }

    @GuardedBy("mLock")
    void onBackKeyPressed() {
        final RemoteAugmentedAutofillService remoteService =
+3 −0
Original line number Diff line number Diff line
@@ -424,6 +424,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                        suggestionsRequest);
            }

            if (mActivityToken != null) {
                mService.sendActivityAssistDataToContentCapture(mActivityToken, resultData);
            }
            mRemoteFillService.onFillRequest(request);
        }

Loading