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

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

Merge "Address comments for ag/3587350"

parents 8b0012bc 1e132a4c
Loading
Loading
Loading
Loading
+11 −16
Original line number Original line Diff line number Diff line
@@ -327,11 +327,7 @@ public final class AutofillManagerService extends SystemService {
                    mUiLatencyHistory, mWtfHistory, resolvedUserId, mUi,
                    mUiLatencyHistory, mWtfHistory, resolvedUserId, mUi,
                    mDisabledUsers.get(resolvedUserId));
                    mDisabledUsers.get(resolvedUserId));
            mServicesCache.put(userId, service);
            mServicesCache.put(userId, service);
            final ArrayMap<String, Pair<Long, String>> compatPackages =
            addCompatibilityModeRequestsLocked(service, userId);
                    service.getCompatibilityPackagesLocked();
            if (compatPackages != null) {
                addCompatibilityModeRequests(compatPackages, userId);
            }
        }
        }
        return service;
        return service;
    }
    }
@@ -521,24 +517,23 @@ public final class AutofillManagerService extends SystemService {
            if (!service.isEnabledLocked()) {
            if (!service.isEnabledLocked()) {
                removeCachedServiceLocked(userId);
                removeCachedServiceLocked(userId);
            } else {
            } else {
                final ArrayMap<String, Pair<Long, String>> compatPackages =
                addCompatibilityModeRequestsLocked(service, userId);
                        service.getCompatibilityPackagesLocked();
                if (compatPackages != null) {
                    addCompatibilityModeRequests(compatPackages, userId);
                }
            }
            }
        }
        }
    }
    }


    private void addCompatibilityModeRequests(
    private void addCompatibilityModeRequestsLocked(@NonNull AutofillManagerServiceImpl service
            @NonNull ArrayMap<String, Pair<Long, String>> compatPackages, int userId) {
            , int userId) {
        final Set<String> whiteListedPackages = Build.IS_ENG ? null
        final ArrayMap<String, Pair<Long, String>> compatPackages =
                : getWhitelistedCompatModePackages();
                service.getCompatibilityPackagesLocked();
        if (compatPackages == null || compatPackages.isEmpty()) {
            return;
        }
        final Set<String> whiteListedPackages = getWhitelistedCompatModePackages();
        final int compatPackageCount = compatPackages.size();
        final int compatPackageCount = compatPackages.size();
        for (int i = 0; i < compatPackageCount; i++) {
        for (int i = 0; i < compatPackageCount; i++) {
            final String packageName = compatPackages.keyAt(i);
            final String packageName = compatPackages.keyAt(i);
            if (!Build.IS_ENG && (whiteListedPackages == null
            if (whiteListedPackages == null || !whiteListedPackages.contains(packageName)) {
                    || !whiteListedPackages.contains(packageName))) {
                Slog.w(TAG, "Ignoring not whitelisted compat package " + packageName);
                Slog.w(TAG, "Ignoring not whitelisted compat package " + packageName);
                continue;
                continue;
            }
            }