summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ahaan Ugale <augale@google.com> 2022-01-27 22:13:51 -0800
committer Ahaan Ugale <augale@google.com> 2022-01-28 23:55:18 +0000
commit32e1ad23c062df98350859a7c23837f8c81c3c9c (patch)
treec3ed59a023651487cdc3b5e3ee9b3c75f71457c7
parentac9836b49e6825b996087472b5b73001546b3bec (diff)
Autofill: Fix GuardedBy false-positives in Session.
Warnings are due to inner class fields being guarded by an outer class lock. It's actually safe because the inner class instance is only ever assigned to a final field in the outer class. Test: builds Bug: 210926084 Change-Id: Ia5258ecf2fd01bcb951692626a616a7a51d63fab
-rw-r--r--services/autofill/java/com/android/server/autofill/Session.java11
1 files changed, 2 insertions, 9 deletions
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index ea94a9798e20..76ee728fdb07 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -447,31 +447,24 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
*/
private final class SessionFlags {
/** Whether autofill is disabled by the service */
- @GuardedBy("mLock")
private boolean mAutofillDisabled;
/** Whether the autofill service supports inline suggestions */
- @GuardedBy("mLock")
private boolean mInlineSupportedByService;
/** True if session is for augmented only */
- @GuardedBy("mLock")
private boolean mAugmentedAutofillOnly;
/** Whether the session is currently showing the SaveUi. */
- @GuardedBy("mLock")
private boolean mShowingSaveUi;
/** Whether the current {@link FillResponse} is expired. */
- @GuardedBy("mLock")
private boolean mExpiredResponse;
/** Whether the client is using {@link android.view.autofill.AutofillRequestCallback}. */
- @GuardedBy("mLock")
private boolean mClientSuggestionsEnabled;
/** Whether the fill dialog UI is disabled. */
- @GuardedBy("mLock")
private boolean mFillDialogDisabled;
}
@@ -1642,7 +1635,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
Slog.e(TAG, "Error sending input show up notification", e);
}
}
- synchronized (Session.this.mLock) {
+ synchronized (mLock) {
// stop to show fill dialog
mSessionFlags.mFillDialogDisabled = true;
}
@@ -3379,7 +3372,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
private boolean isFillDialogUiEnabled() {
// TODO read from Settings or somewhere
final boolean isSettingsEnabledFillDialog = true;
- synchronized (Session.this.mLock) {
+ synchronized (mLock) {
return isSettingsEnabledFillDialog && !mSessionFlags.mFillDialogDisabled;
}
}