package com.seewo.sdk.util;

import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import com.seewo.sdk.OpenSDK;

/* JADX INFO: loaded from: classes.dex */
public class Preferences {
    private static final Uri COMMON_URI = Uri.parse("content://com.seewo.osservice.provider.VCommonContentProvider/key");
    private static final String TAG = "Preferences";

    private Preferences() {
    }

    public static String getString(String str, String str2) {
        Context context = OpenSDK.getInstance().getContext();
        if (context == null) {
            Log.e(TAG, "");
            return str2;
        }
        String string = getString(context.getContentResolver(), str);
        return TextUtils.isEmpty(string) ? str2 : string;
    }

    private static String getString(ContentResolver contentResolver, String str) {
        String string = "";
        Cursor cursorQuery = null;
        try {
            try {
                cursorQuery = contentResolver.query(COMMON_URI, new String[]{str}, null, null, null);
                if (cursorQuery != null && cursorQuery.moveToFirst()) {
                    string = cursorQuery.getString(0);
                }
            } catch (Exception e) {
                Log.e(TAG, "", e);
                if (cursorQuery != null) {
                }
            }
            return string;
        } finally {
            if (cursorQuery != null) {
                cursorQuery.close();
            }
        }
    }
}
