FingerprintManagerCompatApi23.java 5.23 KB
package android.support.v4.hardware.fingerprint;

import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintManager.AuthenticationCallback;
import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
import android.hardware.fingerprint.FingerprintManager.CryptoObject;
import android.os.CancellationSignal;
import android.os.Handler;
import android.support.annotation.RequiresApi;
import android.support.annotation.RestrictTo;
import java.security.Signature;
import javax.crypto.Cipher;
import javax.crypto.Mac;

@TargetApi(23)
@RequiresApi(23)
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public final class FingerprintManagerCompatApi23
{
  private static FingerprintManager a(Context paramContext)
  {
    if (paramContext.getPackageManager().hasSystemFeature("android.hardware.fingerprint")) {
      return (FingerprintManager)paramContext.getSystemService(FingerprintManager.class);
    }
    return null;
  }
  
  public static void authenticate(Context paramContext, CryptoObject paramCryptoObject, int paramInt, Object paramObject, AuthenticationCallback paramAuthenticationCallback, Handler paramHandler)
  {
    FingerprintManager localFingerprintManager = a(paramContext);
    if (localFingerprintManager != null)
    {
      if (paramCryptoObject == null) {
        break label101;
      }
      if (paramCryptoObject.getCipher() == null) {
        break label57;
      }
      paramContext = new FingerprintManager.CryptoObject(paramCryptoObject.getCipher());
    }
    for (;;)
    {
      localFingerprintManager.authenticate(paramContext, (CancellationSignal)paramObject, paramInt, new FingerprintManager.AuthenticationCallback()
      {
        public final void onAuthenticationError(int paramAnonymousInt, CharSequence paramAnonymousCharSequence)
        {
          this.a.onAuthenticationError(paramAnonymousInt, paramAnonymousCharSequence);
        }
        
        public final void onAuthenticationFailed()
        {
          this.a.onAuthenticationFailed();
        }
        
        public final void onAuthenticationHelp(int paramAnonymousInt, CharSequence paramAnonymousCharSequence)
        {
          this.a.onAuthenticationHelp(paramAnonymousInt, paramAnonymousCharSequence);
        }
        
        public final void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult paramAnonymousAuthenticationResult)
        {
          this.a.onAuthenticationSucceeded(new FingerprintManagerCompatApi23.AuthenticationResultInternal(FingerprintManagerCompatApi23.a(paramAnonymousAuthenticationResult.getCryptoObject())));
        }
      }, paramHandler);
      return;
      label57:
      if (paramCryptoObject.getSignature() != null) {
        paramContext = new FingerprintManager.CryptoObject(paramCryptoObject.getSignature());
      } else if (paramCryptoObject.getMac() != null) {
        paramContext = new FingerprintManager.CryptoObject(paramCryptoObject.getMac());
      } else {
        label101:
        paramContext = null;
      }
    }
  }
  
  public static boolean hasEnrolledFingerprints(Context paramContext)
  {
    paramContext = a(paramContext);
    return (paramContext != null) && (paramContext.hasEnrolledFingerprints());
  }
  
  public static boolean isHardwareDetected(Context paramContext)
  {
    paramContext = a(paramContext);
    return (paramContext != null) && (paramContext.isHardwareDetected());
  }
  
  public static abstract class AuthenticationCallback
  {
    public void onAuthenticationError(int paramInt, CharSequence paramCharSequence) {}
    
    public void onAuthenticationFailed() {}
    
    public void onAuthenticationHelp(int paramInt, CharSequence paramCharSequence) {}
    
    public void onAuthenticationSucceeded(FingerprintManagerCompatApi23.AuthenticationResultInternal paramAuthenticationResultInternal) {}
  }
  
  public static final class AuthenticationResultInternal
  {
    private FingerprintManagerCompatApi23.CryptoObject a;
    
    public AuthenticationResultInternal(FingerprintManagerCompatApi23.CryptoObject paramCryptoObject)
    {
      this.a = paramCryptoObject;
    }
    
    public final FingerprintManagerCompatApi23.CryptoObject getCryptoObject()
    {
      return this.a;
    }
  }
  
  public static class CryptoObject
  {
    private final Signature a;
    private final Cipher b;
    private final Mac c;
    
    public CryptoObject(Signature paramSignature)
    {
      this.a = paramSignature;
      this.b = null;
      this.c = null;
    }
    
    public CryptoObject(Cipher paramCipher)
    {
      this.b = paramCipher;
      this.a = null;
      this.c = null;
    }
    
    public CryptoObject(Mac paramMac)
    {
      this.c = paramMac;
      this.b = null;
      this.a = null;
    }
    
    public Cipher getCipher()
    {
      return this.b;
    }
    
    public Mac getMac()
    {
      return this.c;
    }
    
    public Signature getSignature()
    {
      return this.a;
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/hardware/fingerprint/FingerprintManagerCompatApi23.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */