Loading services/autofill/java/com/android/server/autofill/AutofillManagerService.java +3 −0 Original line number Diff line number Diff line Loading @@ -711,10 +711,13 @@ public final class AutofillManagerService extends SystemService { ContentResolver resolver = mContext.getContentResolver(); resolver.registerContentObserver(Settings.Secure.getUriFor( Settings.Secure.AUTOFILL_SERVICE), false, this, UserHandle.USER_ALL); resolver.registerContentObserver(Settings.Secure.getUriFor( Settings.Secure.USER_SETUP_COMPLETE), false, this, UserHandle.USER_ALL); } @Override public void onChange(boolean selfChange, Uri uri, int userId) { if (sVerbose) Slog.v(TAG, "onChange(): uri=" + uri + ", userId=" + userId); synchronized (mLock) { updateCachedServiceLocked(userId); } Loading services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +23 −4 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ import android.service.autofill.FillEventHistory.Event; import android.service.autofill.FillResponse; import android.service.autofill.IAutoFillService; import android.text.TextUtils; import android.util.ArrayMap; import android.util.LocalLog; import android.util.Slog; import android.util.SparseArray; Loading Loading @@ -99,6 +98,12 @@ final class AutofillManagerServiceImpl { */ private boolean mDisabled; /** * Caches whether the setup completed for the current user. */ @GuardedBy("mLock") private boolean mSetupComplete; private final HandlerCaller.Callback mHandlerCallback = (msg) -> { switch (msg.what) { case MSG_SERVICE_SAVE: Loading Loading @@ -171,6 +176,12 @@ final class AutofillManagerServiceImpl { } } private boolean isSetupCompletedLocked() { final String setupComplete = Settings.Secure.getStringForUser( mContext.getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, mUserId); return "1".equals(setupComplete); } private String getComponentNameFromSettings() { return Settings.Secure.getStringForUser( mContext.getContentResolver(), Settings.Secure.AUTOFILL_SERVICE, mUserId); Loading @@ -178,6 +189,12 @@ final class AutofillManagerServiceImpl { void updateLocked(boolean disabled) { final boolean wasEnabled = isEnabled(); if (sVerbose) { Slog.v(TAG, "updateLocked(u=" + mUserId + "): wasEnabled=" + wasEnabled + ", mSetupComplete= " + mSetupComplete + ", disabled=" + disabled + ", mDisabled=" + mDisabled); } mSetupComplete = isSetupCompletedLocked(); mDisabled = disabled; ComponentName serviceComponent = null; ServiceInfo serviceInfo = null; Loading @@ -199,8 +216,9 @@ final class AutofillManagerServiceImpl { } else { mInfo = null; } if (wasEnabled != isEnabled()) { if (!isEnabled()) { final boolean isEnabled = isEnabled(); if (wasEnabled != isEnabled) { if (!isEnabled) { final int sessionCount = mSessions.size(); for (int i = sessionCount - 1; i >= 0; i--) { final Session session = mSessions.valueAt(i); Loading Loading @@ -534,6 +552,7 @@ final class AutofillManagerServiceImpl { pw.print(prefix); pw.print("Default component: "); pw.println(mContext.getString(R.string.config_defaultAutofillService)); pw.print(prefix); pw.print("Disabled: "); pw.println(mDisabled); pw.print(prefix); pw.print("Setup complete: "); pw.println(mSetupComplete); pw.print(prefix); pw.print("Last prune: "); pw.println(mLastPrune); final int size = mSessions.size(); Loading Loading @@ -617,7 +636,7 @@ final class AutofillManagerServiceImpl { } boolean isEnabled() { return mInfo != null && !mDisabled; return mSetupComplete && mInfo != null && !mDisabled; } @Override Loading Loading
services/autofill/java/com/android/server/autofill/AutofillManagerService.java +3 −0 Original line number Diff line number Diff line Loading @@ -711,10 +711,13 @@ public final class AutofillManagerService extends SystemService { ContentResolver resolver = mContext.getContentResolver(); resolver.registerContentObserver(Settings.Secure.getUriFor( Settings.Secure.AUTOFILL_SERVICE), false, this, UserHandle.USER_ALL); resolver.registerContentObserver(Settings.Secure.getUriFor( Settings.Secure.USER_SETUP_COMPLETE), false, this, UserHandle.USER_ALL); } @Override public void onChange(boolean selfChange, Uri uri, int userId) { if (sVerbose) Slog.v(TAG, "onChange(): uri=" + uri + ", userId=" + userId); synchronized (mLock) { updateCachedServiceLocked(userId); } Loading
services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +23 −4 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ import android.service.autofill.FillEventHistory.Event; import android.service.autofill.FillResponse; import android.service.autofill.IAutoFillService; import android.text.TextUtils; import android.util.ArrayMap; import android.util.LocalLog; import android.util.Slog; import android.util.SparseArray; Loading Loading @@ -99,6 +98,12 @@ final class AutofillManagerServiceImpl { */ private boolean mDisabled; /** * Caches whether the setup completed for the current user. */ @GuardedBy("mLock") private boolean mSetupComplete; private final HandlerCaller.Callback mHandlerCallback = (msg) -> { switch (msg.what) { case MSG_SERVICE_SAVE: Loading Loading @@ -171,6 +176,12 @@ final class AutofillManagerServiceImpl { } } private boolean isSetupCompletedLocked() { final String setupComplete = Settings.Secure.getStringForUser( mContext.getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, mUserId); return "1".equals(setupComplete); } private String getComponentNameFromSettings() { return Settings.Secure.getStringForUser( mContext.getContentResolver(), Settings.Secure.AUTOFILL_SERVICE, mUserId); Loading @@ -178,6 +189,12 @@ final class AutofillManagerServiceImpl { void updateLocked(boolean disabled) { final boolean wasEnabled = isEnabled(); if (sVerbose) { Slog.v(TAG, "updateLocked(u=" + mUserId + "): wasEnabled=" + wasEnabled + ", mSetupComplete= " + mSetupComplete + ", disabled=" + disabled + ", mDisabled=" + mDisabled); } mSetupComplete = isSetupCompletedLocked(); mDisabled = disabled; ComponentName serviceComponent = null; ServiceInfo serviceInfo = null; Loading @@ -199,8 +216,9 @@ final class AutofillManagerServiceImpl { } else { mInfo = null; } if (wasEnabled != isEnabled()) { if (!isEnabled()) { final boolean isEnabled = isEnabled(); if (wasEnabled != isEnabled) { if (!isEnabled) { final int sessionCount = mSessions.size(); for (int i = sessionCount - 1; i >= 0; i--) { final Session session = mSessions.valueAt(i); Loading Loading @@ -534,6 +552,7 @@ final class AutofillManagerServiceImpl { pw.print(prefix); pw.print("Default component: "); pw.println(mContext.getString(R.string.config_defaultAutofillService)); pw.print(prefix); pw.print("Disabled: "); pw.println(mDisabled); pw.print(prefix); pw.print("Setup complete: "); pw.println(mSetupComplete); pw.print(prefix); pw.print("Last prune: "); pw.println(mLastPrune); final int size = mSessions.size(); Loading Loading @@ -617,7 +636,7 @@ final class AutofillManagerServiceImpl { } boolean isEnabled() { return mInfo != null && !mDisabled; return mSetupComplete && mInfo != null && !mDisabled; } @Override Loading