QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 CaptureActivityImpl.java 源代码,内容仅作参考
package com.tencent.mtt.external.qrcode;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.hardware.Camera;
import android.media.ExifInterface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.SurfaceHolder;
import com.tencent.common.http.ContentType;
import com.tencent.common.http.NetUtils;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.common.utils.FileUtils;
import com.tencent.common.utils.StringUtils;
import com.tencent.common.utils.UrlUtils;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.R;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.utils.DeviceUtils;
import com.tencent.mtt.base.utils.QBUrlUtils;
import com.tencent.mtt.browser.memstat.facade.IMemoryUsageStatService;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.businesscenter.facade.IInternalDispatchServer;
import com.tencent.mtt.compliance.MethodDelegate;
import com.tencent.mtt.external.explorerone.camera.utils.ARDataHelper;
import com.tencent.mtt.external.qrcode.Intents;
import com.tencent.mtt.external.qrcode.common.ActionConstants2;
import com.tencent.mtt.external.qrcode.common.AddressBookParsedResult;
import com.tencent.mtt.external.qrcode.common.AddressBookResultHandler;
import com.tencent.mtt.external.qrcode.common.BeepManager;
import com.tencent.mtt.external.qrcode.common.ResultHandler;
import com.tencent.mtt.external.qrcode.common.ResultHandlerFactory;
import com.tencent.mtt.external.qrcode.common.URIParsedResult;
import com.tencent.mtt.external.qrcode.common.URIResultHandler;
import com.tencent.mtt.external.qrcode.common.WifiParsedResult;
import com.tencent.mtt.external.qrcode.common.WifiResultHandler;
import com.tencent.mtt.external.qrcode.inhost.AddressResultActivity;
import com.tencent.mtt.external.qrcode.inhost.ICaptureActivityImpl;
import com.tencent.mtt.external.qrcode.inhost.IQrCodeCamera;
import com.tencent.mtt.external.qrcode.inhost.IQrCodeScanProxy;
import com.tencent.mtt.external.qrcode.inhost.NormalResultActivity;
import com.tencent.mtt.external.qrcode.inhost.ParsedResultType;
import com.tencent.mtt.external.qrcode.inhost.QRCodeHostProxy;
import com.tencent.mtt.external.weapp.facade.IWeAppService;
import com.tencent.mtt.hippy.qb.views.base.ITextInputController;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.qbinfo.IQConfigure;
import com.tencent.mtt.video.internal.facade.IVideoService;
import com.tencent.mtt.view.toast.MttToaster;
import com.tencent.qbar.QBarManager;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Vector;
import qb.a.a;
import qb.a.f;
public class CaptureActivityImpl implements SurfaceHolder.Callback, ICaptureActivityImpl {
public static final String ONECODE_URL = "https://ec.html5.qq.com/good?barcode=";
public static final int REQ_CODE_PICTURES = 100;
Bundle f56350a;
private CaptureActivityHandler e;
private boolean f;
private Source g;
private String h;
private Vector<BarcodeFormat> i;
private String j;
private BeepManager k;
public Camera mCamera;
public CompatibleClass mDetectLed;
public SurfaceHolder mHolder;
public String mPID;
private boolean f56352c = false;
private boolean f56353d = false;
IQrCodeCamera f56351b = null;
public Handler mHandler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message message) {
int i = message.what;
if (i == 0) {
CaptureActivityImpl.this.finish(true);
} else {
if (i != 1) {
return;
}
CaptureActivityImpl.this.showErrorDialog();
}
}
};
public Handler mThreadHandler = null;
public Bitmap decodeBitmap = null;
public byte[] decodeBytes = null;
public int mRotateAngle = 0;
public boolean haveLed = false;
public boolean isLightOn = false;
private boolean m = false;
public int mScanMode = 0;
private int n = MttResources.h(f.Y);
private int o = MttResources.h(f.aA);
private Activity l = ActivityHandler.b().a();
public enum Source {
NATIVE_APP_INTENT,
PRODUCT_SEARCH_LINK,
ZXING_LINK,
NONE
}
public void a(int i, int i2) {
IQrCodeScanProxy c2 = QRCodeHostProxy.c();
if (c2 != null) {
c2.a(i, i2);
if (c2.j() == 12) {
c2.a(2);
} else {
c2.a(2, this.decodeBytes, 256, i, i2, 0);
}
}
}
private void a(Activity activity) {
BeepManager beepManager = this.k;
if (beepManager != null) {
beepManager.a();
} else {
this.k = new BeepManager(activity, false);
}
}
private void a(Bundle bundle) {
Intent intent = new Intent();
intent.putExtras(bundle);
this.l.setResult(-1, intent);
finish(true);
}
private void a(String str) {
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(str).b(1).f(133).c(4).a((Bundle) null));
finish(true);
}
private void a(String str, String str2, ResultHandler resultHandler, Bitmap bitmap) {
Intent intent;
if (QRCodeHostProxy.c() != null ? QRCodeHostProxy.c().a(true, str, str2, resultHandler, bitmap) : false) {
QrCodeManager.a().c();
} else {
if (resultHandler.g().equals(ParsedResultType.URI) && (resultHandler instanceof URIResultHandler)) {
URIParsedResult uRIParsedResult = (URIParsedResult) resultHandler.d();
if (uRIParsedResult == null) {
return;
}
String a2 = uRIParsedResult.a();
if (a2 != null) {
ArrayList<String> f = StringUtils.f(a2);
try {
if (QBUrlUtils.n(a2)) {
a(a2);
finish(true);
return;
}
if (b(a2)) {
MttToaster.show(MttResources.l(R.string.sj), 1);
QrCodeManager.a().d();
return;
}
if (QBUrlUtils.m(a2)) {
((IWeAppService) QBContext.getInstance().getService(IWeAppService.class)).launchMobikeWeApp(a2, "711");
finish(true);
return;
}
if (((IInternalDispatchServer) QBContext.getInstance().getService(IInternalDispatchServer.class)).lunchCustomUrl(a2, false)) {
finish(true);
return;
}
if (a2 != null && (a2.startsWith(NetUtils.SCHEME_HTTP) || a2.startsWith(NetUtils.SCHEME_HTTPS) || a2.startsWith("qb://"))) {
a(a2);
finish(true);
return;
} else if (f.size() > 0) {
IQrCodeScanProxy c2 = QRCodeHostProxy.c();
if (c2 != null) {
c2.n();
}
if (this.e != null) {
this.e.sendEmptyMessage(R.id.restart_preview);
return;
}
return;
}
} catch (NoClassDefFoundError unused) {
}
}
} else if (resultHandler.g().equals(ParsedResultType.ADDRESSBOOK) && (resultHandler instanceof AddressBookResultHandler)) {
AddressBookParsedResult addressBookParsedResult = (AddressBookParsedResult) ((AddressBookResultHandler) resultHandler).d();
String[] j = addressBookParsedResult.j();
String str3 = null;
String str4 = (j == null || j.length < 1) ? null : j[0];
String[] k = addressBookParsedResult.k();
if (k != null && k.length >= 1) {
str3 = k[0];
}
Intent intent2 = new Intent(this.l, (Class<?>) AddressResultActivity.class);
Bundle bundle = new Bundle();
bundle.putStringArray("qrname", addressBookParsedResult.a());
bundle.putString("qrpronunciation", addressBookParsedResult.b());
bundle.putStringArray("qrphonenumbers", addressBookParsedResult.d());
bundle.putStringArray("qrphonetypes", addressBookParsedResult.e());
bundle.putStringArray("qremails", addressBookParsedResult.f());
bundle.putStringArray("qrpemailtypes", addressBookParsedResult.g());
bundle.putString("qrnotes", addressBookParsedResult.i());
bundle.putString("qrinstantmess", addressBookParsedResult.h());
bundle.putString("qraddress1", str4);
bundle.putString("qraddress1type", str3);
bundle.putString("qrorg", addressBookParsedResult.m());
bundle.putString("qrtitle", addressBookParsedResult.l());
bundle.putString("qrurl", addressBookParsedResult.n());
bundle.putString("qrbirthday", addressBookParsedResult.o());
bundle.putCharSequence("qrcontent", resultHandler.b());
intent2.putExtras(bundle);
this.l.startActivity(intent2);
this.l.overridePendingTransition(a.f85867d, a.s);
} else {
if (resultHandler.g().equals(ParsedResultType.EXPRESS)) {
if (TextUtils.isEmpty(str2) || !str2.contains("CODE_")) {
IQrCodeScanProxy c3 = QRCodeHostProxy.c();
if (c3 != null) {
c3.a(2, resultHandler.b().toString());
}
finish(false);
return;
}
StringBuilder sb = new StringBuilder("qb://weapp/?package=kuaidi100");
sb.append("&title=%e5%bf%ab%e9%80%92100&entry=75052&appid=124&pagepath=pages%2fresult%2fresult.html%3fnu%3d" + resultHandler.b().toString());
a(sb.toString());
return;
}
if (resultHandler.g().equals(ParsedResultType.ISBN) || resultHandler.g().equals(ParsedResultType.PRODUCT)) {
IQrCodeScanProxy c4 = QRCodeHostProxy.c();
if (c4 != null) {
c4.a(2, resultHandler.b().toString());
}
finish(false);
return;
}
if (resultHandler.g().equals(ParsedResultType.WIFI) && (resultHandler instanceof WifiResultHandler)) {
WifiParsedResult wifiParsedResult = (WifiParsedResult) ((WifiResultHandler) resultHandler).d();
wifiParsedResult.a();
wifiParsedResult.d();
wifiParsedResult.b();
wifiParsedResult.e();
intent = new Intent(this.l, (Class<?>) NormalResultActivity.class);
Bundle bundle2 = new Bundle();
bundle2.putSerializable("qrtype", resultHandler.g());
bundle2.putCharSequence("qrcontent", resultHandler.b());
bundle2.putCharSequence("ssid", wifiParsedResult.a());
bundle2.putCharSequence(ITextInputController.KEYBOARD_TYPE_PASS_WORD, wifiParsedResult.d());
bundle2.putCharSequence("encryption", wifiParsedResult.b());
bundle2.putBoolean("hidden", wifiParsedResult.e());
intent.putExtras(bundle2);
this.l.startActivity(intent);
this.l.overridePendingTransition(a.f85867d, a.s);
}
}
String trim = resultHandler.b().toString().trim();
if (trim.toLowerCase().startsWith("kp_")) {
intent = new Intent(ActionConstants2.e, Uri.parse(UrlUtils.escapeAllChineseChar(UrlUtils.prepareUrl(String.format("https://tencent.kuaipai.cn/routing.html?key=%s&phonemodel=%s&phoneosversion=%s&appversion=%s&source=QQbrowser", trim, MethodDelegate.getModel().replaceAll("[ |\\/|\\_|\\&|\\|]", ""), Build.VERSION.RELEASE, IQConfigure.f69589b)))));
intent.setClass(this.l, ActivityHandler.f32417a);
this.l.startActivity(intent);
this.l.overridePendingTransition(a.f85867d, a.s);
} else {
Intent intent3 = new Intent(this.l, (Class<?>) NormalResultActivity.class);
Bundle bundle3 = new Bundle();
bundle3.putSerializable("qrtype", resultHandler.g());
bundle3.putCharSequence("qrcontent", resultHandler.b());
intent3.putExtras(bundle3);
this.l.startActivity(intent3);
this.l.overridePendingTransition(a.f85867d, a.s);
}
}
finish(true);
}
private void b() {
Activity a2 = ActivityHandler.b().a();
if (a2 == null) {
return;
}
a(a2);
Intent intent = a2.getIntent();
Vector<BarcodeFormat> vector = null;
String action = intent == null ? null : intent.getAction();
String dataString = intent == null ? null : intent.getDataString();
if (intent == null || action == null) {
this.g = Source.NONE;
this.i = null;
this.j = null;
return;
}
if (action.equals("com.tencent.mtt.zxing.SCAN")) {
this.g = Source.NATIVE_APP_INTENT;
this.i = DecodeFormatManager.a(intent);
if (intent.hasExtra(Intents.Scan.i) && intent.hasExtra(Intents.Scan.j)) {
int intExtra = intent.getIntExtra(Intents.Scan.i, 0);
int intExtra2 = intent.getIntExtra(Intents.Scan.j, 0);
if (intExtra > 0 && intExtra2 > 0) {
this.f56351b.b(intExtra, intExtra2);
}
}
} else {
if (dataString != null && dataString.contains("https://www.google") && dataString.contains("/m/products/scan")) {
this.g = Source.PRODUCT_SEARCH_LINK;
this.h = dataString;
vector = DecodeFormatManager.f56378a;
} else if (dataString == null || !dataString.startsWith("https://zxing.appspot.com/scan")) {
this.g = Source.NONE;
} else {
this.g = Source.ZXING_LINK;
this.h = dataString;
vector = DecodeFormatManager.a(Uri.parse(this.h));
}
this.i = vector;
}
this.j = intent.getStringExtra(Intents.Scan.h);
}
private boolean b(String str) {
String lowerCase;
return (str == null || TextUtils.isEmpty(str) || (lowerCase = str.trim().toLowerCase()) == null || !lowerCase.contains("u.wechat.com")) ? false : true;
}
public void c() {
Bitmap bitmap = this.decodeBitmap;
try {
if (bitmap == null) {
this.mHandler.sendEmptyMessage(1);
return;
}
final int width = bitmap.getWidth();
final int height = bitmap.getHeight();
final int[] iArr = new int[bitmap.getWidth() * bitmap.getHeight()];
bitmap.getPixels(iArr, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight());
IQrCodeScanProxy c2 = QRCodeHostProxy.c();
if (c2 != null ? c2.i() : false) {
QBarManager.loadPlugin(new QBarManager.QbarPluginListener() {
@Override
public void qbarPluginFailed() {
CaptureActivityImpl.this.a(width, height);
}
@Override
public void qbarPluginSuc() {
if (!ZxingUtils.decodePicScan(iArr, width, height, ActivityHandler.b().a()) && !ZxingUtils.decodePicScan(iArr, width, height, ActivityHandler.b().a())) {
CaptureActivityImpl.this.a(width, height);
} else {
StatManager.b().c("N68");
CaptureActivityImpl.this.mHandler.sendEmptyMessage(0);
}
}
});
} else {
a(width, height);
}
} catch (Exception | OutOfMemoryError unused) {
this.mHandler.sendEmptyMessage(1);
}
}
private void d() {
}
@Override
public void IOnActivityResult(int i, int i2, Intent intent) {
final Uri data;
if (this.mThreadHandler == null) {
this.mThreadHandler = new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what != 4) {
return;
}
CaptureActivityImpl.this.c();
}
};
}
if (i == 10 && i2 == -1) {
a(intent.getExtras());
}
if (i == 100) {
if (i2 == 0) {
IQrCodeScanProxy c2 = QRCodeHostProxy.c();
if (c2 != null) {
c2.h();
return;
}
return;
}
if (i2 != -1 || intent == null || (data = intent.getData()) == null) {
return;
}
boolean z = false;
if (!"file".equalsIgnoreCase(data.getScheme()) && !"content".equalsIgnoreCase(data.getScheme())) {
z = true;
}
if (z) {
return;
}
this.f56352c = true;
IQrCodeScanProxy c3 = QRCodeHostProxy.c();
if (c3 != null) {
c3.b(true);
}
final ContentResolver contentResolver = this.l.getContentResolver();
BrowserExecutorSupplier.postForBackgroundTasks(new BrowserExecutorSupplier.BackgroundRunable() {
@Override
public void doRun() {
Throwable th;
Cursor cursor;
byte[] bArr;
int i3;
Bitmap bitmap;
int columnIndex;
InputStream inputStream;
Object obj;
Object obj2;
BitmapFactory.Options options;
CaptureActivityImpl captureActivityImpl = CaptureActivityImpl.this;
captureActivityImpl.mRotateAngle = 0;
?? r2 = 0;
r2 = null;
Bitmap bitmap2 = null;
captureActivityImpl.decodeBytes = null;
try {
} catch (Throwable th2) {
r2 = captureActivityImpl;
th = th2;
}
try {
try {
try {
System.currentTimeMillis();
} catch (Exception unused) {
cursor = null;
bArr = null;
}
} catch (OutOfMemoryError unused2) {
cursor = null;
}
try {
try {
int maxScreenDimen = ZxingUtils.getMaxScreenDimen();
Activity activity = CaptureActivityImpl.this.l;
bitmap = data;
int calculateInSampleSize = ZxingUtils.calculateInSampleSize(activity, bitmap, maxScreenDimen);
try {
if (calculateInSampleSize <= 1) {
try {
options = new BitmapFactory.Options();
inputStream = contentResolver.openInputStream(data);
} catch (FileNotFoundException unused3) {
inputStream = null;
obj2 = null;
} catch (OutOfMemoryError unused4) {
inputStream = null;
bArr = null;
} catch (Throwable th3) {
th = th3;
inputStream = null;
obj = null;
}
try {
ByteBuffer a2 = FileUtils.a(inputStream);
bArr = new byte[a2.position()];
try {
try {
try {
a2.position(0);
a2.get(bArr);
ARDataHelper.a(bArr, options);
} catch (OutOfMemoryError unused5) {
((IMemoryUsageStatService) QBContext.getInstance().getService(IMemoryUsageStatService.class)).handleOOMError(0);
try {
ZxingUtils.closeQuietly(inputStream);
} catch (Exception unused6) {
}
bitmap = 0;
System.currentTimeMillis();
if (bitmap == 0) {
}
cursor = MethodDelegate.query(contentResolver, data, null, null, null, null);
if (cursor != null) {
try {
cursor.moveToFirst();
columnIndex = cursor.getColumnIndex("_data");
if (columnIndex >= 0) {
}
} catch (Exception unused7) {
bitmap2 = bitmap;
i3 = 0;
if (cursor != null) {
cursor.close();
}
if (QRCodeHostProxy.c() != null) {
}
if (bArr == null) {
}
} catch (OutOfMemoryError unused8) {
i3 = 0;
((IMemoryUsageStatService) QBContext.getInstance().getService(IMemoryUsageStatService.class)).handleOOMError(0);
if (cursor != null) {
cursor.close();
}
bArr = null;
if (QRCodeHostProxy.c() != null) {
}
if (bArr == null) {
}
}
}
i3 = 0;
bitmap = bitmap;
System.currentTimeMillis();
if (cursor != null) {
}
bitmap2 = bitmap;
if (QRCodeHostProxy.c() != null) {
}
if (bArr == null) {
}
}
} catch (FileNotFoundException unused9) {
}
} catch (Throwable th4) {
th = th4;
}
try {
String lowerCase = options.outMimeType.toLowerCase();
if (lowerCase.contains(ContentType.SUBTYPE_JPEG) || lowerCase.contains("jpg")) {
CaptureActivityImpl.this.decodeBytes = bArr;
}
} catch (FileNotFoundException unused10) {
} catch (Throwable th5) {
th = th5;
ZxingUtils.closeQuietly(inputStream);
throw th;
}
} catch (FileNotFoundException unused11) {
obj2 = null;
ZxingUtils.closeQuietly(inputStream);
} catch (OutOfMemoryError unused12) {
bArr = null;
} catch (Throwable th6) {
th = th6;
obj = null;
ZxingUtils.closeQuietly(inputStream);
throw th;
}
ZxingUtils.closeQuietly(inputStream);
}
Bitmap decodeSampledBitmapFromUri = ZxingUtils.decodeSampledBitmapFromUri(CaptureActivityImpl.this.l, data, calculateInSampleSize);
try {
bitmap = decodeSampledBitmapFromUri;
bArr = ARDataHelper.b(decodeSampledBitmapFromUri);
} catch (Exception unused13) {
bitmap = decodeSampledBitmapFromUri;
bArr = null;
}
} catch (Exception unused14) {
}
} catch (Exception unused15) {
bitmap = 0;
bArr = null;
System.currentTimeMillis();
if (bitmap == 0) {
}
cursor = MethodDelegate.query(contentResolver, data, null, null, null, null);
if (cursor != null) {
}
i3 = 0;
bitmap = bitmap;
System.currentTimeMillis();
if (cursor != null) {
}
bitmap2 = bitmap;
if (QRCodeHostProxy.c() != null) {
}
if (bArr == null) {
}
}
} catch (OutOfMemoryError unused16) {
((IMemoryUsageStatService) QBContext.getInstance().getService(IMemoryUsageStatService.class)).handleOOMError(0);
bitmap = 0;
bArr = null;
System.currentTimeMillis();
if (bitmap == 0) {
}
cursor = MethodDelegate.query(contentResolver, data, null, null, null, null);
if (cursor != null) {
}
i3 = 0;
bitmap = bitmap;
System.currentTimeMillis();
if (cursor != null) {
}
bitmap2 = bitmap;
if (QRCodeHostProxy.c() != null) {
}
if (bArr == null) {
}
}
try {
System.currentTimeMillis();
if (bitmap == 0) {
bArr = null;
}
cursor = MethodDelegate.query(contentResolver, data, null, null, null, null);
} catch (Exception unused17) {
cursor = null;
}
if (cursor != null && bitmap != 0) {
cursor.moveToFirst();
columnIndex = cursor.getColumnIndex("_data");
if (columnIndex >= 0) {
i3 = CaptureActivityImpl.this.readPictureDegree(cursor.getString(columnIndex));
try {
Matrix matrix = new Matrix();
int width = bitmap.getWidth();
int height = bitmap.getHeight();
matrix.setRotate(i3);
bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
System.currentTimeMillis();
if (cursor != null) {
cursor.close();
}
bitmap2 = bitmap;
} catch (Exception unused18) {
bitmap2 = bitmap;
if (cursor != null) {
}
if (QRCodeHostProxy.c() != null) {
}
if (bArr == null) {
}
} catch (OutOfMemoryError unused19) {
((IMemoryUsageStatService) QBContext.getInstance().getService(IMemoryUsageStatService.class)).handleOOMError(0);
if (cursor != null) {
}
bArr = null;
if (QRCodeHostProxy.c() != null) {
}
if (bArr == null) {
}
}
if (QRCodeHostProxy.c() != null) {
QRCodeHostProxy.c().a(bitmap2, bArr, i3);
}
if (bArr == null) {
CaptureActivityImpl.this.mHandler.postDelayed(new Runnable() {
@Override
public void run() {
CaptureActivityImpl.this.showErrorDialog();
}
}, 500L);
return;
}
if (bitmap2 == null) {
return;
}
CaptureActivityImpl captureActivityImpl2 = CaptureActivityImpl.this;
captureActivityImpl2.mRotateAngle = i3;
if (captureActivityImpl2.mRotateAngle != 0 || CaptureActivityImpl.this.decodeBytes == null) {
CaptureActivityImpl.this.decodeBytes = ARDataHelper.a(bitmap2, 70);
}
CaptureActivityImpl captureActivityImpl3 = CaptureActivityImpl.this;
captureActivityImpl3.decodeBitmap = bitmap2;
if (captureActivityImpl3.mThreadHandler != null) {
CaptureActivityImpl.this.mThreadHandler.removeMessages(4);
CaptureActivityImpl.this.mThreadHandler.sendEmptyMessageDelayed(4, 300L);
return;
}
return;
}
}
i3 = 0;
bitmap = bitmap;
System.currentTimeMillis();
if (cursor != null) {
}
bitmap2 = bitmap;
if (QRCodeHostProxy.c() != null) {
}
if (bArr == null) {
}
} catch (Throwable th7) {
th = th7;
if (r2 != 0) {
r2.close();
}
throw th;
}
}
});
}
}
@Override
public void IOnCreate() {
}
@Override
public void IOnCreateForAR() {
Activity a2 = ActivityHandler.b().a();
if (a2 == null) {
return;
}
this.f = false;
if (this.k == null) {
this.k = new BeepManager(a2, false);
}
final IQrCodeScanProxy c2 = QRCodeHostProxy.c();
BrowserExecutorSupplier.postForTimeoutTasks(new BrowserExecutorSupplier.BackgroundRunable() {
@Override
public void doRun() {
CaptureActivityImpl captureActivityImpl = CaptureActivityImpl.this;
IQrCodeScanProxy iQrCodeScanProxy = c2;
captureActivityImpl.mDetectLed = new CompatibleClass(iQrCodeScanProxy != null ? iQrCodeScanProxy.g() : ContextHolder.getAppContext());
CaptureActivityImpl captureActivityImpl2 = CaptureActivityImpl.this;
captureActivityImpl2.haveLed = captureActivityImpl2.mDetectLed.a();
BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
@Override
public void run() {
if (CaptureActivityImpl.this.haveLed || c2 == null) {
return;
}
c2.a(false);
}
});
}
});
try {
IVideoService iVideoService = (IVideoService) QBContext.getInstance().getService(IVideoService.class);
if (iVideoService != null) {
iVideoService.destroyLitePlayers();
}
} catch (NoSuchMethodError unused) {
}
}
@Override
public void IOnDestroy() {
CaptureActivityHandler captureActivityHandler = this.e;
if (captureActivityHandler != null) {
captureActivityHandler.b();
this.e = null;
}
this.f56351b = null;
this.mCamera = null;
}
@Override
public void IOnDestroyForAR() {
IOnDestroy();
}
@Override
public boolean IOnKeyDown(int i, KeyEvent keyEvent) {
if (i == 20 || i == 19 || i == 23 || i == 21 || i == 22 || i == 66) {
return false;
}
if (i == 80 || i == 27 || ((i == 82 && keyEvent.getAction() == 0 && keyEvent.getRepeatCount() == 0) || i == 84 || i != 127 || !DeviceUtils.h)) {
}
return true;
}
@Override
public void IOnPause() {
resetLightButton();
}
@Override
public void IOnPauseForAR() {
IOnPause();
}
@Override
public void IOnResume() {
this.f56351b = QRCodeHostProxy.b().p();
IQrCodeCamera iQrCodeCamera = this.f56351b;
if (iQrCodeCamera == null) {
finish(true);
return;
}
iQrCodeCamera.a(true);
d();
if (QRCodeHostProxy.b().q()) {
b();
} else {
finish(true);
}
}
@Override
public boolean IOnResumeForAR(boolean z) {
if (QRCodeHostProxy.b() != null) {
this.f56351b = QRCodeHostProxy.b().p();
}
IQrCodeCamera iQrCodeCamera = this.f56351b;
if (iQrCodeCamera != null) {
iQrCodeCamera.a(this.n, this.o);
}
if (this.f56351b == null) {
finish(true);
return false;
}
if (!(QRCodeHostProxy.b() != null ? QRCodeHostProxy.b().q() : false)) {
finish(true);
return false;
}
b();
CaptureActivityHandler captureActivityHandler = this.e;
if (captureActivityHandler == null) {
this.e = new CaptureActivityHandler(this.l, this, this.i, this.j, this.f56351b, z);
} else if (z) {
captureActivityHandler.c();
this.e.d();
}
return true;
}
@Override
public void IOnStart() {
}
@Override
public void IOnStartForAR() {
}
protected void a() {
IQrCodeScanProxy c2 = QRCodeHostProxy.c();
if (c2 != null) {
this.f56352c = c2.r();
}
if (this.m || this.f56352c || this.f56353d) {
this.f56352c = false;
this.m = false;
if (c2 != null) {
c2.d(true);
c2.b(false);
}
}
}
@Override
public void closeBarQrcodePicDialog() {
}
@Override
public void closeErrorDialogForAR() {
this.f56352c = false;
if (this.m || this.f56353d) {
this.m = false;
}
}
public void finish(boolean z) {
QrCodeManager.a().e(z);
}
public IQrCodeCamera getCameraManager() {
return this.f56351b;
}
public Rect getFramingRect() {
IQrCodeCamera iQrCodeCamera = this.f56351b;
if (iQrCodeCamera != null) {
return iQrCodeCamera.b();
}
return null;
}
public Handler getHandler() {
return this.e;
}
public int getMode() {
return this.mScanMode;
}
public void handleDecode(Bundle bundle) {
StatManager.b().c("N68");
ResultHandlerFactory resultHandlerFactory = new ResultHandlerFactory();
String string = bundle.getString("sData");
String string2 = bundle.getString("sType");
ResultHandler a2 = resultHandlerFactory.a(this.l, string);
if (a2 == null) {
return;
}
this.k.b();
a(string, string2, a2, null);
}
public boolean isLocalScanning() {
IQrCodeScanProxy c2 = QRCodeHostProxy.c();
return c2 != null ? c2.m() : this.f56352c;
}
@Override
public void onBottomOnecodeLayoutClick() {
a();
this.mScanMode = 1;
}
@Override
public void onBottomQrcodeLayoutClick() {
a();
this.mScanMode = 0;
}
@Override
public void onLightControlClick() {
}
@Override
public boolean onLightControlClickForAR() {
IQrCodeCamera iQrCodeCamera = this.f56351b;
if (iQrCodeCamera == null || this.mDetectLed == null) {
return false;
}
this.mCamera = iQrCodeCamera.d();
if (this.isLightOn) {
if (this.mDetectLed.a(this.mCamera)) {
this.isLightOn = false;
return false;
}
} else if (this.mDetectLed.b(this.mCamera)) {
this.isLightOn = true;
return true;
}
return false;
}
@Override
public boolean onTopRightButtonClick() {
if (QrcodeExternalSetting.a().b()) {
a();
return selectPic();
}
QrcodeExternalSetting.a().a(true);
a();
selectPic();
return true;
}
public int readPictureDegree(String str) {
try {
int attributeInt = new ExifInterface(str).getAttributeInt(androidx.exifinterface.media.ExifInterface.TAG_ORIENTATION, 1);
if (attributeInt == 3) {
return 180;
}
if (attributeInt != 6) {
return attributeInt != 8 ? 0 : 270;
}
return 90;
} catch (IOException unused) {
return 0;
}
}
@Override
public void resetARScanView() {
}
public void resetLightButton() {
IQrCodeScanProxy c2;
if (this.isLightOn) {
try {
if (this.mDetectLed.a(this.mCamera)) {
this.isLightOn = false;
c2 = QRCodeHostProxy.c();
if (c2 == null) {
return;
}
} else {
this.isLightOn = false;
c2 = QRCodeHostProxy.c();
if (c2 == null) {
return;
}
}
c2.c(false);
} catch (Exception unused) {
}
}
}
@Override
public void resize() {
IQrCodeCamera iQrCodeCamera = this.f56351b;
if (iQrCodeCamera != null) {
iQrCodeCamera.e();
CaptureActivityHandler captureActivityHandler = this.e;
if (captureActivityHandler != null) {
captureActivityHandler.sendEmptyMessage(R.id.restart_preview);
}
}
}
public boolean selectPic() {
StatManager.b().c("N67");
Intent intent = new Intent("android.intent.action.GET_CONTENT");
intent.setPackage("com.tencent.mtt");
intent.setType("image/*");
try {
ActivityHandler.b().a(intent, 100);
return true;
} catch (ActivityNotFoundException unused) {
return false;
}
}
@Override
public void setBundle(Bundle bundle) {
this.f56350a = bundle;
}
@Override
public void setPID(String str) {
this.mPID = str;
}
@Override
public void setQrcodeDes(String str) {
}
@Override
public void showErrorDialog() {
IQrCodeScanProxy c2 = QRCodeHostProxy.c();
if (c2 != null) {
c2.k();
}
this.m = true;
}
@Override
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
}
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
}
@Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
CaptureActivityHandler captureActivityHandler = this.e;
if (captureActivityHandler != null) {
captureActivityHandler.b();
this.e = null;
}
BrowserExecutorSupplier.postForBackgroundTasks(new BrowserExecutorSupplier.BackgroundRunable() {
@Override
public void doRun() {
try {
CaptureActivityImpl.this.f56351b.c();
} catch (Exception unused) {
}
}
});
this.f = false;
}
}