package com.google.android.gms.vision.face; import android.content.res.AssetManager; import android.os.RemoteException; import com.google.android.gms.internal.vision.zzbo; import com.google.android.gms.internal.vision.zzca; import com.google.android.gms.internal.vision.zzfk; import com.google.android.gms.internal.vision.zzgf; import com.google.android.gms.vision.L; import java.nio.ByteBuffer; /* loaded from: classes2.dex */ public class FaceDetectorV2Jni { private final zzfk zzco; public FaceDetectorV2Jni() { zzfk zzej = zzfk.zzej(); this.zzco = zzej; zzej.zza(zzca.zziv); } public native void closeDetectorJni(long j); public native byte[] detectFacesImageByteArrayJni(long j, byte[] bArr, byte[] bArr2); public native byte[] detectFacesImageByteBufferJni(long j, ByteBuffer byteBuffer, byte[] bArr); public native long initDetectorJni(byte[] bArr, AssetManager assetManager); /* JADX INFO: Access modifiers changed from: package-private */ public final long zza(zzca.zzd zzdVar, AssetManager assetManager) { L.zza("FaceDetectorV2Jni", "initialize.start()"); long initDetectorJni = initDetectorJni(zzdVar.toByteArray(), assetManager); L.zza("FaceDetectorV2Jni", "initialize.end()"); return initDetectorJni; } /* JADX INFO: Access modifiers changed from: package-private */ public final zzca.zzc zza(long j, ByteBuffer byteBuffer, zzbo zzboVar) throws RemoteException { L.zza("FaceDetectorV2Jni", "detectFacesImageByteBuffer.start()"); zzca.zzc zzcVar = null; try { byte[] detectFacesImageByteBufferJni = detectFacesImageByteBufferJni(j, byteBuffer, zzboVar.toByteArray()); if (detectFacesImageByteBufferJni != null && detectFacesImageByteBufferJni.length > 0) { zzcVar = zzca.zzc.zza(detectFacesImageByteBufferJni, this.zzco); } } catch (zzgf e) { Object[] objArr = new Object[1]; String valueOf = String.valueOf(e.getMessage()); objArr[0] = valueOf.length() != 0 ? "detectFacesImageByteBuffer failed to parse result: ".concat(valueOf) : new String("detectFacesImageByteBuffer failed to parse result: "); L.zzc("FaceDetectorV2Jni", objArr); } L.zza("FaceDetectorV2Jni", "detectFacesImageByteBuffer.end()"); return zzcVar; } /* JADX INFO: Access modifiers changed from: package-private */ public final zzca.zzc zza(long j, byte[] bArr, zzbo zzboVar) throws RemoteException { L.zza("FaceDetectorV2Jni", "detectFacesImageByteArray.start()"); zzca.zzc zzcVar = null; try { byte[] detectFacesImageByteArrayJni = detectFacesImageByteArrayJni(j, bArr, zzboVar.toByteArray()); if (detectFacesImageByteArrayJni != null && detectFacesImageByteArrayJni.length > 0) { zzcVar = zzca.zzc.zza(detectFacesImageByteArrayJni, this.zzco); } } catch (zzgf e) { Object[] objArr = new Object[1]; String valueOf = String.valueOf(e.getMessage()); objArr[0] = valueOf.length() != 0 ? "detectFacesImageByteArray failed to parse result: ".concat(valueOf) : new String("detectFacesImageByteArray failed to parse result: "); L.zzc("FaceDetectorV2Jni", objArr); } L.zza("FaceDetectorV2Jni", "detectFacesImageByteArray.end()"); return zzcVar; } /* JADX INFO: Access modifiers changed from: package-private */ public final void zza(long j) throws RemoteException { L.zza("FaceDetectorV2Jni", "closeDetector.start()"); closeDetectorJni(j); L.zza("FaceDetectorV2Jni", "closeDetector.end()"); } }