.class public final Lcom/google/android/gms/internal/ads/q3;
.super Ljava/lang/Object;
.source ""

# interfaces
.implements Landroid/hardware/SensorEventListener;


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

.field public b:Landroid/hardware/SensorManager;
    .annotation runtime Ljavax/annotation/Nullable;
    .end annotation
.end field

.field public c:Landroid/hardware/Sensor;

.field public d:J

.field public e:I

.field public f:Lz5/rr0;

.field public g:Z
    .annotation build Ljavax/annotation/concurrent/GuardedBy;
        value = "this"
    .end annotation
.end field


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

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

    iput-object p1, p0, Lcom/google/android/gms/internal/ads/q3;->a:Landroid/content/Context;

    return-void
.end method


# virtual methods
.method public final a()V
    .registers 6

    monitor-enter p0

    :try_start_1
    sget-object v0, Lz5/so;->P5:Lz5/no;

    .line 1
    sget-object v1, Lz5/xk;->d:Lz5/xk;

    iget-object v2, v1, Lz5/xk;->c:Lcom/google/android/gms/internal/ads/g0;

    .line 2
    invoke-virtual {v2, v0}, Lcom/google/android/gms/internal/ads/g0;->a(Lz5/no;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Boolean;

    invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v0

    if-nez v0, :cond_15

    monitor-exit p0

    return-void

    :cond_15
    iget-object v0, p0, Lcom/google/android/gms/internal/ads/q3;->b:Landroid/hardware/SensorManager;

    const/4 v2, 0x1

    if-nez v0, :cond_35

    iget-object v0, p0, Lcom/google/android/gms/internal/ads/q3;->a:Landroid/content/Context;

    const-string v3, "sensor"

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

    move-result-object v0

    check-cast v0, Landroid/hardware/SensorManager;

    iput-object v0, p0, Lcom/google/android/gms/internal/ads/q3;->b:Landroid/hardware/SensorManager;

    if-nez v0, :cond_2f

    const-string v0, "Shake detection failed to initialize. Failed to obtain accelerometer."

    invoke-static {v0}, Lz5/d50;->zzi(Ljava/lang/String;)V

    monitor-exit p0

    return-void

    :cond_2f
    invoke-virtual {v0, v2}, Landroid/hardware/SensorManager;->getDefaultSensor(I)Landroid/hardware/Sensor;

    move-result-object v0

    iput-object v0, p0, Lcom/google/android/gms/internal/ads/q3;->c:Landroid/hardware/Sensor;

    :cond_35
    iget-boolean v0, p0, Lcom/google/android/gms/internal/ads/q3;->g:Z

    if-nez v0, :cond_69

    iget-object v0, p0, Lcom/google/android/gms/internal/ads/q3;->b:Landroid/hardware/SensorManager;

    if-eqz v0, :cond_69

    iget-object v3, p0, Lcom/google/android/gms/internal/ads/q3;->c:Landroid/hardware/Sensor;

    if-eqz v3, :cond_69

    const/4 v4, 0x2

    invoke-virtual {v0, p0, v3, v4}, Landroid/hardware/SensorManager;->registerListener(Landroid/hardware/SensorEventListener;Landroid/hardware/Sensor;I)Z

    invoke-static {}, Lcom/google/android/gms/ads/internal/zzt;->zzj()Lu5/c;

    move-result-object v0

    invoke-interface {v0}, Lu5/c;->b()J

    move-result-wide v3

    sget-object v0, Lz5/so;->R5:Lz5/no;

    .line 3
    iget-object v1, v1, Lz5/xk;->c:Lcom/google/android/gms/internal/ads/g0;

    .line 4
    invoke-virtual {v1, v0}, Lcom/google/android/gms/internal/ads/g0;->a(Lz5/no;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Integer;

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    int-to-long v0, v0

    sub-long/2addr v3, v0

    iput-wide v3, p0, Lcom/google/android/gms/internal/ads/q3;->d:J

    iput-boolean v2, p0, Lcom/google/android/gms/internal/ads/q3;->g:Z

    const-string v0, "Listening for shake gestures."

    invoke-static {v0}, Lcom/google/android/gms/ads/internal/util/zze;->zza(Ljava/lang/String;)V

    goto :goto_69

    :catchall_67
    move-exception v0

    goto :goto_6b

    :cond_69
    :goto_69
    monitor-exit p0

    return-void

    :goto_6b
    monitor-exit p0
    :try_end_6c
    .catchall {:try_start_1 .. :try_end_6c} :catchall_67

    throw v0
.end method

.method public final onAccuracyChanged(Landroid/hardware/Sensor;I)V
    .registers 3

    return-void
.end method

.method public final onSensorChanged(Landroid/hardware/SensorEvent;)V
    .registers 11

    sget-object v0, Lz5/so;->P5:Lz5/no;

    .line 1
    sget-object v1, Lz5/xk;->d:Lz5/xk;

    iget-object v2, v1, Lz5/xk;->c:Lcom/google/android/gms/internal/ads/g0;

    .line 2
    invoke-virtual {v2, v0}, Lcom/google/android/gms/internal/ads/g0;->a(Lz5/no;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Boolean;

    invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v0

    if-eqz v0, :cond_a4

    iget-object p1, p1, Landroid/hardware/SensorEvent;->values:[F

    const/4 v0, 0x0

    aget v2, p1, v0

    const v3, 0x411ce80a

    div-float/2addr v2, v3

    const/4 v4, 0x1

    aget v5, p1, v4

    div-float/2addr v5, v3

    const/4 v6, 0x2

    aget p1, p1, v6

    div-float/2addr p1, v3

    mul-float/2addr v2, v2

    mul-float/2addr v5, v5

    add-float/2addr v5, v2

    mul-float/2addr p1, p1

    add-float/2addr p1, v5

    float-to-double v2, p1

    invoke-static {v2, v3}, Ljava/lang/Math;->sqrt(D)D

    move-result-wide v2

    sget-object p1, Lz5/so;->Q5:Lz5/no;

    double-to-float v2, v2

    .line 3
    iget-object v3, v1, Lz5/xk;->c:Lcom/google/android/gms/internal/ads/g0;

    .line 4
    invoke-virtual {v3, p1}, Lcom/google/android/gms/internal/ads/g0;->a(Lz5/no;)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Ljava/lang/Float;

    invoke-virtual {p1}, Ljava/lang/Float;->floatValue()F

    move-result p1

    cmpg-float p1, v2, p1

    if-gez p1, :cond_41

    return-void

    :cond_41
    invoke-static {}, Lcom/google/android/gms/ads/internal/zzt;->zzj()Lu5/c;

    move-result-object p1

    invoke-interface {p1}, Lu5/c;->b()J

    move-result-wide v2

    iget-wide v5, p0, Lcom/google/android/gms/internal/ads/q3;->d:J

    sget-object p1, Lz5/so;->R5:Lz5/no;

    .line 5
    iget-object v7, v1, Lz5/xk;->c:Lcom/google/android/gms/internal/ads/g0;

    .line 6
    invoke-virtual {v7, p1}, Lcom/google/android/gms/internal/ads/g0;->a(Lz5/no;)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Ljava/lang/Integer;

    invoke-virtual {p1}, Ljava/lang/Integer;->intValue()I

    move-result p1

    int-to-long v7, p1

    add-long/2addr v5, v7

    cmp-long p1, v5, v2

    if-lez p1, :cond_60

    return-void

    :cond_60
    iget-wide v5, p0, Lcom/google/android/gms/internal/ads/q3;->d:J

    sget-object p1, Lz5/so;->S5:Lz5/no;

    .line 7
    iget-object v7, v1, Lz5/xk;->c:Lcom/google/android/gms/internal/ads/g0;

    .line 8
    invoke-virtual {v7, p1}, Lcom/google/android/gms/internal/ads/g0;->a(Lz5/no;)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Ljava/lang/Integer;

    invoke-virtual {p1}, Ljava/lang/Integer;->intValue()I

    move-result p1

    int-to-long v7, p1

    add-long/2addr v5, v7

    cmp-long p1, v5, v2

    if-gez p1, :cond_78

    iput v0, p0, Lcom/google/android/gms/internal/ads/q3;->e:I

    :cond_78
    const-string p1, "Shake detected."

    invoke-static {p1}, Lcom/google/android/gms/ads/internal/util/zze;->zza(Ljava/lang/String;)V

    iput-wide v2, p0, Lcom/google/android/gms/internal/ads/q3;->d:J

    iget p1, p0, Lcom/google/android/gms/internal/ads/q3;->e:I

    add-int/2addr p1, v4

    iput p1, p0, Lcom/google/android/gms/internal/ads/q3;->e:I

    iget-object v0, p0, Lcom/google/android/gms/internal/ads/q3;->f:Lz5/rr0;

    if-eqz v0, :cond_a4

    sget-object v2, Lz5/so;->T5:Lz5/no;

    .line 9
    iget-object v1, v1, Lz5/xk;->c:Lcom/google/android/gms/internal/ads/g0;

    .line 10
    invoke-virtual {v1, v2}, Lcom/google/android/gms/internal/ads/g0;->a(Lz5/no;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/Integer;

    invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I

    move-result v1

    if-ne p1, v1, :cond_a4

    new-instance p1, Lcom/google/android/gms/internal/ads/n3;

    check-cast v0, Lz5/pr0;

    invoke-direct {p1}, Lcom/google/android/gms/internal/ads/n3;-><init>()V

    sget-object v1, Lcom/google/android/gms/internal/ads/p3;->t:Lcom/google/android/gms/internal/ads/p3;

    invoke-virtual {v0, p1, v1}, Lz5/pr0;->c(Lcom/google/android/gms/internal/ads/b0;Lcom/google/android/gms/internal/ads/p3;)V

    :cond_a4
    return-void
.end method
