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

Commit d1d0e4ae authored by felipeal's avatar felipeal
Browse files

Dump autofill compat packages.

Test: manual verification
Bug:72811034

Change-Id: Iee815a84e4ff9fa1ace9301b5da7c883d4e753b8
parent 066b551e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

/**
@@ -247,4 +248,13 @@ public final class AutofillServiceInfo {
                && !mCompatibilityPackages.isEmpty()).append("]");
        return builder.toString();
    }

    /**
     * Dumps it!
     */
    public void dump(String prefix, PrintWriter pw) {
        pw.print(prefix); pw.print("Component: "); pw.println(getServiceInfo().getComponentName());
        pw.print(prefix); pw.print("Settings: "); pw.println(mSettingsActivity);
        pw.print(prefix); pw.print("Compat packages: "); pw.println(mCompatibilityPackages);
    }
}
+15 −5
Original line number Diff line number Diff line
@@ -861,8 +861,13 @@ final class AutofillManagerServiceImpl {

        pw.print(prefix); pw.print("User: "); pw.println(mUserId);
        pw.print(prefix); pw.print("UID: "); pw.println(getServiceUidLocked());
        pw.print(prefix); pw.print("Component: "); pw.println(mInfo != null
                ? mInfo.getServiceInfo().getComponentName() : null);
        pw.print(prefix); pw.print("Autofill Service Info: ");
        if (mInfo == null) {
            pw.println("N/A");
        } else {
            pw.println();
            mInfo.dump(prefix2, pw);
        }
        pw.print(prefix); pw.print("Component from settings: ");
            pw.println(getComponentNameFromSettings());
        pw.print(prefix); pw.print("Default component: ");
@@ -870,6 +875,7 @@ final class AutofillManagerServiceImpl {
        pw.print(prefix); pw.print("Disabled: "); pw.println(mDisabled);
        pw.print(prefix); pw.print("Field classification enabled: ");
            pw.println(isFieldClassificationEnabledLocked());
        pw.print(prefix); pw.print("Compat pkgs: "); pw.println(getWhitelistedCompatModePackages());
        pw.print(prefix); pw.print("Setup complete: "); pw.println(mSetupComplete);
        pw.print(prefix); pw.print("Last prune: "); pw.println(mLastPrune);

@@ -996,14 +1002,18 @@ final class AutofillManagerServiceImpl {
        }
        if (!Build.IS_ENG) {
            // TODO: Build a map and watch for settings changes (this is called on app start)
            final String whiteListedPackages = Settings.Global.getString(
                    mContext.getContentResolver(),
                    Settings.Global.AUTOFILL_COMPAT_ALLOWED_PACKAGES);
            final String whiteListedPackages = getWhitelistedCompatModePackages();
            return whiteListedPackages != null && whiteListedPackages.contains(packageName);
        }
        return true;
    }

    private String getWhitelistedCompatModePackages() {
        return Settings.Global.getString(
                mContext.getContentResolver(),
                Settings.Global.AUTOFILL_COMPAT_ALLOWED_PACKAGES);
    }

    private void sendStateToClients(boolean resetClient) {
        final RemoteCallbackList<IAutoFillManagerClient> clients;
        final int userClientCount;