package com.google.zxing.client.android; import android.app.Activity; import android.graphics.Bitmap; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.Message; import com.google.zxing.DecodeHintType; import com.google.zxing.MultiFormatReader; import com.google.zxing.PlanarYUVLuminanceSource; import java.io.ByteArrayOutputStream; import java.util.Map; /* loaded from: classes.dex */ final class DecodeHandler extends Handler { private static final String d = DecodeHandler.class.getSimpleName(); private final ICaptureView a; private boolean c = true; private final MultiFormatReader b = new MultiFormatReader(); DecodeHandler(Activity activity, ICaptureView iCaptureView, Map map) { this.b.a((Map) map); this.a = iCaptureView; } /* JADX WARN: Removed duplicated region for block: B:15:0x0072 */ /* JADX WARN: Removed duplicated region for block: B:9:0x003b */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ private void a(byte[] r8, int r9, int r10) { /* r7 = this; long r0 = java.lang.System.currentTimeMillis() com.google.zxing.client.android.ICaptureView r2 = r7.a com.google.zxing.client.android.camera.CameraManager r2 = r2.b0() com.google.zxing.PlanarYUVLuminanceSource r8 = r2.a(r8, r9, r10) if (r8 == 0) goto L32 com.google.zxing.BinaryBitmap r9 = new com.google.zxing.BinaryBitmap com.google.zxing.common.HybridBinarizer r10 = new com.google.zxing.common.HybridBinarizer r10.(r8) r9.(r10) com.google.zxing.MultiFormatReader r10 = r7.b // Catch: java.lang.Throwable -> L26 com.google.zxing.ReaderException -> L2d com.google.zxing.Result r9 = r10.a(r9) // Catch: java.lang.Throwable -> L26 com.google.zxing.ReaderException -> L2d com.google.zxing.MultiFormatReader r10 = r7.b r10.reset() goto L33 L26: r8 = move-exception com.google.zxing.MultiFormatReader r9 = r7.b r9.reset() throw r8 L2d: com.google.zxing.MultiFormatReader r9 = r7.b r9.reset() L32: r9 = 0 L33: com.google.zxing.client.android.ICaptureView r10 = r7.a android.os.Handler r10 = r10.getHandler() if (r9 == 0) goto L72 long r2 = java.lang.System.currentTimeMillis() java.lang.String r4 = com.google.zxing.client.android.DecodeHandler.d java.lang.StringBuilder r5 = new java.lang.StringBuilder r5.() java.lang.String r6 = "Found barcode in " r5.append(r6) long r2 = r2 - r0 r5.append(r2) java.lang.String r0 = " ms" r5.append(r0) java.lang.String r0 = r5.toString() android.util.Log.d(r4, r0) if (r10 == 0) goto L7d int r0 = com.google.zxing.client.android.R$id.decode_succeeded android.os.Message r9 = android.os.Message.obtain(r10, r0, r9) android.os.Bundle r10 = new android.os.Bundle r10.() a(r8, r10) r9.setData(r10) r9.sendToTarget() goto L7d L72: if (r10 == 0) goto L7d int r8 = com.google.zxing.client.android.R$id.decode_failed android.os.Message r8 = android.os.Message.obtain(r10, r8) r8.sendToTarget() L7d: return */ throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.client.android.DecodeHandler.a(byte[], int, int):void"); } @Override // android.os.Handler public void handleMessage(Message message) { if (message == null || !this.c) { return; } int i = message.what; if (i == R$id.decode) { a((byte[]) message.obj, message.arg1, message.arg2); } else if (i == R$id.quit) { this.c = false; Looper.myLooper().quit(); } } private static void a(PlanarYUVLuminanceSource planarYUVLuminanceSource, Bundle bundle) { int[] h = planarYUVLuminanceSource.h(); int g = planarYUVLuminanceSource.g(); Bitmap createBitmap = Bitmap.createBitmap(h, 0, g, g, planarYUVLuminanceSource.f(), Bitmap.Config.ARGB_8888); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); createBitmap.compress(Bitmap.CompressFormat.JPEG, 50, byteArrayOutputStream); bundle.putByteArray("barcode_bitmap", byteArrayOutputStream.toByteArray()); bundle.putFloat("barcode_scaled_factor", g / planarYUVLuminanceSource.c()); } }