package com.tealium.library;

import android.app.Activity;
import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.hardware.SensorManager;

final class y
  implements e, m, n, q
{
  private final Context a;
  private final BroadcastReceiver b;
  private final BroadcastReceiver c;
  private final J d;
  private final SensorManager e;
  private final V f;
  private boolean g;
  private boolean h;
  private boolean i;

  y(V paramV, Tealium.Config paramConfig)
  {
    this.f = paramV;
    this.a = paramConfig.g().getApplicationContext();
    this.d = new J(paramConfig.l());
    this.e = ((SensorManager)this.a.getSystemService("sensor"));
    this.g = false;
    this.h = false;
    this.i = false;
    this.b = new BroadcastReceiver()
    {
      public final void onReceive(Context paramAnonymousContext, Intent paramAnonymousIntent)
      {
        d.g();
      }
    };
    this.c = new BroadcastReceiver()
    {
      public final void onReceive(Context paramAnonymousContext, Intent paramAnonymousIntent)
      {
        y.a(y.this).a(2 * paramAnonymousIntent.getIntExtra("SHAKE_COUNT", 1));
      }
    };
  }

  private void d()
  {
    if (this.h);
    while (!this.f.f())
      return;
    this.e.registerListener(this.d, this.e.getDefaultSensor(1), 3);
    this.h = true;
  }

  private void e()
  {
    if (!this.h)
      return;
    this.e.unregisterListener(this.d);
    this.h = false;
  }

  private void f()
  {
    if (!this.g)
      return;
    this.a.unregisterReceiver(this.b);
    this.a.unregisterReceiver(this.c);
    this.g = false;
  }

  public final void a()
  {
    if (this.g)
      f();
    e();
  }

  public final void a(Activity paramActivity)
  {
    this.i = false;
    f();
    e();
  }

  public final void b()
  {
    if (this.i)
      d();
  }

  public final void b(Activity paramActivity)
  {
    this.i = true;
    if (!this.g)
    {
      this.a.registerReceiver(this.b, new IntentFilter("tealium.library.action.LAUNCH_MOBILE_COMPANION"));
      this.a.registerReceiver(this.c, new IntentFilter("tealium.library.action.SHAKE_EVENT"));
      this.g = true;
    }
    d();
  }

  final J c()
  {
    return this.d;
  }

  protected final void finalize()
    throws Throwable
  {
    a();
    super.finalize();
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.tealium.library.y
 * JD-Core Version:    0.6.2
 */