package o; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; import java.io.IOException; /* loaded from: classes2.dex */ public final class qzc implements kKN { private final String a; private final SharedPreferences.Editor c; public qzc(Context context, String str, String str2) { if (str == null) { throw new IllegalArgumentException("keysetName cannot be null"); } this.a = str; Context applicationContext = context.getApplicationContext(); if (str2 == null) { this.c = PreferenceManager.getDefaultSharedPreferences(applicationContext).edit(); } else { this.c = applicationContext.getSharedPreferences(str2, 0).edit(); } } @Override // o.kKN public final void e(Yzk yzk) throws IOException { if (!this.c.putString(this.a, nxt.b(yzk.h())).commit()) { throw new IOException("Failed to write to SharedPreferences"); } } @Override // o.kKN public final void a(C0587KSr c0587KSr) throws IOException { if (!this.c.putString(this.a, nxt.b(c0587KSr.h())).commit()) { throw new IOException("Failed to write to SharedPreferences"); } } }