Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b20fa45 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixed autofill compat mode so it works on secondary user." into pi-dev

parents 97d17a77 1b4c8076
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -588,7 +588,7 @@ public final class AutofillManagerService extends SystemService {

    private void addCompatibilityModeRequestsLocked(@NonNull AutofillManagerServiceImpl service
            , int userId) {
        mAutofillCompatState.reset();
        mAutofillCompatState.reset(userId);
        final ArrayMap<String, Long> compatPackages =
                service.getCompatibilityPackagesLocked();
        if (compatPackages == null || compatPackages.isEmpty()) {
@@ -721,6 +721,9 @@ public final class AutofillManagerService extends SystemService {
    static final class AutofillCompatState {
        private final Object mLock = new Object();

        /**
         * Map of app->compat_state per user.
         */
        @GuardedBy("mLock")
        private SparseArray<ArrayMap<String, PackageCompatState>> mUserSpecs;

@@ -787,11 +790,17 @@ public final class AutofillManagerService extends SystemService {
            }
        }

        void reset() {
        void reset(int userId) {
            synchronized (mLock) {
                if (mUserSpecs != null) {
                    mUserSpecs.clear();
                    mUserSpecs.delete(userId);
                    final int newSize = mUserSpecs.size();
                    if (newSize == 0) {
                        if (sVerbose) Slog.v(TAG, "reseting mUserSpecs");
                        mUserSpecs = null;
                    } else {
                        if (sVerbose) Slog.v(TAG, "mUserSpecs down to " + newSize);
                    }
                }
            }
        }
@@ -806,7 +815,7 @@ public final class AutofillManagerService extends SystemService {
             for (int i = 0; i < mUserSpecs.size(); i++) {
                 final int user = mUserSpecs.keyAt(i);
                 pw.print(prefix); pw.print("User: "); pw.println(user);
                 final ArrayMap<String,PackageCompatState> perUser = mUserSpecs.get(i);
                 final ArrayMap<String, PackageCompatState> perUser = mUserSpecs.valueAt(i);
                 for (int j = 0; j < perUser.size(); j++) {
                     final String packageName = perUser.keyAt(j);
                     final PackageCompatState state = perUser.valueAt(j);