package com.google.android.gms.internal.ads;

import android.content.SharedPreferences;
import androidx.annotation.Nullable;
import java.util.List;
import org.json.JSONException;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes2.dex */
public final class qs0 implements SharedPreferences.OnSharedPreferenceChangeListener {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final JSONObject f15854a = new JSONObject();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public List f15855b;

    @Override // android.content.SharedPreferences.OnSharedPreferenceChangeListener
    public final void onSharedPreferenceChanged(SharedPreferences sharedPreferences, @Nullable String str) {
        if (str != null && this.f15855b.contains(str)) {
            try {
                Object obj = sharedPreferences.getAll().get(str);
                JSONObject jSONObject = this.f15854a;
                if (obj == null) {
                    jSONObject.remove(str);
                } else {
                    jSONObject.put(str, obj);
                }
            } catch (JSONException e10) {
                m7.n.C.f30469h.e("InspectorSharedPreferenceCollector.onSharedPreferenceChanged", e10);
            }
        }
    }
}
