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

Commit e83b7f29 authored by Songchun Fan's avatar Songchun Fan
Browse files

[am] system_server should not call non forUser Settings.Secure.get* methods

BUG: 166312046
Test: builds
Change-Id: I604ddbf311e5b8b350d1dbe9e1787cdad088de1e
parent 8d714151
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.am;

import android.annotation.NonNull;
import android.app.ActivityThread;
import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
import android.net.Uri;
@@ -223,16 +224,17 @@ final class CoreSettingsObserver extends ContentObserver {

    @VisibleForTesting
    void populateSettings(Bundle snapshot, Map<String, Class<?>> map) {
        Context context = mActivityManagerService.mContext;
        final Context context = mActivityManagerService.mContext;
        final ContentResolver cr = context.getContentResolver();
        for (Map.Entry<String, Class<?>> entry : map.entrySet()) {
            String setting = entry.getKey();
            final String value;
            if (map == sSecureSettingToTypeMap) {
                value = Settings.Secure.getString(context.getContentResolver(), setting);
                value = Settings.Secure.getStringForUser(cr, setting, cr.getUserId());
            } else if (map == sSystemSettingToTypeMap) {
                value = Settings.System.getString(context.getContentResolver(), setting);
                value = Settings.System.getStringForUser(cr, setting, cr.getUserId());
            } else {
                value = Settings.Global.getString(context.getContentResolver(), setting);
                value = Settings.Global.getString(cr, setting);
            }
            if (value == null) {
                snapshot.remove(setting);