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

Commit 63df4e24 authored by Felipe Leme's avatar Felipe Leme Committed by Android (Google) Code Review
Browse files

Merge "Improved autofill logging and dumping." into pi-dev

parents d4115f50 da9ea34c
Loading
Loading
Loading
Loading
+22 −13
Original line number Diff line number Diff line
@@ -149,24 +149,33 @@ public final class Dataset implements Parcelable {
    public String toString() {
        if (!sDebug) return super.toString();

        final StringBuilder builder = new StringBuilder("Dataset[id=");
        final StringBuilder builder = new StringBuilder("Dataset[");
        if (mId == null) {
            builder.append("null");
            builder.append("noId");
        } else {
            // Cannot disclose id because it could contain PII.
            builder.append(mId.length()).append("_chars");
        }

        return builder
                .append(", fieldIds=").append(mFieldIds)
                .append(", fieldValues=").append(mFieldValues)
                .append(", fieldPresentations=")
                .append(mFieldPresentations == null ? 0 : mFieldPresentations.size())
                .append(", fieldFilters=")
                .append(mFieldFilters == null ? 0 : mFieldFilters.size())
                .append(", hasPresentation=").append(mPresentation != null)
                .append(", hasAuthentication=").append(mAuthentication != null)
                .append(']').toString();
            builder.append("id=").append(mId.length()).append("_chars");
        }
        if (mFieldIds != null) {
            builder.append(", fieldIds=").append(mFieldIds);
        }
        if (mFieldValues != null) {
            builder.append(", fieldValues=").append(mFieldValues);
        }
        if (mFieldPresentations != null) {
            builder.append(", fieldPresentations=").append(mFieldPresentations.size());

        }
        if (mFieldFilters != null) {
            builder.append(", fieldFilters=").append(mFieldFilters.size());
        }
        if (mPresentation != null) {
            builder.append(", hasPresentation");
        }
        if (mAuthentication != null) {
            builder.append(", hasAuthentication");
        }
        return builder.append(']').toString();
    }

    /**
+34 −17
Original line number Diff line number Diff line
@@ -557,23 +557,40 @@ public final class FillResponse implements Parcelable {
        if (!sDebug) return super.toString();

        // TODO: create a dump() method instead
        return new StringBuilder(
                "FillResponse : [mRequestId=" + mRequestId)
                .append(", datasets=").append(mDatasets == null ? "N/A" : mDatasets.getList())
                .append(", saveInfo=").append(mSaveInfo)
                .append(", clientState=").append(mClientState != null)
                .append(", hasPresentation=").append(mPresentation != null)
                .append(", hasHeader=").append(mHeader != null)
                .append(", hasFooter=").append(mFooter != null)
                .append(", hasAuthentication=").append(mAuthentication != null)
                .append(", authenticationIds=").append(Arrays.toString(mAuthenticationIds))
                .append(", ignoredIds=").append(Arrays.toString(mIgnoredIds))
                .append(", disableDuration=").append(mDisableDuration)
                .append(", flags=").append(mFlags)
                .append(", fieldClassificationIds=")
                    .append(Arrays.toString(mFieldClassificationIds))
                .append("]")
                .toString();
        final StringBuilder builder = new StringBuilder(
                "FillResponse : [mRequestId=" + mRequestId);
        if (mDatasets != null) {
            builder.append(", datasets=").append(mDatasets.getList());
        }
        if (mSaveInfo != null) {
            builder.append(", saveInfo=").append(mSaveInfo);
        }
        if (mClientState != null) {
            builder.append(", hasClientState");
        }
        if (mPresentation != null) {
            builder.append(", hasPresentation");
        }
        if (mHeader != null) {
            builder.append(", hasHeader");
        }
        if (mFooter != null) {
            builder.append(", hasFooter");
        }
        if (mAuthentication != null) {
            builder.append(", hasAuthentication");
        }
        if (mAuthenticationIds != null) {
            builder.append(", authenticationIds=").append(Arrays.toString(mAuthenticationIds));
        }
        builder.append(", disableDuration=").append(mDisableDuration);
        if (mFlags != 0) {
            builder.append(", flags=").append(mFlags);
        }
        if (mFieldClassificationIds != null) {
            builder.append(Arrays.toString(mFieldClassificationIds));
        }
        return builder.append("]").toString();
    }

    /////////////////////////////////////
+29 −14
Original line number Diff line number Diff line
@@ -689,22 +689,37 @@ public final class SaveInfo implements Parcelable {
    public String toString() {
        if (!sDebug) return super.toString();

        return new StringBuilder("SaveInfo: [type=")
        final StringBuilder builder = new StringBuilder("SaveInfo: [type=")
                .append(DebugUtils.flagsToString(SaveInfo.class, "SAVE_DATA_TYPE_", mType))
                .append(", requiredIds=").append(Arrays.toString(mRequiredIds))
                .append(", optionalIds=").append(Arrays.toString(mOptionalIds))
                .append(", description=").append(mDescription)
                .append(DebugUtils.flagsToString(SaveInfo.class, "NEGATIVE_BUTTON_STYLE_",
                        mNegativeButtonStyle))
                .append(", flags=").append(mFlags)
                .append(", customDescription=").append(mCustomDescription)
                .append(", validator=").append(mValidator)
                .append(", sanitizerKeys=")
                    .append(mSanitizerKeys == null ? "N/A:" : mSanitizerKeys.length)
                .append(", sanitizerValues=")
                    .append(mSanitizerValues == null ? "N/A:" : mSanitizerValues.length)
                .append(", triggerId=").append(mTriggerId)
                .append("]").toString();
                .append(", style=").append(DebugUtils.flagsToString(SaveInfo.class,
                        "NEGATIVE_BUTTON_STYLE_", mNegativeButtonStyle));
        if (mOptionalIds != null) {
            builder.append(", optionalIds=").append(Arrays.toString(mOptionalIds));
        }
        if (mDescription != null) {
            builder.append(", description=").append(mDescription);
        }
        if (mFlags != 0) {
            builder.append(", flags=").append(mFlags);
        }
        if (mCustomDescription != null) {
            builder.append(", customDescription=").append(mCustomDescription);
        }
        if (mValidator != null) {
            builder.append(", validator=").append(mValidator);
        }
        if (mSanitizerKeys != null) {
            builder.append(", sanitizerKeys=").append(mSanitizerKeys.length);
        }
        if (mSanitizerValues != null) {
            builder.append(", sanitizerValues=").append(mSanitizerValues.length);
        }
        if (mTriggerId != null) {
            builder.append(", triggerId=").append(mTriggerId);
        }

        return builder.append("]").toString();
    }

    /////////////////////////////////////
+11 −3
Original line number Diff line number Diff line
@@ -2882,9 +2882,8 @@ public interface WindowManager extends ViewManager {
        /**
         * @hide
         */
        public String toString(String prefix) {
            StringBuilder sb = new StringBuilder(256);
            sb.append("{(");
        public void dumpDimensions(StringBuilder sb) {
            sb.append('(');
            sb.append(x);
            sb.append(',');
            sb.append(y);
@@ -2895,6 +2894,15 @@ public interface WindowManager extends ViewManager {
            sb.append((height == MATCH_PARENT ? "fill" : (height == WRAP_CONTENT
                    ? "wrap" : String.valueOf(height))));
            sb.append(")");
        }

        /**
         * @hide
         */
        public String toString(String prefix) {
            StringBuilder sb = new StringBuilder(256);
            sb.append('{');
            dumpDimensions(sb);
            if (horizontalMargin != 0) {
                sb.append(" hm=");
                sb.append(horizontalMargin);
+26 −5
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ import com.android.internal.util.Preconditions;
import com.android.server.FgThread;
import com.android.server.LocalServices;
import com.android.server.SystemService;
import com.android.server.autofill.AutofillManagerService.PackageCompatState;
import com.android.server.autofill.ui.AutoFillUI;

import java.io.FileDescriptor;
@@ -651,7 +652,7 @@ public final class AutofillManagerService extends SystemService {
    /**
     * Compatibility mode metadata per package.
     */
    private static final class PackageCompatState {
    static final class PackageCompatState {
        private final long maxVersionCode;
        private final String[] urlBarResourceIds;

@@ -662,8 +663,8 @@ public final class AutofillManagerService extends SystemService {

        @Override
        public String toString() {
            return "PackageCompatState: [maxVersionCode=" + maxVersionCode
                    + ", urlBarResourceIds=" + Arrays.toString(urlBarResourceIds) + "]";
            return "maxVersionCode=" + maxVersionCode
                    + ", urlBarResourceIds=" + Arrays.toString(urlBarResourceIds);
        }
    }

@@ -752,6 +753,25 @@ public final class AutofillManagerService extends SystemService {
                }
            }
        }

        private void dump(String prefix, PrintWriter pw) {
             if (mUserSpecs == null) {
                 pw.println("N/A");
                 return;
             }
             pw.println();
             final String prefix2 = prefix + "  ";
             for (int i = 0; i < mUserSpecs.size(); i++) {
                 final int user = mUserSpecs.keyAt(i);
                 pw.print(prefix); pw.print("User: "); pw.println(user);
                 final ArrayMap<String,PackageCompatState> perUser = mUserSpecs.get(i);
                 for (int j = 0; j < perUser.size(); j++) {
                     final String packageName = perUser.keyAt(j);
                     final PackageCompatState state = perUser.valueAt(j);
                     pw.print(prefix2); pw.print(packageName); pw.print(": "); pw.println(state);
                }
            }
        }
    }

    final class AutoFillManagerServiceStub extends IAutoFillManager.Stub {
@@ -1117,6 +1137,7 @@ public final class AutofillManagerService extends SystemService {

            boolean oldDebug = sDebug;
            final String prefix = "  ";
            final String prefix2 = "    ";
            try {
                synchronized (mLock) {
                    oldDebug = sDebug;
@@ -1141,8 +1162,8 @@ public final class AutofillManagerService extends SystemService {
                    }
                    mUi.dump(pw);
                    pw.print("Autofill Compat State: ");
                    pw.println(mAutofillCompatState.mUserSpecs);
                    pw.print(prefix); pw.print("from settings: ");
                    mAutofillCompatState.dump(prefix2, pw);
                    pw.print(prefix2); pw.print("from settings: ");
                    pw.println(getWhitelistedCompatModePackagesFromSettings());
                }
                if (showHistory) {
Loading