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

Commit 85d1c2d2 authored by Felipe Leme's avatar Felipe Leme Committed by Philip P. Moltmann
Browse files

Minor fixes on Autofill Framework:

- Removed default implementation of onProvideAutofillVirtualStructure() that
  was using accessibility API (it's useless because without the View calling
  AutofillManager.notifyViewEntered(), it would never be triggered).
- Fixed obsolete TODOs.
- Removed obsolete service class name constant.
- Removed unused debug constant.

Fixes: 37078783
Fixes: 33197203
Bug: 33802548
Bug: 35956626

Test: CtsAutoFillServiceTestCases pass
Merged-In: I834d34b8af8bf0d781dc7e0ffcd6e600bfa2d183
Change-Id: I834d34b8af8bf0d781dc7e0ffcd6e600bfa2d183
parent d8f13bbc
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -696,9 +696,6 @@ public class Activity extends ContextThemeWrapper
    private static final String TAG = "Activity";
    private static final boolean DEBUG_LIFECYCLE = false;

    // TODO(b/33197203): set to false once stable
    private static final boolean DEBUG_AUTO_FILL = true;

    /** Standard activity result: operation canceled. */
    public static final int RESULT_CANCELED    = 0;
    /** Standard activity result: operation succeeded. */
+2 −4
Original line number Diff line number Diff line
@@ -3004,7 +3004,7 @@ public final class ActivityThread {
        // - it needs an IAutoFillCallback
        boolean forAutofill = cmd.requestType == ActivityManager.ASSIST_CONTEXT_AUTOFILL;

        // TODO(b/33197203): decide if lastSessionId logic applies to autofill sessions
        // TODO: decide if lastSessionId logic applies to autofill sessions
        if (mLastSessionId != cmd.sessionId) {
            // Clear the existing structures
            mLastSessionId = cmd.sessionId;
@@ -3032,8 +3032,6 @@ public final class ActivityThread {
            if (cmd.requestType == ActivityManager.ASSIST_CONTEXT_FULL || forAutofill) {
                structure = new AssistStructure(r.activity, forAutofill);
                Intent activityIntent = r.activity.getIntent();
                // TODO(b/33197203): re-evaluate conditions below for autofill. In particular,
                // FLAG_SECURE might be allowed on AUTO_FILL but not on AUTO_FILL_SAVE)
                boolean notSecure = r.window == null ||
                        (r.window.getAttributes().flags
                                & WindowManager.LayoutParams.FLAG_SECURE) == 0;
@@ -3059,7 +3057,7 @@ public final class ActivityThread {
            structure = new AssistStructure();
        }

        // TODO(b/33197203): decide if lastSessionId logic applies to autofill sessions
        // TODO: decide if lastSessionId logic applies to autofill sessions

        structure.setAcquisitionStartTime(startTime);
        structure.setAcquisitionEndTime(SystemClock.uptimeMillis());
+2 −4
Original line number Diff line number Diff line
@@ -600,7 +600,7 @@ public class AssistStructure implements Parcelable {
        String mIdType;
        String mIdEntry;

        // TODO(b/33197203): once we have more flags, it might be better to store the individual
        // TODO: once we have more flags, it might be better to store the individual
        // fields (viewId and childId) of the field.
        AutofillId mAutofillId;
        @View.AutofillType int mAutofillType = View.AUTOFILL_TYPE_NONE;
@@ -639,7 +639,7 @@ public class AssistStructure implements Parcelable {
        static final int FLAGS_CONTEXT_CLICKABLE = 0x00004000;
        static final int FLAGS_OPAQUE = 0x00008000;

        // TODO(b/33197203): autofill data is made of many fields and ideally we should verify
        // TODO: autofill data is made of many fields and ideally we should verify
        // one-by-one to optimize what's sent over, but there isn't enough flag bits for that, we'd
        // need to create a 'flags2' or 'autoFillFlags' field and add these flags there.
        // So, to keep thinkg simpler for now, let's just use on flag for all of them...
@@ -1043,8 +1043,6 @@ public class AssistStructure implements Parcelable {
         */
        public void updateAutofillValue(AutofillValue value) {
            mAutofillValue = value;
            // TODO(b/33197203, b/33802548): decide whether to set text as well (so it would work
            // with "legacy" views) or just the autofill value
            if (value.isText()) {
                mText.mText = value.getTextValue();
            }
+1 −21
Original line number Diff line number Diff line
@@ -36,9 +36,6 @@ import com.android.internal.os.SomeArgs;

import java.util.List;

//TODO(b/33197203): improve javadoc (of both class and methods); in particular, make sure the
//life-cycle (and how state could be maintained on server-side) is well documented.

/**
 * Top-level service of the current autofill service for a given user.
 *
@@ -47,19 +44,6 @@ import java.util.List;
public abstract class AutofillService extends Service {
    private static final String TAG = "AutofillService";

    /**
     * The {@link Intent} that must be declared as handled by the service.
     * To be supported, the service must also require the
     * {@link android.Manifest.permission#BIND_AUTO_FILL} permission so
     * that other applications can not abuse it.
     *
     * @hide
     * @deprecated TODO(b/35956626): remove once clients use AutofillService
     */
    @Deprecated
    @SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION)
    public static final String OLD_SERVICE_INTERFACE = "android.service.autofill.AutoFillService";

    /**
     * The {@link Intent} that must be declared as handled by the service.
     * To be supported, the service must also require the
@@ -92,8 +76,6 @@ public abstract class AutofillService extends Service {
    private static final int MSG_ON_FILL_REQUEST = 3;
    private static final int MSG_ON_SAVE_REQUEST = 4;

    private static final int UNUSED_ARG = -1;

    private final IAutoFillService mInterface = new IAutoFillService.Stub() {
        @Override
        public void onConnectedStateChanged(boolean connected) {
@@ -170,8 +152,7 @@ public abstract class AutofillService extends Service {

    @Override
    public final IBinder onBind(Intent intent) {
        if (SERVICE_INTERFACE.equals(intent.getAction())
                || OLD_SERVICE_INTERFACE.equals(intent.getAction())) {
        if (SERVICE_INTERFACE.equals(intent.getAction())) {
            return mInterface.asBinder();
        }
        Log.w(TAG, "Tried to bind to wrong intent: " + intent);
@@ -282,7 +263,6 @@ public abstract class AutofillService extends Service {

    @Deprecated
    public final void disableSelf() {
        // TODO(b/33197203): Remove when GCore has migrated off this API
        getSystemService(AutofillManager.class).disableOwnedAutofillServices();
    }

+2 −2
Original line number Diff line number Diff line
@@ -242,7 +242,7 @@ public final class FillResponse implements Parcelable {
        public @NonNull Builder setAuthentication(@NonNull AutofillId[] ids,
                @Nullable IntentSender authentication, @Nullable RemoteViews presentation) {
            throwIfDestroyed();
            // TODO(b/33197203): assert ids is not null nor empty once old version is removed
            // TODO(b/37424539): assert ids is not null nor empty once old version is removed
            if (authentication == null ^ presentation == null) {
                throw new IllegalArgumentException("authentication and presentation"
                        + " must be both non-null or null");
@@ -254,7 +254,7 @@ public final class FillResponse implements Parcelable {
        }

        /**
         * TODO(b/33197203): will be removed once clients use the version that takes ids
         * TODO(b/37424539): will be removed once clients use the version that takes ids
         * @hide
         * @deprecated
         */
Loading