Merge "Dump autofill service component from settings." into oc-dev

This commit is contained in:
TreeHugger Robot
2017-04-05 23:56:21 +00:00
committed by Android (Google) Code Review

View File

@@ -194,13 +194,17 @@ final class AutofillManagerServiceImpl {
} }
} }
private String getComponentNameFromSettings() {
return Settings.Secure.getStringForUser(
mContext.getContentResolver(), Settings.Secure.AUTOFILL_SERVICE, mUserId);
}
void updateLocked(boolean disabled) { void updateLocked(boolean disabled) {
final boolean wasEnabled = isEnabled(); final boolean wasEnabled = isEnabled();
mDisabled = disabled; mDisabled = disabled;
ComponentName serviceComponent = null; ComponentName serviceComponent = null;
ServiceInfo serviceInfo = null; ServiceInfo serviceInfo = null;
final String componentName = Settings.Secure.getStringForUser( final String componentName = getComponentNameFromSettings();
mContext.getContentResolver(), Settings.Secure.AUTOFILL_SERVICE, mUserId);
if (!TextUtils.isEmpty(componentName)) { if (!TextUtils.isEmpty(componentName)) {
try { try {
serviceComponent = ComponentName.unflattenFromString(componentName); serviceComponent = ComponentName.unflattenFromString(componentName);
@@ -413,8 +417,7 @@ final class AutofillManagerServiceImpl {
void disableSelf() { void disableSelf() {
final long identity = Binder.clearCallingIdentity(); final long identity = Binder.clearCallingIdentity();
try { try {
final String autoFillService = Settings.Secure.getStringForUser( final String autoFillService = getComponentNameFromSettings();
mContext.getContentResolver(), Settings.Secure.AUTOFILL_SERVICE, mUserId);
if (mInfo.getServiceInfo().getComponentName().equals( if (mInfo.getServiceInfo().getComponentName().equals(
ComponentName.unflattenFromString(autoFillService))) { ComponentName.unflattenFromString(autoFillService))) {
Settings.Secure.putStringForUser(mContext.getContentResolver(), Settings.Secure.putStringForUser(mContext.getContentResolver(),
@@ -432,12 +435,14 @@ final class AutofillManagerServiceImpl {
void dumpLocked(String prefix, PrintWriter pw) { void dumpLocked(String prefix, PrintWriter pw) {
final String prefix2 = prefix + " "; final String prefix2 = prefix + " ";
pw.print(prefix); pw.print("User :"); pw.println(mUserId); pw.print(prefix); pw.print("User: "); pw.println(mUserId);
pw.print(prefix); pw.print("Component:"); pw.println(mInfo != null pw.print(prefix); pw.print("Component: "); pw.println(mInfo != null
? mInfo.getServiceInfo().getComponentName() : null); ? mInfo.getServiceInfo().getComponentName() : null);
pw.print(prefix); pw.print("Component from settings: ");
pw.println(getComponentNameFromSettings());
pw.print(prefix); pw.print("Default component: "); pw.print(prefix); pw.print("Default component: ");
pw.println(mContext.getString(R.string.config_defaultAutofillService)); pw.println(mContext.getString(R.string.config_defaultAutofillService));
pw.print(prefix); pw.print("Disabled:"); pw.println(mDisabled); pw.print(prefix); pw.print("Disabled: "); pw.println(mDisabled);
if (VERBOSE && mInfo != null) { if (VERBOSE && mInfo != null) {
// ServiceInfo dump is too noisy and redundant (it can be obtained through other dumps) // ServiceInfo dump is too noisy and redundant (it can be obtained through other dumps)