Merge "Dump autofill compat packages."

This commit is contained in:
TreeHugger Robot
2018-02-06 10:24:16 +00:00
committed by Android (Google) Code Review
2 changed files with 25 additions and 5 deletions

View File

@@ -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);
}
}

View File

@@ -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;