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

Commit 23cdcba7 authored by Song Chun Fan's avatar Song Chun Fan Committed by Android (Google) Code Review
Browse files

Merge "Revert "Revert "[SettingsProvider] skip caching in system server""" into udc-dev

parents 3fac471c caeb1904
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -3036,9 +3036,7 @@ public final class Settings {
        public void destroy() {
            try {
                // If this process is the system server process, mArray is the same object as
                // the memory int array kept inside SettingsProvider, so skipping the close()
                if (!Settings.isInSystemServer() && !mArray.isClosed()) {
                if (!mArray.isClosed()) {
                    mArray.close();
                }
            } catch (IOException e) {
@@ -3218,8 +3216,9 @@ public final class Settings {
        @UnsupportedAppUsage
        public String getStringForUser(ContentResolver cr, String name, final int userHandle) {
            final boolean isSelf = (userHandle == UserHandle.myUserId());
            final boolean useCache = isSelf && !isInSystemServer();
            boolean needsGenerationTracker = false;
            if (isSelf) {
            if (useCache) {
                synchronized (NameValueCache.this) {
                    final GenerationTracker generationTracker = mGenerationTrackers.get(name);
                    if (generationTracker != null) {
@@ -3365,10 +3364,13 @@ public final class Settings {
                                }
                            }
                        } else {
                            if (LOCAL_LOGV) Log.i(TAG, "call-query of user " + userHandle
                            if (DEBUG || LOCAL_LOGV) {
                                Log.i(TAG, "call-query of user " + userHandle
                                        + " by " + UserHandle.myUserId()
                                        + (isInSystemServer() ? " in system_server" : "")
                                        + " so not updating cache");
                            }
                        }
                        return value;
                    }
                    // If the response Bundle is null, we fall through