package com.epson.memcardacc; import android.content.Context; import com.epson.iprint.prtlogger.CommonLog; import java.util.ArrayList; import epson.print.Util.AsyncTaskExecutor; import epson.print.Util.EPLog; /* compiled from: MemcardWriteProgress */ class CopyTask extends AsyncTaskExecutor { private static final String LOG_TAG = "CopyTask"; MemcardWriteProgress mCallback; private boolean mCanceling; CifsAccess mCifsAccess = CifsAccess.getInstance(); private int mCifsAccessStorageType; private int mErrorCode = 0; private boolean mEscprCheck = false; private ArrayList mImageList; private CommonLog mLogData; private int mMemcardStorageType; private String mTargetFolderName; private ArrayList mWriteFileList; public CopyTask(@NonNull MemcardWriteProgress memcardWriteProgress, int i, int i2, @NonNull ArrayList arrayList, @NonNull ArrayList arrayList2, @NonNull String str, @Nullable CommonLog commonLog) { mCallback = memcardWriteProgress; mCifsAccessStorageType = i; mMemcardStorageType = i2; mImageList = arrayList; mWriteFileList = arrayList2; mTargetFolderName = str; mLogData = commonLog; } public void setCheck(boolean z, boolean z2) { mEscprCheck = z; } protected void onCancelled() { EPLog.i(LOG_TAG, "canceled in AsyncTask"); mCallback.finishWithState(0, 0, mLogData); } protected void onPostExecute(Integer num) { EPLog.i(LOG_TAG, "onPostExecute in AsyncTask"); mCallback.finishWithState(num.intValue(), mErrorCode, mLogData); } protected void onPreExecute() { mCanceling = false; mCallback.setProgress(0, mImageList.size()); } protected void onProgressUpdate(Integer... numArr) { mCallback.setProgress(numArr[0].intValue(), mImageList.size()); } protected EscprLibPrinter getEscprLibPrinter() { return new EscprLibPrinter(); } private int checkPrinterByEscprLib(Context context) { EscprLibPrinter escprLibPrinter = getEscprLibPrinter(); if (escprLibPrinter.init(context, 60, true) != 0) { return 1; } int status = escprLibPrinter.getStatus(); escprLibPrinter.release(); return (status == 0 || status == 4) ? 0 : 2; } /* access modifiers changed from: protected */ /* JADX WARNING: Code restructure failed: missing block: B:68:0x00e5, code lost: r8 = move-exception; */ /* JADX WARNING: Code restructure failed: missing block: B:69:0x00e6, code lost: r7.mCifsAccess.free(); */ /* JADX WARNING: Code restructure failed: missing block: B:70:0x00eb, code lost: throw r8; */ /* JADX WARNING: Removed duplicated region for block: B:68:0x00e5 A[ExcHandler: all (r8v5 'th' java.lang.Throwable A[CUSTOM_DECLARE]), Splitter:B:21:0x003e] */ /* Code decompiled incorrectly, please refer to instructions dump. */ public java.lang.Integer doInBackground(java.lang.Void... r8) { /* r7 = this; r8 = 3 com.epson.memcardacc.MemcardWriteProgress r0 = r7.mCallback // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } boolean r0 = r0.waitWifiConnect() // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } if (r0 != 0) goto L_0x0013 java.lang.Integer r8 = java.lang.Integer.valueOf(r8) // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess r0.free() return r8 L_0x0013: boolean r0 = r7.isCancelled() // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } r1 = 0 if (r0 == 0) goto L_0x0024 java.lang.Integer r8 = java.lang.Integer.valueOf(r1) // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess r0.free() return r8 L_0x0024: boolean r0 = r7.mEscprCheck // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } if (r0 == 0) goto L_0x003e com.epson.memcardacc.MemcardWriteProgress r0 = r7.mCallback // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } int r0 = r7.checkPrinterByEscprLib(r0) // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } r7.mErrorCode = r0 // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } int r0 = r7.mErrorCode // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } if (r0 == 0) goto L_0x003e java.lang.Integer r8 = java.lang.Integer.valueOf(r8) // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess r0.free() return r8 L_0x003e: boolean r0 = r7.isCancelled() // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } if (r0 == 0) goto L_0x004e java.lang.Integer r8 = java.lang.Integer.valueOf(r1) // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess r0.free() return r8 L_0x004e: com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } com.epson.memcardacc.MemcardWriteProgress r1 = r7.mCallback // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } int r2 = r7.mCifsAccessStorageType // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } int r0 = r0.initDefault(r1, r2) // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } if (r0 != 0) goto L_0x0064 java.lang.Integer r8 = java.lang.Integer.valueOf(r8) // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess r0.free() return r8 L_0x0064: com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } int r1 = r7.mMemcardStorageType // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } int r0 = r0.connectDefaultStorageWidthDefaultAthInfo(r1) // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } r1 = 1 r2 = -1100(0xfffffffffffffbb4, float:NaN) if (r0 != 0) goto L_0x0088 com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } int r0 = r0.getErrorCode() // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } if (r0 != r2) goto L_0x007c r7.mErrorCode = r1 // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } goto L_0x007e L_0x007c: r7.mErrorCode = r8 // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } L_0x007e: java.lang.Integer r8 = java.lang.Integer.valueOf(r8) // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess r0.free() return r8 L_0x0088: com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } long r3 = r0.getFreeUnit() // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } r5 = 0 int r0 = (r3 > r5 ? 1 : (r3 == r5 ? 0 : -1)) if (r0 >= 0) goto L_0x00a0 r7.mErrorCode = r8 // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } java.lang.Integer r8 = java.lang.Integer.valueOf(r8) // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess r0.free() return r8 L_0x00a0: java.lang.String r0 = r7.mTargetFolderName // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } int r0 = r0.length() // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } if (r0 <= 0) goto L_0x00d0 com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } java.lang.String r3 = r7.mTargetFolderName // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } int r0 = r0.createDirectory(r3) // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } if (r0 == 0) goto L_0x00cf r3 = -1203(0xfffffffffffffb4d, float:NaN) if (r0 == r3) goto L_0x00cf if (r0 != r2) goto L_0x00bb r7.mErrorCode = r1 // Catch:{ Exception -> 0x00cd, all -> 0x00e5 } goto L_0x00be L_0x00bb: r1 = 4 r7.mErrorCode = r1 // Catch:{ Exception -> 0x00cd, all -> 0x00e5 } L_0x00be: com.epson.memcardacc.CifsAccess r1 = r7.mCifsAccess // Catch:{ Exception -> 0x00cd, all -> 0x00e5 } r1.disconnectStorage() // Catch:{ Exception -> 0x00cd, all -> 0x00e5 } java.lang.Integer r8 = java.lang.Integer.valueOf(r8) // Catch:{ Exception -> 0x00cd, all -> 0x00e5 } com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess r0.free() return r8 L_0x00cd: r8 = r0 goto L_0x00ec L_0x00cf: r8 = r0 L_0x00d0: int r8 = r7.copyFile() // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } r0.disconnectStorage() // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } com.epson.iprint.prtlogger.CommonLog r0 = r7.mLogData // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } com.epson.memcardacc.MemcardWriteProgress r1 = r7.mCallback // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } android.content.Context r1 = r1.getApplicationContext() // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } r0.setConnectionType(r1) // Catch:{ Exception -> 0x00ec, all -> 0x00e5 } goto L_0x00ec L_0x00e5: r8 = move-exception com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess r0.free() throw r8 L_0x00ec: com.epson.memcardacc.CifsAccess r0 = r7.mCifsAccess r0.free() java.lang.Integer r8 = java.lang.Integer.valueOf(r8) return r8 */ throw new UnsupportedOperationException("Method not decompiled: com.epson.memcardacc.CopyTask.doInBackground(java.lang.Void[]):java.lang.Integer"); } /* access modifiers changed from: protected */ /* JADX WARNING: Removed duplicated region for block: B:30:0x00ae */ /* JADX WARNING: Removed duplicated region for block: B:47:0x00f8 */ /* Code decompiled incorrectly, please refer to instructions dump. */ public int copyFile() { /* r13 = this; java.util.ArrayList r0 = r13.mImageList java.util.Iterator r0 = r0.iterator() r1 = 0 r2 = 0 L_0x0008: boolean r3 = r0.hasNext() r4 = -2 if (r3 == 0) goto L_0x00fe boolean r3 = r13.isCancelled() if (r3 == 0) goto L_0x0016 return r1 L_0x0016: r13.localPublishProgress(r2) java.lang.Object r3 = r0.next() java.lang.String r3 = (java.lang.String) r3 java.util.ArrayList r5 = r13.mWriteFileList r6 = 2 r7 = 1 if (r5 == 0) goto L_0x003c java.lang.Object r5 = r5.get(r2) java.lang.String r5 = (java.lang.String) r5 java.util.Locale r8 = java.util.Locale.US java.lang.String r9 = "%s\\%s" java.lang.Object[] r6 = new java.lang.Object[r6] java.lang.String r10 = r13.mTargetFolderName r6[r1] = r10 r6[r7] = r5 java.lang.String r5 = java.lang.String.format(r8, r9, r6) goto L_0x0050 L_0x003c: java.util.Locale r5 = java.util.Locale.US java.lang.String r8 = "%s\\IMG_%04d.JPG" java.lang.Object[] r6 = new java.lang.Object[r6] java.lang.String r9 = r13.mTargetFolderName r6[r1] = r9 java.lang.Integer r9 = java.lang.Integer.valueOf(r2) r6[r7] = r9 java.lang.String r5 = java.lang.String.format(r5, r8, r6) L_0x0050: int r2 = r2 + 1 java.lang.String r6 = "MemcardWriteProgress" java.lang.StringBuilder r8 = new java.lang.StringBuilder r8.() java.lang.String r9 = "copy " r8.append(r9) r8.append(r3) java.lang.String r9 = " => " r8.append(r9) r8.append(r5) java.lang.String r8 = r8.toString() epson.print.Util.EPLog.i(r6, r8) long r8 = com.epson.memcardacc.MemcardUtil.getFileLength(r3) r10 = 2147483647(0x7fffffff, double:1.060997895E-314) r6 = 3 int r12 = (r8 > r10 ? 1 : (r8 == r10 ? 0 : -1)) if (r12 <= 0) goto L_0x0080 r0 = 5 r13.mErrorCode = r0 return r6 L_0x0080: r10 = -1203(0xfffffffffffffb4d, float:NaN) com.epson.memcardacc.CifsAccess r11 = r13.mCifsAccess // Catch:{ UnsupportedEncodingException -> 0x00a7 } int r9 = r8 // Catch:{ UnsupportedEncodingException -> 0x00a7 } int r8 = r11.writeToPrinterMemcard(r3, r5, r9) // Catch:{ UnsupportedEncodingException -> 0x00a7 } java.util.ArrayList r11 = r13.mWriteFileList // Catch:{ UnsupportedEncodingException -> 0x00a5 } if (r11 == 0) goto L_0x00ac if (r8 == 0) goto L_0x00ac if (r8 == r4) goto L_0x00ac com.epson.memcardacc.CifsAccess r11 = r13.mCifsAccess // Catch:{ UnsupportedEncodingException -> 0x00a5 } int r11 = r11.getErrorCode() // Catch:{ UnsupportedEncodingException -> 0x00a5 } if (r11 != r10) goto L_0x00ac com.epson.memcardacc.CifsAccess r11 = r13.mCifsAccess // Catch:{ UnsupportedEncodingException -> 0x00a5 } r11.deleteFile(r5) // Catch:{ UnsupportedEncodingException -> 0x00a5 } com.epson.memcardacc.CifsAccess r11 = r13.mCifsAccess // Catch:{ UnsupportedEncodingException -> 0x00a5 } int r8 = r11.writeToPrinterMemcard(r3, r5, r9) // Catch:{ UnsupportedEncodingException -> 0x00a5 } goto L_0x00ac L_0x00a5: r9 = move-exception goto L_0x00a9 L_0x00a7: r9 = move-exception r8 = 0 L_0x00a9: r9.printStackTrace() L_0x00ac: if (r8 == 0) goto L_0x00f8 java.lang.String r9 = "MemcardWriteProgress" java.lang.StringBuilder r11 = new java.lang.StringBuilder r11.() java.lang.String r12 = "writeFromPrinterMemcard() returns <" r11.append(r12) r11.append(r8) java.lang.String r12 = ">" r11.append(r12) java.lang.String r11 = r11.toString() epson.print.Util.EPLog.w((java.lang.String) r9, (java.lang.String) r11) if (r8 != r4) goto L_0x00d1 com.epson.memcardacc.CifsAccess r0 = r13.mCifsAccess r0.deleteFile(r5) return r1 L_0x00d1: com.epson.memcardacc.CifsAccess r4 = r13.mCifsAccess int r4 = r4.getErrorCode() r8 = 4 if (r4 != r10) goto L_0x00e9 java.util.ArrayList r4 = r13.mWriteFileList if (r4 != 0) goto L_0x00e6 boolean r3 = r13.checkFileSize(r3, r5) if (r3 == 0) goto L_0x00e6 goto L_0x0008 L_0x00e6: r13.mErrorCode = r8 return r6 L_0x00e9: com.epson.memcardacc.CifsAccess r0 = r13.mCifsAccess r0.deleteFile(r5) r0 = -1100(0xfffffffffffffbb4, float:NaN) if (r4 != r0) goto L_0x00f5 r13.mErrorCode = r7 goto L_0x00f7 L_0x00f5: r13.mErrorCode = r8 L_0x00f7: return r6 L_0x00f8: com.epson.iprint.prtlogger.CommonLog r3 = r13.mLogData r3.numberOfSheet = r2 goto L_0x0008 L_0x00fe: return r4 */ throw new UnsupportedOperationException("Method not decompiled: com.epson.memcardacc.CopyTask.copyFile():int"); } protected void localPublishProgress(int i) { publishProgress(new Integer[]{Integer.valueOf(i)}); } protected boolean checkFileSize(String str, String str2) { long fileLength = MemcardUtil.getFileLength(str); long fileSize = mCifsAccess.getFileSize(str2); return fileSize > 0 && fileLength == fileSize; } public void taskCancel() { if (!mCanceling) { mCanceling = true; EPLog.i(LOG_TAG, "taskCancel()"); mCifsAccess.cancel(); cancel(false); } } public void taskCancelByFileSizeZero() { if (!mCanceling) { mCanceling = true; EPLog.i(LOG_TAG, "taskCancel()"); mCifsAccess.cancelByFileSizeZero(); cancel(false); } } }