package com.google.android.m4b.maps.bl;

import android.os.SystemClock;
import com.google.android.m4b.maps.am.a;
import com.google.android.m4b.maps.bk.b;
import com.google.common.annotations.VisibleForTesting;

public final class n
  implements aj
{
  static final int a;
  final b b;
  private int c;
  private long d;
  private int e;
  private boolean f;
  private boolean g;
  private boolean h;
  private int i;
  private int j;
  private int k;

  @VisibleForTesting
  private a l;
  private boolean m = false;

  static
  {
    if (a.a());
    for (int n = 16; ; n = 20)
    {
      a = n;
      return;
    }
  }

  public n(b paramb)
  {
    c(a);
    this.b = paramb;
  }

  private void c(int paramInt)
  {
    this.e = Math.max(a, paramInt);
  }

  public final void a()
  {
    this.c = 0;
    this.d = SystemClock.elapsedRealtime();
  }

  public final void a(long paramLong)
  {
    try
    {
      if (this.l != null)
        this.l.a(paramLong);
      return;
    }
    finally
    {
    }
  }

  public final void a(boolean paramBoolean)
  {
    this.f = paramBoolean;
  }

  public final void a(boolean paramBoolean1, boolean paramBoolean2)
  {
    if (paramBoolean1);
    try
    {
      c(true);
      if (this.l != null)
      {
        if (paramBoolean2)
          this.l.d();
        this.l.e();
      }
      return;
    }
    finally
    {
    }
  }

  public final boolean a(int paramInt)
  {
    int n = paramInt + this.c;
    if ((this.c == 0) || (n <= 35000))
    {
      this.c = n;
      return true;
    }
    return false;
  }

  public final void b()
  {
    int n = 5 + (int)(SystemClock.elapsedRealtime() - this.d);
    int i1;
    int i2;
    if (this.f)
    {
      i1 = a;
      if (this.g)
        i1 += 500;
      i2 = Math.max(i1, 15);
    }
    while (true)
    {
      float f1;
      try
      {
        if (this.l != null)
        {
          this.l.c();
          if (this.h)
            continue;
          if (this.f)
          {
            this.l.e();
            this.l.a(i2);
          }
        }
        else
        {
          if ((!this.g) && (!this.f))
          {
            this.i = (n + this.i);
            this.j = (i2 + this.j);
            int i3 = 1 + this.k;
            this.k = i3;
            if (i3 == 20)
            {
              f1 = (this.j - this.i) / this.j;
              if (f1 >= 0.23F)
                break label261;
              c((int)(1.1F * this.e));
              this.k = 0;
              this.i = 0;
              this.j = 0;
            }
          }
          return;
          i1 = this.e;
          break;
        }
        if (this.l.g() == 9223372036854775807L)
          continue;
        i2 = (int)(this.l.g() - SystemClock.uptimeMillis());
        continue;
        this.l.d();
        this.h = false;
        continue;
      }
      finally
      {
      }
      label261: if (f1 > 0.37F)
        c((int)(0.9F * this.e));
    }
  }

  public final void b(int paramInt)
  {
    this.c = (paramInt + this.c);
  }

  public final void b(boolean paramBoolean)
  {
    this.g = paramBoolean;
  }

  public final void c()
  {
    try
    {
      this.h = true;
      if (this.l != null)
        this.l.d();
      return;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public final void c(boolean paramBoolean)
  {
    try
    {
      this.m = true;
      return;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public final void d()
  {
    try
    {
      if (this.l != null)
        this.l.a();
      while (true)
      {
        return;
        this.b.u();
      }
    }
    finally
    {
    }
  }

  public final void e()
  {
    try
    {
      this.l = new a();
      this.l.start();
      return;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public final void f()
  {
    try
    {
      if (this.l != null)
      {
        this.l.b();
        this.l = null;
      }
      return;
    }
    finally
    {
    }
  }

  public final boolean g()
  {
    try
    {
      boolean bool = this.m;
      this.m = false;
      return bool;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public final boolean h()
  {
    try
    {
      a locala = this.l;
      if ((locala == null) || (a.a(locala)))
        return true;
    }
    finally
    {
    }
    return false;
  }

  @VisibleForTesting
  final class a extends b
  {
    private volatile boolean a = true;
    private volatile int b = n.a;
    private volatile boolean c = false;
    private boolean d = false;
    private long e = 9223372036854775807L;

    public a()
    {
      super();
    }

    public final void a()
    {
      try
      {
        n.this.b.u();
        return;
      }
      finally
      {
        localObject = finally;
        throw localObject;
      }
    }

    public final void a(int paramInt)
    {
      if ((this.b != paramInt) && (paramInt > 15))
      {
        this.b = paramInt;
        this.c = true;
        interrupt();
      }
    }

    public final void a(long paramLong)
    {
      try
      {
        this.e = paramLong;
        return;
      }
      finally
      {
        localObject = finally;
        throw localObject;
      }
    }

    public final void b()
    {
      this.a = false;
      interrupt();
    }

    public final int c()
    {
      return this.b;
    }

    public final void d()
    {
      e();
      interrupt();
    }

    public final void e()
    {
      try
      {
        if (n.this.b != null)
          n.this.b.v();
        this.d = true;
        return;
      }
      finally
      {
      }
    }

    public final void f()
    {
      while (true)
      {
        if (this.a);
        try
        {
          label20: 
          do
          {
            this.c = false;
            sleep(this.b);
          }
          while (this.c);
          try
          {
            if ((this.d) || (this.e <= SystemClock.uptimeMillis()))
            {
              this.d = false;
              this.e = 9223372036854775807L;
              n.this.b.u();
            }
            continue;
          }
          finally
          {
          }
          return;
        }
        catch (InterruptedException localInterruptedException)
        {
          break label20;
        }
      }
    }

    public final long g()
    {
      try
      {
        long l = this.e;
        return l;
      }
      finally
      {
        localObject = finally;
        throw localObject;
      }
    }
  }

  public static abstract interface b
  {
    public abstract void u();

    public abstract void v();
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.google.android.m4b.maps.bl.n
 * JD-Core Version:    0.6.2
 */