package com.epson.memcardacc; import android.content.Context; import android.os.AsyncTask; import java.util.concurrent.SynchronousQueue; public class MemcardCheckTask extends AsyncTask { public static final int ERROR_CODE_ACTIVITY_ON_PAUSE_CANCEL = 6; public static final int ERROR_CODE_CANCEL = 5; public static final int ERROR_MEM_CARD_NOT_FOUND = 1; public static final int ERROR_PRINTER_BUSY = 3; public static final int ERROR_PRINTER_CONNECTION = 2; public static final int ERROR_PRINTER_ERROR = 4; public static final int NO_ERROR = 0; protected boolean mActivityOnPauseCancel; MemcardCheckCallback mCallback; int mCifsStorageSetType; Context mContext; int mErrorCode; private SynchronousQueue mQueue; public interface MemcardCheckCallback { void onAuthInfoRequired(MemcardCheckTask memcardCheckTask, boolean z); void onMemcardCheckEnd(Integer num, int i); void onPreExecute(); } public MemcardCheckTask(Context context, MemcardCheckCallback memcardCheckCallback, int i) { this.mActivityOnPauseCancel = false; this.mQueue = new SynchronousQueue<>(); this.mContext = context.getApplicationContext(); this.mCallback = memcardCheckCallback; this.mCifsStorageSetType = i; } protected MemcardCheckTask() { this.mActivityOnPauseCancel = false; } /* access modifiers changed from: protected */ /* JADX WARNING: Can't wrap try/catch for region: R(4:50|51|52|53) */ /* JADX WARNING: Code restructure failed: missing block: B:51:?, code lost: r7.mErrorCode = 5; */ /* JADX WARNING: Code restructure failed: missing block: B:52:0x00a7, code lost: r8.free(); */ /* JADX WARNING: Code restructure failed: missing block: B:53:0x00aa, code lost: return 0; */ /* JADX WARNING: Missing exception handler attribute for start block: B:50:0x00a1 */ /* Code decompiled incorrectly, please refer to instructions dump. */ public java.lang.Integer doInBackground(java.lang.Void... r8) { /* r7 = this; boolean r8 = r7.isCancelled() r0 = 5 r1 = 0 if (r8 == 0) goto L_0x000f r7.mErrorCode = r0 java.lang.Integer r8 = java.lang.Integer.valueOf(r1) return r8 L_0x000f: android.content.Context r8 = r7.mContext r2 = 60 int r8 = r7.checkEscprLib(r8, r2) r7.mErrorCode = r8 int r8 = r7.mErrorCode if (r8 == 0) goto L_0x0022 java.lang.Integer r8 = java.lang.Integer.valueOf(r1) return r8 L_0x0022: com.epson.memcardacc.CifsAccess r8 = r7.getCifsAccessInstance() boolean r2 = r7.isCancelled() // Catch:{ all -> 0x00b3 } if (r2 == 0) goto L_0x0036 r7.mErrorCode = r0 // Catch:{ all -> 0x00b3 } java.lang.Integer r0 = java.lang.Integer.valueOf(r1) // Catch:{ all -> 0x00b3 } r8.free() return r0 L_0x0036: android.content.Context r2 = r7.mContext // Catch:{ all -> 0x00b3 } int r3 = r7.mCifsStorageSetType // Catch:{ all -> 0x00b3 } int r2 = r8.initDefault(r2, r3) // Catch:{ all -> 0x00b3 } if (r2 != 0) goto L_0x0055 r8.free() // Catch:{ all -> 0x00b3 } android.content.Context r2 = r7.mContext // Catch:{ all -> 0x00b3 } int r3 = r7.mCifsStorageSetType // Catch:{ all -> 0x00b3 } int r2 = r8.initDefault(r2, r3) // Catch:{ all -> 0x00b3 } if (r2 != 0) goto L_0x0055 java.lang.Integer r0 = java.lang.Integer.valueOf(r1) // Catch:{ all -> 0x00b3 } r8.free() return r0 L_0x0055: r2 = 1 r3 = 0 r4 = 1 L_0x0058: if (r3 != 0) goto L_0x00ab boolean r3 = r7.isCancelled() // Catch:{ all -> 0x00b3 } if (r3 == 0) goto L_0x006a r7.mErrorCode = r0 // Catch:{ all -> 0x00b3 } java.lang.Integer r0 = java.lang.Integer.valueOf(r1) // Catch:{ all -> 0x00b3 } r8.free() return r0 L_0x006a: int r3 = r8.checkStorage() // Catch:{ all -> 0x00b3 } if (r3 != 0) goto L_0x0058 int r5 = r8.getErrorCode() // Catch:{ all -> 0x00b3 } r6 = -1205(0xfffffffffffffb4b, float:NaN) if (r5 == r6) goto L_0x0082 r7.mErrorCode = r2 // Catch:{ all -> 0x00b3 } java.lang.Integer r0 = java.lang.Integer.valueOf(r1) // Catch:{ all -> 0x00b3 } r8.free() return r0 L_0x0082: boolean r5 = r7.isCancelled() // Catch:{ all -> 0x00b3 } if (r5 == 0) goto L_0x0092 r7.mErrorCode = r0 // Catch:{ all -> 0x00b3 } java.lang.Integer r0 = java.lang.Integer.valueOf(r1) // Catch:{ all -> 0x00b3 } r8.free() return r0 L_0x0092: com.epson.memcardacc.MemcardCheckTask$MemcardCheckCallback r5 = r7.mCallback // Catch:{ all -> 0x00b3 } r5.onAuthInfoRequired(r7, r4) // Catch:{ all -> 0x00b3 } java.util.concurrent.SynchronousQueue r4 = r7.mQueue // Catch:{ InterruptedException -> 0x00a1 } java.lang.Object r4 = r4.take() // Catch:{ InterruptedException -> 0x00a1 } com.epson.memcardacc.MemcardCheckTask$MyQueueData r4 = (com.epson.memcardacc.MemcardCheckTask.MyQueueData) r4 // Catch:{ InterruptedException -> 0x00a1 } r4 = 0 goto L_0x0058 L_0x00a1: r7.mErrorCode = r0 // Catch:{ all -> 0x00b3 } java.lang.Integer r0 = java.lang.Integer.valueOf(r1) // Catch:{ all -> 0x00b3 } r8.free() return r0 L_0x00ab: r8.free() java.lang.Integer r8 = java.lang.Integer.valueOf(r3) return r8 L_0x00b3: r0 = move-exception r8.free() throw r0 */ throw new UnsupportedOperationException("Method not decompiled: com.epson.memcardacc.MemcardCheckTask.doInBackground(java.lang.Void[]):java.lang.Integer"); } protected CifsAccess getCifsAccessInstance() { return CifsAccess.getInstance(); } protected void onPreExecute() { this.mCallback.onPreExecute(); } protected void onPostExecute(Integer num) { this.mCallback.onMemcardCheckEnd(num, this.mErrorCode); } protected void onCancelled() { this.mCallback.onMemcardCheckEnd((Integer) null, this.mActivityOnPauseCancel ? 6 : 5); } public void activityOnPauseCancel() { this.mActivityOnPauseCancel = true; cancel(true); } public void setAuthData(String str, String str2) { int i = 0; while (!this.mQueue.offer(new MyQueueData(2)) && i < 4) { try { Thread.sleep(300); i++; } catch (Exception unused) { return; } } } protected int checkEscprLib(Context context, int i) { EscprLibPrinter newEscprLibPrinter = newEscprLibPrinter(); if (newEscprLibPrinter.init(context, i, true) != 0) { return 2; } int status = newEscprLibPrinter.getStatus(); newEscprLibPrinter.release(); return (status == 0 || status == 4) ? 0 : 3; } protected EscprLibPrinter newEscprLibPrinter() { return new EscprLibPrinter(); } static class MyQueueData { public static final int TYPE_AUTH_DATA = 2; public static final int TYPE_CANCEL = 1; public int mDataType; public SmbAuthInfo mSmbAuthInfo; public static MyQueueData getCancelData() { return new MyQueueData(1); } public MyQueueData(int i) { this.mDataType = i; } public boolean isCancel() { return this.mDataType == 1; } } }