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

Commit 4770be2d authored by Mihir Patel's avatar Mihir Patel
Browse files

Send autofill assist structure data to content capture

Test: manual
Change-Id: I23339a8f90dbb6c31f473e6163ba0866518cb0a4
Bug: 147232107
parent 52572701
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -14066,6 +14066,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;

@@ -173,6 +174,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,
@@ -185,10 +188,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
@@ -422,6 +422,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                        suggestionsRequest);
            }

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

Loading