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

Commit af3eb24f authored by Ted Bauer's avatar Ted Bauer Committed by Android (Google) Code Review
Browse files

Merge "Don't enforce read permission in setting read." into main

parents 268e2ee2 85253479
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -3524,7 +3524,6 @@ public final class Settings {
        public ArrayMap<String, String> getStringsForPrefix(ContentResolver cr, String prefix,
                List<String> names) {
            String namespace = prefix.substring(0, prefix.length() - 1);
            Config.enforceReadPermission(namespace);
            ArrayMap<String, String> keyValues = new ArrayMap<>();
            int currentGeneration = -1;
            boolean needsGenerationTracker = false;
@@ -19648,21 +19647,6 @@ public final class Settings {
               .getApplicationContext().checkCallingOrSelfPermission(permission);
        }
        /**
         * Enforces READ_DEVICE_CONFIG permission if namespace is not one of public namespaces.
         * @hide
         */
        public static void enforceReadPermission(String namespace) {
            if (ActivityThread.currentApplication().getApplicationContext()
                    .checkCallingOrSelfPermission(Manifest.permission.READ_DEVICE_CONFIG)
                    != PackageManager.PERMISSION_GRANTED) {
                if (!DeviceConfig.getPublicNamespaces().contains(namespace)) {
                    throw new SecurityException("Permission denial: reading from settings requires:"
                        + Manifest.permission.READ_DEVICE_CONFIG);
                }
            }
        }
        private static void setMonitorCallbackAsUser(
                @NonNull @CallbackExecutor Executor executor,
                @NonNull ContentResolver resolver, @UserIdInt int userHandle,
+0 −5
Original line number Diff line number Diff line
@@ -1157,8 +1157,6 @@ public class SettingsProvider extends ContentProvider {
            Slog.v(LOG_TAG, "getConfigSetting(" + name + ")");
        }

        Settings.Config.enforceReadPermission(/*namespace=*/name.split("/")[0]);

        // Get the value.
        synchronized (mLock) {
            return mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_CONFIG,
@@ -1338,9 +1336,6 @@ public class SettingsProvider extends ContentProvider {
            Slog.v(LOG_TAG, "getAllConfigFlags() for " + prefix);
        }

        Settings.Config.enforceReadPermission(
                prefix != null ? prefix.split("/")[0] : null);

        synchronized (mLock) {
            // Get the settings.
            SettingsState settingsState = mSettingsRegistry.getSettingsLocked(