package a.b.a.f;

import a.a.a.b;
import a.b.a.i.i;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;

public class f {
    private static final String b = "CarBluetoothMacRecord";
    private static final String c = "car_bluetooth_config";

    /* renamed from: a  reason: collision with root package name */
    private SharedPreferences f15a;

    public f(Context context) {
        this.f15a = context.getSharedPreferences(c, 0);
    }

    public static boolean a(String str, Context context) {
        if (TextUtils.isEmpty(str)) {
            b.a(b, "mac empty");
            return false;
        }
        SharedPreferences sharedPreferences = context.getSharedPreferences(c, 0);
        if (sharedPreferences == null) {
            return false;
        }
        b.a(b, "mac contains");
        return sharedPreferences.contains(i.a(str));
    }

    public static String b(String str, Context context) {
        if (TextUtils.isEmpty(str)) {
            b.a(b, "phoneId empty");
            return null;
        }
        SharedPreferences sharedPreferences = context.getSharedPreferences(c, 0);
        if (sharedPreferences != null) {
            return sharedPreferences.getString(str, null);
        }
        return null;
    }

    public void a(String str) {
        SharedPreferences sharedPreferences = this.f15a;
        if (sharedPreferences != null) {
            sharedPreferences.edit().remove(str).apply();
            b.a(b, "delete successfully");
        }
    }

    public void a(String str, String str2) {
        SharedPreferences sharedPreferences = this.f15a;
        if (sharedPreferences != null) {
            sharedPreferences.edit().putString(str, str2).apply();
            b.a(b, "sav successfully");
        }
    }
}
