dl.java 3.42 KB
import android.annotation.TargetApi;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.media.AudioManager;
import android.media.RemoteControlClient;
import android.media.RemoteControlClient.OnPlaybackPositionUpdateListener;
import android.os.SystemClock;
import android.support.annotation.RequiresApi;
import android.util.Log;

@TargetApi(18)
@RequiresApi(18)
public final class dl
{
  private static boolean a = true;
  
  public static int a(long paramLong)
  {
    int j = dk.a(paramLong);
    int i = j;
    if ((0x100 & paramLong) != 0L) {
      i = j | 0x100;
    }
    return i;
  }
  
  public static Object a(dl.a parama)
  {
    return new dl.b(parama);
  }
  
  public static void a(Context paramContext, PendingIntent paramPendingIntent, ComponentName paramComponentName)
  {
    paramContext = (AudioManager)paramContext.getSystemService("audio");
    if (a) {}
    try
    {
      paramContext.registerMediaButtonEventReceiver(paramPendingIntent);
      if (!a) {
        paramContext.registerMediaButtonEventReceiver(paramComponentName);
      }
      return;
    }
    catch (NullPointerException paramPendingIntent)
    {
      for (;;)
      {
        Log.w("MediaSessionCompatApi18", "Unable to register media button event receiver with PendingIntent, falling back to ComponentName.");
        a = false;
      }
    }
  }
  
  public static void a(Object paramObject, int paramInt, long paramLong1, float paramFloat, long paramLong2)
  {
    long l2 = 0L;
    long l3 = SystemClock.elapsedRealtime();
    long l1 = paramLong1;
    if (paramInt == 3)
    {
      l1 = paramLong1;
      if (paramLong1 > 0L)
      {
        l1 = l2;
        if (paramLong2 > 0L)
        {
          paramLong2 = l3 - paramLong2;
          l1 = paramLong2;
          if (paramFloat > 0.0F)
          {
            l1 = paramLong2;
            if (paramFloat != 1.0F) {
              l1 = ((float)paramLong2 * paramFloat);
            }
          }
        }
        l1 = paramLong1 + l1;
      }
    }
    paramInt = dk.a(paramInt);
    ((RemoteControlClient)paramObject).setPlaybackState(paramInt, l1, paramFloat);
  }
  
  public static void a(Object paramObject, long paramLong)
  {
    ((RemoteControlClient)paramObject).setTransportControlFlags(a(paramLong));
  }
  
  public static void a(Object paramObject1, Object paramObject2)
  {
    ((RemoteControlClient)paramObject1).setPlaybackPositionUpdateListener((RemoteControlClient.OnPlaybackPositionUpdateListener)paramObject2);
  }
  
  public static void b(Context paramContext, PendingIntent paramPendingIntent, ComponentName paramComponentName)
  {
    paramContext = (AudioManager)paramContext.getSystemService("audio");
    if (a)
    {
      paramContext.unregisterMediaButtonEventReceiver(paramPendingIntent);
      return;
    }
    paramContext.unregisterMediaButtonEventReceiver(paramComponentName);
  }
  
  public static abstract interface a
  {
    public abstract void b(long paramLong);
  }
  
  static final class b<T extends dl.a>
    implements RemoteControlClient.OnPlaybackPositionUpdateListener
  {
    protected final T a;
    
    public b(T paramT)
    {
      this.a = paramT;
    }
    
    public final void onPlaybackPositionUpdate(long paramLong)
    {
      this.a.b(paramLong);
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/dl.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */