package androidx.core.content;

import android.annotation.SuppressLint;
import android.content.SharedPreferences;

/* JADX INFO: loaded from: classes.dex */
public final class SharedPreferencesKt {
    @SuppressLint({"ApplySharedPref"})
    public static final void edit(SharedPreferences sharedPreferences, boolean z2, y1.l action) {
        kotlin.jvm.internal.l.e(sharedPreferences, "<this>");
        kotlin.jvm.internal.l.e(action, "action");
        SharedPreferences.Editor editor = sharedPreferences.edit();
        kotlin.jvm.internal.l.d(editor, "editor");
        action.invoke(editor);
        if (z2) {
            editor.commit();
        } else {
            editor.apply();
        }
    }

    public static /* synthetic */ void edit$default(SharedPreferences sharedPreferences, boolean z2, y1.l action, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            z2 = false;
        }
        kotlin.jvm.internal.l.e(sharedPreferences, "<this>");
        kotlin.jvm.internal.l.e(action, "action");
        SharedPreferences.Editor editor = sharedPreferences.edit();
        kotlin.jvm.internal.l.d(editor, "editor");
        action.invoke(editor);
        if (z2) {
            editor.commit();
        } else {
            editor.apply();
        }
    }
}
