package n8;

import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.net.Uri;
import net.sqlcipher.database.SQLiteDatabase;

/* loaded from: classes.dex */
public abstract class o {

    /* renamed from: a, reason: collision with root package name */
    public static final a f29861a = new a(null);

    /* loaded from: classes.dex */
    public static final class a {
        private a() {
        }

        public /* synthetic */ a(kotlin.jvm.internal.k kVar) {
            this();
        }

        public static /* synthetic */ void b(a aVar, Context context, Location location, String str, int i10, Object obj) {
            if ((i10 & 2) != 0) {
                location = null;
            }
            aVar.a(context, location, str);
        }

        public final void a(Context context, Location location, String query) {
            kotlin.jvm.internal.t.g(context, "context");
            kotlin.jvm.internal.t.g(query, "query");
            StringBuilder sb2 = new StringBuilder("geo:");
            sb2.append(location != null ? Double.valueOf(location.getLatitude()) : r1);
            sb2.append(",");
            sb2.append(location != null ? Double.valueOf(location.getLongitude()) : 0);
            if (query.length() > 0) {
                sb2.append("?q=");
                sb2.append(query);
            }
            Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(sb2.toString()));
            intent.setPackage(context.getString(h7.l.C0));
            if (intent.resolveActivity(context.getPackageManager()) != null) {
                intent.setFlags(SQLiteDatabase.CREATE_IF_NECESSARY);
                context.startActivity(intent);
            }
        }
    }
}
