.class public Lg3/p;
.super Ljava/lang/Object;
.source ""


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lg3/p$b;
    }
.end annotation


# instance fields
.field public a:Landroid/content/Context;

.field public b:Lg3/p$b;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 2

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object p1, p0, Lg3/p;->a:Landroid/content/Context;

    return-void
.end method


# virtual methods
.method public a()Ljava/lang/String;
    .registers 2

    invoke-virtual {p0}, Lg3/p;->b()Lg3/p$b;

    move-result-object v0

    .line 1
    iget-object v0, v0, Lg3/p$b;->a:Ljava/lang/String;

    return-object v0
.end method

.method public final b()Lg3/p$b;
    .registers 3

    iget-object v0, p0, Lg3/p;->b:Lg3/p$b;

    if-nez v0, :cond_c

    new-instance v0, Lg3/p$b;

    const/4 v1, 0x0

    invoke-direct {v0, p0, v1}, Lg3/p$b;-><init>(Lg3/p;Lg3/p$a;)V

    iput-object v0, p0, Lg3/p;->b:Lg3/p$b;

    :cond_c
    iget-object v0, p0, Lg3/p;->b:Lg3/p$b;

    return-object v0
.end method

.method public c()Landroid/location/Geocoder;
    .registers 4

    new-instance v0, Landroid/location/Geocoder;

    iget-object v1, p0, Lg3/p;->a:Landroid/content/Context;

    sget-object v2, Ljava/util/Locale;->ENGLISH:Ljava/util/Locale;

    invoke-direct {v0, v1, v2}, Landroid/location/Geocoder;-><init>(Landroid/content/Context;Ljava/util/Locale;)V

    return-object v0
.end method

.method public d()Landroid/location/Location;
    .registers 8

    const-string v0, "Failed to get most recent location"

    iget-object v1, p0, Lg3/p;->a:Landroid/content/Context;

    const-string v2, "location"

    invoke-virtual {v1, v2}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/location/LocationManager;

    const/4 v2, 0x0

    if-nez v1, :cond_10

    return-object v2

    :cond_10
    const/4 v3, 0x1

    :try_start_11
    invoke-virtual {v1, v3}, Landroid/location/LocationManager;->getProviders(Z)Ljava/util/List;

    move-result-object v3
    :try_end_15
    .catch Ljava/lang/SecurityException; {:try_start_11 .. :try_end_15} :catch_16

    goto :goto_1f

    :catch_16
    move-exception v3

    invoke-static {}, Lg3/q;->a()Lg3/q;

    move-result-object v4

    invoke-virtual {v4, v0, v3}, Lg3/q;->b(Ljava/lang/String;Ljava/lang/Throwable;)Lg3/q;

    move-object v3, v2

    :goto_1f
    if-nez v3, :cond_22

    return-object v2

    :cond_22
    new-instance v4, Ljava/util/ArrayList;

    invoke-direct {v4}, Ljava/util/ArrayList;-><init>()V

    invoke-interface {v3}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v3

    :cond_2b
    :goto_2b
    invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z

    move-result v5

    if-eqz v5, :cond_50

    invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Ljava/lang/String;

    :try_start_37
    invoke-virtual {v1, v5}, Landroid/location/LocationManager;->getLastKnownLocation(Ljava/lang/String;)Landroid/location/Location;

    move-result-object v5
    :try_end_3b
    .catch Ljava/lang/Exception; {:try_start_37 .. :try_end_3b} :catch_3c

    goto :goto_4a

    :catch_3c
    move-exception v5

    const-string v6, "com.amplitude.api.DeviceInfo"

    .line 1
    invoke-static {v6, v0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    .line 2
    invoke-static {}, Lg3/q;->a()Lg3/q;

    move-result-object v6

    invoke-virtual {v6, v0, v5}, Lg3/q;->b(Ljava/lang/String;Ljava/lang/Throwable;)Lg3/q;

    move-object v5, v2

    :goto_4a
    if-eqz v5, :cond_2b

    invoke-virtual {v4, v5}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_2b

    :cond_50
    const-wide/16 v0, -0x1

    invoke-virtual {v4}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v3

    :cond_56
    :goto_56
    invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z

    move-result v4

    if-eqz v4, :cond_70

    invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Landroid/location/Location;

    invoke-virtual {v4}, Landroid/location/Location;->getTime()J

    move-result-wide v5

    cmp-long v5, v5, v0

    if-lez v5, :cond_56

    invoke-virtual {v4}, Landroid/location/Location;->getTime()J

    move-result-wide v0

    move-object v2, v4

    goto :goto_56

    :cond_70
    return-object v2
.end method
