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

Commit 10b19601 authored by Soonil Nagarkar's avatar Soonil Nagarkar
Browse files

LOCATION_PROVIDERS_ALLOWED fixes

Remove unnecessary lock from Settings and fix very old race condition
bug with LOCATION_PROVIDERS_ALLOWED, far too late for the fix to
actually help.

Test: presubmits
Bug: 139487787
Change-Id: I50a597291e589b3cb9bdd616808409a0421a0bfb
parent a34d0b78
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -2103,10 +2103,6 @@ public final class Settings {
    private static final String TAG = "Settings";
    private static final boolean LOCAL_LOGV = false;
    // Lock ensures that when enabling/disabling the master location switch, we don't end up
    // with a partial enable/disable state in multi-threaded situations.
    private static final Object mLocationSettingsLock = new Object();
    // Used in system server calling uid workaround in call()
    private static boolean sInSystemServer = false;
    private static final Object sInSystemServerLock = new Object();
+6 −6
Original line number Diff line number Diff line
@@ -1521,14 +1521,14 @@ public class SettingsProvider extends ContentProvider {
            return false;
        }

        // Mutate the value.
        synchronized (mLock) {
            // Special cases for location providers (sigh).
            if (Settings.Secure.LOCATION_PROVIDERS_ALLOWED.equals(name)) {
                return updateLocationProvidersAllowedLocked(value, tag, owningUserId, makeDefault,
                        forceNotify);
            }

        // Mutate the value.
        synchronized (mLock) {
            switch (operation) {
                case MUTATION_OPERATION_INSERT: {
                    return mSettingsRegistry.insertSettingLocked(SETTINGS_TYPE_SECURE,