9292import com .android .server .contentcapture .ContentCaptureManagerInternal ;
9393import com .android .server .infra .AbstractPerUserSystemService ;
9494import com .android .server .inputmethod .InputMethodManagerInternal ;
95+ import com .android .server .pm .UserManagerInternal ;
9596import com .android .server .wm .ActivityTaskManagerInternal ;
9697
9798import java .io .PrintWriter ;
@@ -192,6 +193,8 @@ final class AutofillManagerServiceImpl
192193
193194 private final ContentCaptureManagerInternal mContentCaptureManagerInternal ;
194195
196+ private final UserManagerInternal mUserManagerInternal ;
197+
195198 private final DisabledInfoCache mDisabledInfoCache ;
196199
197200 AutofillManagerServiceImpl (AutofillManagerService master , Object lock ,
@@ -208,6 +211,7 @@ final class AutofillManagerServiceImpl
208211 mInputMethodManagerInternal = LocalServices .getService (InputMethodManagerInternal .class );
209212 mContentCaptureManagerInternal = LocalServices .getService (
210213 ContentCaptureManagerInternal .class );
214+ mUserManagerInternal = LocalServices .getService (UserManagerInternal .class );
211215 mDisabledInfoCache = disableCache ;
212216 updateLocked (disabled );
213217 }
@@ -379,6 +383,13 @@ long startSessionLocked(@NonNull IBinder activityToken, int taskId, int clientUi
379383 return 0 ;
380384 }
381385
386+ // TODO(b/376482880): remove this check once autofill service supports visible
387+ // background users.
388+ if (mUserManagerInternal .isVisibleBackgroundFullUser (mUserId )) {
389+ Slog .d (TAG , "Currently, autofill service does not support visible background users." );
390+ return 0 ;
391+ }
392+
382393 if (!forAugmentedAutofillOnly && isAutofillDisabledLocked (clientActivity )) {
383394 // Standard autofill is enabled, but service disabled autofill for this activity; that
384395 // means no session, unless the activity is allowlisted for augmented autofill
0 commit comments