PrintAndLayoutThread.java 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. package epson.print.service;
  2. import android.os.RemoteException;
  3. import com.epson.cameracopy.printlayout.ImageAndLayout;
  4. import com.epson.iprint.prtlogger.Analytics;
  5. import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
  6. import java.io.File;
  7. import java.text.SimpleDateFormat;
  8. import java.util.Date;
  9. import java.util.List;
  10. import java.util.Locale;
  11. import epson.common.ExternalFileUtils;
  12. import epson.common.Info_paper;
  13. import epson.image.epsonImage;
  14. import epson.print.EPImageUtil;
  15. import epson.print.MyPrinter;
  16. import epson.print.screen.PrintSetting;
  17. class PrintAndLayoutThread extends Thread {
  18. private static final int DUPLEX_NONE = 0;
  19. private static final long REMOTE_FILE_SIZE_MAX = 10000000;
  20. private static final int[] REMOTE_IMAGE_CREATE_PROGRESS = {20, 25, 50, 70, 75};
  21. private static final int[] REMOTE_JPEG_QUALITYS = {95, 80};
  22. final int EPS_JOB_CANCELED = 40;
  23. private int mColorValue;
  24. private int mCopies;
  25. private final EpsonService mEpsonService;
  26. private final List<ImageAndLayout> mImageAndLayoutList;
  27. private boolean mIsBkRetry;
  28. private int mLayout;
  29. private int mPaperSizeId;
  30. private int mRemoteImageCreateProgress;
  31. public PrintAndLayoutThread(EpsonService epsonService, List<ImageAndLayout> list, boolean z) {
  32. mEpsonService = epsonService;
  33. mImageAndLayoutList = list;
  34. mIsBkRetry = z;
  35. }
  36. private int callStartJob() {
  37. int i;
  38. PrintSetting printSetting = new PrintSetting(mEpsonService, PrintSetting.Kind.cameracopy);
  39. printSetting.loadSettings();
  40. int i2 = printSetting.paperSizeValue;
  41. mPaperSizeId = i2;
  42. int i3 = printSetting.paperTypeValue;
  43. int i4 = printSetting.layoutValue;
  44. mLayout = i4;
  45. int i5 = printSetting.qualityValue;
  46. int i6 = printSetting.paperSourceValue;
  47. int i7 = printSetting.colorValue;
  48. mColorValue = i7;
  49. mCopies = printSetting.copiesValue;
  50. if (mEpsonService.getLang() == 2 || mEpsonService.getLang() == 3) {
  51. i = printSetting.feedDirectionValue;
  52. } else {
  53. i = 0;
  54. }
  55. return mEpsonService.startJob(i2, i3, i4, i5, i6, i7, 0, 0, 0, i, 0, mIsBkRetry);
  56. }
  57. private int getPrintRotation() {
  58. int lang = mEpsonService.getLang();
  59. return ((lang == 4 || lang == 7) && mEpsonService.pageSneedRotate(mPaperSizeId)) ? 1 : 0;
  60. }
  61. protected boolean createPrintImage(ImageAndLayout imageAndLayout, String str, int[] iArr) {
  62. int printRotation = getPrintRotation();
  63. int[] iArr2 = new int[2];
  64. boolean z = false;
  65. if ((printRotation & 1) != 0) {
  66. iArr2[0] = iArr[1];
  67. iArr2[1] = iArr[0];
  68. } else {
  69. iArr2[0] = iArr[0];
  70. iArr2[1] = iArr[1];
  71. }
  72. if (mColorValue == 1) {
  73. z = true;
  74. }
  75. return imageAndLayout.createPrintData(str, z, iArr2, printRotation);
  76. }
  77. private String getPrintFileName(int i) {
  78. return new File(ExternalFileUtils.getInstance(mEpsonService.getApplicationContext()).getPrintDir(), String.format(Locale.US, "_%02d.bmp", new Object[]{Integer.valueOf(i + 1)})).getPath();
  79. }
  80. public void run() {
  81. int i;
  82. synchronized (mEpsonService.getPrintLockObject()) {
  83. mEpsonService.setPrinting(true);
  84. mEpsonService.setCancelPrinting(false);
  85. if (MyPrinter.isRemotePrinter(mEpsonService)) {
  86. i = remotePrint();
  87. } else {
  88. i = localPrint();
  89. }
  90. if (i == 40) {
  91. i = 0;
  92. }
  93. mEpsonService.setPrinting(false);
  94. mEpsonService.setCancelPrinting(false);
  95. EpsonService.onNotifyEndJob(i);
  96. }
  97. }
  98. private int localPrint() {
  99. int i;
  100. try {
  101. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), true);
  102. int callStartJob = callStartJob();
  103. if (callStartJob != 0) {
  104. mEpsonService.endJob();
  105. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), 0);
  106. mEpsonService.waitIfSimpleAp();
  107. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  108. return callStartJob;
  109. } else if (mEpsonService.getCancelPrinting()) {
  110. mEpsonService.endJob();
  111. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), 0);
  112. mEpsonService.waitIfSimpleAp();
  113. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  114. return 40;
  115. } else {
  116. int[] printableArea = mEpsonService.getPrintableArea();
  117. int i2 = 0;
  118. i = 0;
  119. while (i2 < mCopies) {
  120. try {
  121. for (ImageAndLayout createPrintImage : mImageAndLayoutList) {
  122. String printFileName = getPrintFileName(0);
  123. if (!createPrintImage(createPrintImage, printFileName, printableArea)) {
  124. mEpsonService.epsNotifyError(-1, EpsonService.MEDIA_INFO_MEMORY_ERROR, false);
  125. mEpsonService.endJob();
  126. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), 0);
  127. mEpsonService.waitIfSimpleAp();
  128. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  129. return EpsonService.MEDIA_INFO_MEMORY_ERROR;
  130. } else if (mEpsonService.getCancelPrinting()) {
  131. mEpsonService.endJob();
  132. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), 0);
  133. mEpsonService.waitIfSimpleAp();
  134. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  135. return 40;
  136. } else {
  137. int initImage = mEpsonService.initImage(printFileName);
  138. if (initImage != 0) {
  139. mEpsonService.endJob();
  140. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), 0);
  141. mEpsonService.waitIfSimpleAp();
  142. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  143. return initImage;
  144. } else if (mEpsonService.getCancelPrinting()) {
  145. mEpsonService.endJob();
  146. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), 0);
  147. mEpsonService.waitIfSimpleAp();
  148. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  149. return 40;
  150. } else {
  151. int startPage = mEpsonService.startPage();
  152. if (startPage != 0) {
  153. mEpsonService.endJob();
  154. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), 0);
  155. mEpsonService.waitIfSimpleAp();
  156. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  157. return startPage;
  158. } else if (mEpsonService.getCancelPrinting()) {
  159. mEpsonService.endJob();
  160. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), 0);
  161. mEpsonService.waitIfSimpleAp();
  162. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  163. return 40;
  164. } else {
  165. int printPage = mEpsonService.printPage();
  166. if (printPage != 0) {
  167. mEpsonService.endJob();
  168. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), 0);
  169. mEpsonService.waitIfSimpleAp();
  170. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  171. return printPage;
  172. } else if (mEpsonService.getCancelPrinting()) {
  173. mEpsonService.endJob();
  174. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), 0);
  175. mEpsonService.waitIfSimpleAp();
  176. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  177. return 40;
  178. } else {
  179. int endPage = mEpsonService.endPage(false);
  180. if (endPage != 0) {
  181. mEpsonService.endJob();
  182. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), 0);
  183. mEpsonService.waitIfSimpleAp();
  184. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  185. return endPage;
  186. } else if (mEpsonService.getCancelPrinting()) {
  187. mEpsonService.endJob();
  188. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), 0);
  189. mEpsonService.waitIfSimpleAp();
  190. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  191. return 40;
  192. } else {
  193. mEpsonService.releaseImage();
  194. if (mEpsonService.getCancelPrinting()) {
  195. mEpsonService.endJob();
  196. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), 0);
  197. mEpsonService.waitIfSimpleAp();
  198. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  199. return 40;
  200. }
  201. }
  202. }
  203. }
  204. }
  205. }
  206. }
  207. i2++;
  208. i = 1;
  209. } catch (Exception e) {
  210. e = e;
  211. try {
  212. e.printStackTrace();
  213. mEpsonService.endJob();
  214. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), i);
  215. mEpsonService.waitIfSimpleAp();
  216. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  217. return 0;
  218. } catch (Throwable th) {
  219. th = th;
  220. mEpsonService.endJob();
  221. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), i);
  222. mEpsonService.waitIfSimpleAp();
  223. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  224. throw th;
  225. }
  226. }
  227. }
  228. mEpsonService.endJob();
  229. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), i);
  230. mEpsonService.waitIfSimpleAp();
  231. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  232. return 0;
  233. }
  234. } catch (Exception e2) {
  235. e = e2;
  236. i = 0;
  237. e.printStackTrace();
  238. mEpsonService.endJob();
  239. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), i);
  240. mEpsonService.waitIfSimpleAp();
  241. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  242. return 0;
  243. } catch (Throwable th2) {
  244. th = th2;
  245. i = 0;
  246. mEpsonService.endJob();
  247. Analytics.savePrintInfo(mEpsonService.getApplicationContext(), i);
  248. mEpsonService.waitIfSimpleAp();
  249. WiFiDirectManager.setPriorityToSimpleAP(mEpsonService.getLocalApplicationContext(), false);
  250. throw th;
  251. }
  252. }
  253. private int remoteCreateJob() throws RemoteException {
  254. PrintSetting printSetting = new PrintSetting(mEpsonService, PrintSetting.Kind.cameracopy);
  255. printSetting.loadSettings();
  256. int i = printSetting.paperSizeValue;
  257. mPaperSizeId = i;
  258. int i2 = printSetting.paperTypeValue;
  259. int i3 = printSetting.layoutValue;
  260. mLayout = i3;
  261. int i4 = printSetting.qualityValue;
  262. int i5 = printSetting.paperSourceValue;
  263. int i6 = printSetting.colorValue;
  264. mColorValue = i6;
  265. mCopies = printSetting.copiesValue;
  266. SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmm", Locale.US);
  267. return mEpsonService.epsonConnectCreateJob(2, simpleDateFormat.format(new Date()) + ".jpg", i, i2, i3, i4, i5, i6, 0, 0, 0, 0, 0, 0, 0);
  268. }
  269. /* JADX WARNING: Removed duplicated region for block: B:136:0x01e9 */
  270. /* Code decompiled incorrectly, please refer to instructions dump. */
  271. private int remotePrint() {
  272. /*
  273. r7 = this;
  274. r0 = -1
  275. r1 = 0
  276. epson.print.service.EpsonService r2 = r7.mEpsonService // Catch:{ Exception -> 0x01bc, all -> 0x01b8 }
  277. boolean r2 = r2.getCancelPrinting() // Catch:{ Exception -> 0x01bc, all -> 0x01b8 }
  278. if (r2 == 0) goto L_0x001e
  279. epson.print.service.EpsonService r0 = r7.mEpsonService
  280. android.content.Context r0 = r0.getApplicationContext()
  281. com.epson.iprint.prtlogger.Analytics.savePrintInfo(r0, r1)
  282. epson.print.service.EpsonService r0 = r7.mEpsonService // Catch:{ RemoteException -> 0x0019 }
  283. r0.epsonConnectEndJob() // Catch:{ RemoteException -> 0x0019 }
  284. goto L_0x001d
  285. L_0x0019:
  286. r0 = move-exception
  287. r0.printStackTrace()
  288. L_0x001d:
  289. return r1
  290. L_0x001e:
  291. int r2 = r7.remoteCreateJob() // Catch:{ Exception -> 0x01bc, all -> 0x01b8 }
  292. if (r2 == 0) goto L_0x003f
  293. epson.print.service.EpsonService r3 = r7.mEpsonService
  294. android.content.Context r3 = r3.getApplicationContext()
  295. com.epson.iprint.prtlogger.Analytics.savePrintInfo(r3, r1)
  296. if (r2 == 0) goto L_0x0034
  297. epson.print.service.EpsonService r3 = r7.mEpsonService
  298. r3.epsNotifyError(r0, r2, r1)
  299. L_0x0034:
  300. epson.print.service.EpsonService r0 = r7.mEpsonService // Catch:{ RemoteException -> 0x003a }
  301. r0.epsonConnectEndJob() // Catch:{ RemoteException -> 0x003a }
  302. goto L_0x003e
  303. L_0x003a:
  304. r0 = move-exception
  305. r0.printStackTrace()
  306. L_0x003e:
  307. return r2
  308. L_0x003f:
  309. epson.print.service.EpsonService r3 = r7.mEpsonService // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  310. r4 = 2
  311. r3.epsNotifyPage(r4) // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  312. epson.print.service.EpsonService r3 = r7.mEpsonService // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  313. boolean r3 = r3.getCancelPrinting() // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  314. if (r3 == 0) goto L_0x0068
  315. epson.print.service.EpsonService r3 = r7.mEpsonService
  316. android.content.Context r3 = r3.getApplicationContext()
  317. com.epson.iprint.prtlogger.Analytics.savePrintInfo(r3, r1)
  318. if (r2 == 0) goto L_0x005d
  319. epson.print.service.EpsonService r3 = r7.mEpsonService
  320. r3.epsNotifyError(r0, r2, r1)
  321. L_0x005d:
  322. epson.print.service.EpsonService r0 = r7.mEpsonService // Catch:{ RemoteException -> 0x0063 }
  323. r0.epsonConnectEndJob() // Catch:{ RemoteException -> 0x0063 }
  324. goto L_0x0067
  325. L_0x0063:
  326. r0 = move-exception
  327. r0.printStackTrace()
  328. L_0x0067:
  329. return r1
  330. L_0x0068:
  331. java.lang.String r3 = r7.getPrintFileName(r1) // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  332. java.lang.StringBuilder r4 = new java.lang.StringBuilder // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  333. r4.<init>() // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  334. java.lang.String r5 = "\\.\\w+$"
  335. java.lang.String r6 = ""
  336. java.lang.String r5 = r3.replaceFirst(r5, r6) // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  337. r4.append(r5) // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  338. java.lang.String r5 = ".jpg"
  339. r4.append(r5) // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  340. java.lang.String r4 = r4.toString() // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  341. int r2 = r7.makeRemoteFile(r3, r4) // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  342. if (r2 == 0) goto L_0x00a6
  343. epson.print.service.EpsonService r3 = r7.mEpsonService
  344. android.content.Context r3 = r3.getApplicationContext()
  345. com.epson.iprint.prtlogger.Analytics.savePrintInfo(r3, r1)
  346. if (r2 == 0) goto L_0x009b
  347. epson.print.service.EpsonService r3 = r7.mEpsonService
  348. r3.epsNotifyError(r0, r2, r1)
  349. L_0x009b:
  350. epson.print.service.EpsonService r0 = r7.mEpsonService // Catch:{ RemoteException -> 0x00a1 }
  351. r0.epsonConnectEndJob() // Catch:{ RemoteException -> 0x00a1 }
  352. goto L_0x00a5
  353. L_0x00a1:
  354. r0 = move-exception
  355. r0.printStackTrace()
  356. L_0x00a5:
  357. return r2
  358. L_0x00a6:
  359. epson.print.service.EpsonService r3 = r7.mEpsonService // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  360. r5 = 75
  361. r3.epsNotifyPage(r5) // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  362. epson.print.service.EpsonService r3 = r7.mEpsonService // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  363. boolean r3 = r3.getCancelPrinting() // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  364. if (r3 == 0) goto L_0x00d0
  365. epson.print.service.EpsonService r3 = r7.mEpsonService
  366. android.content.Context r3 = r3.getApplicationContext()
  367. com.epson.iprint.prtlogger.Analytics.savePrintInfo(r3, r1)
  368. if (r2 == 0) goto L_0x00c5
  369. epson.print.service.EpsonService r3 = r7.mEpsonService
  370. r3.epsNotifyError(r0, r2, r1)
  371. L_0x00c5:
  372. epson.print.service.EpsonService r0 = r7.mEpsonService // Catch:{ RemoteException -> 0x00cb }
  373. r0.epsonConnectEndJob() // Catch:{ RemoteException -> 0x00cb }
  374. goto L_0x00cf
  375. L_0x00cb:
  376. r0 = move-exception
  377. r0.printStackTrace()
  378. L_0x00cf:
  379. return r1
  380. L_0x00d0:
  381. epson.print.service.EpsonService r3 = r7.mEpsonService // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  382. r5 = 1
  383. int r2 = r3.epsonConnectUploadFile(r4, r5) // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  384. if (r2 == 0) goto L_0x00f4
  385. epson.print.service.EpsonService r3 = r7.mEpsonService
  386. android.content.Context r3 = r3.getApplicationContext()
  387. com.epson.iprint.prtlogger.Analytics.savePrintInfo(r3, r1)
  388. if (r2 == 0) goto L_0x00e9
  389. epson.print.service.EpsonService r3 = r7.mEpsonService
  390. r3.epsNotifyError(r0, r2, r1)
  391. L_0x00e9:
  392. epson.print.service.EpsonService r0 = r7.mEpsonService // Catch:{ RemoteException -> 0x00ef }
  393. r0.epsonConnectEndJob() // Catch:{ RemoteException -> 0x00ef }
  394. goto L_0x00f3
  395. L_0x00ef:
  396. r0 = move-exception
  397. r0.printStackTrace()
  398. L_0x00f3:
  399. return r2
  400. L_0x00f4:
  401. epson.print.service.EpsonService r3 = r7.mEpsonService // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  402. r4 = 80
  403. r3.epsNotifyPage(r4) // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  404. epson.print.service.EpsonService r3 = r7.mEpsonService // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  405. boolean r3 = r3.getCancelPrinting() // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  406. if (r3 == 0) goto L_0x011e
  407. epson.print.service.EpsonService r3 = r7.mEpsonService
  408. android.content.Context r3 = r3.getApplicationContext()
  409. com.epson.iprint.prtlogger.Analytics.savePrintInfo(r3, r1)
  410. if (r2 == 0) goto L_0x0113
  411. epson.print.service.EpsonService r3 = r7.mEpsonService
  412. r3.epsNotifyError(r0, r2, r1)
  413. L_0x0113:
  414. epson.print.service.EpsonService r0 = r7.mEpsonService // Catch:{ RemoteException -> 0x0119 }
  415. r0.epsonConnectEndJob() // Catch:{ RemoteException -> 0x0119 }
  416. goto L_0x011d
  417. L_0x0119:
  418. r0 = move-exception
  419. r0.printStackTrace()
  420. L_0x011d:
  421. return r1
  422. L_0x011e:
  423. epson.print.service.EpsonService r3 = r7.mEpsonService // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  424. int r4 = r7.mCopies // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  425. r3.setEpsonConnectCopies(r4) // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  426. epson.print.service.EpsonService r3 = r7.mEpsonService // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  427. int r2 = r3.epsonConnectChangePrintSetting() // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  428. if (r2 == 0) goto L_0x0148
  429. epson.print.service.EpsonService r3 = r7.mEpsonService
  430. android.content.Context r3 = r3.getApplicationContext()
  431. com.epson.iprint.prtlogger.Analytics.savePrintInfo(r3, r1)
  432. if (r2 == 0) goto L_0x013d
  433. epson.print.service.EpsonService r3 = r7.mEpsonService
  434. r3.epsNotifyError(r0, r2, r1)
  435. L_0x013d:
  436. epson.print.service.EpsonService r0 = r7.mEpsonService // Catch:{ RemoteException -> 0x0143 }
  437. r0.epsonConnectEndJob() // Catch:{ RemoteException -> 0x0143 }
  438. goto L_0x0147
  439. L_0x0143:
  440. r0 = move-exception
  441. r0.printStackTrace()
  442. L_0x0147:
  443. return r2
  444. L_0x0148:
  445. epson.print.service.EpsonService r3 = r7.mEpsonService // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  446. r4 = 90
  447. r3.epsNotifyPage(r4) // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  448. epson.print.service.EpsonService r3 = r7.mEpsonService // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  449. boolean r3 = r3.getCancelPrinting() // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  450. if (r3 == 0) goto L_0x0172
  451. epson.print.service.EpsonService r3 = r7.mEpsonService
  452. android.content.Context r3 = r3.getApplicationContext()
  453. com.epson.iprint.prtlogger.Analytics.savePrintInfo(r3, r1)
  454. if (r2 == 0) goto L_0x0167
  455. epson.print.service.EpsonService r3 = r7.mEpsonService
  456. r3.epsNotifyError(r0, r2, r1)
  457. L_0x0167:
  458. epson.print.service.EpsonService r0 = r7.mEpsonService // Catch:{ RemoteException -> 0x016d }
  459. r0.epsonConnectEndJob() // Catch:{ RemoteException -> 0x016d }
  460. goto L_0x0171
  461. L_0x016d:
  462. r0 = move-exception
  463. r0.printStackTrace()
  464. L_0x0171:
  465. return r1
  466. L_0x0172:
  467. epson.print.service.EpsonService r3 = r7.mEpsonService // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  468. int r2 = r3.epsonConnectStartPrint(r1, r1) // Catch:{ Exception -> 0x01b6, all -> 0x01b4 }
  469. if (r2 == 0) goto L_0x0195
  470. epson.print.service.EpsonService r3 = r7.mEpsonService
  471. android.content.Context r3 = r3.getApplicationContext()
  472. com.epson.iprint.prtlogger.Analytics.savePrintInfo(r3, r1)
  473. if (r2 == 0) goto L_0x018a
  474. epson.print.service.EpsonService r3 = r7.mEpsonService
  475. r3.epsNotifyError(r0, r2, r1)
  476. L_0x018a:
  477. epson.print.service.EpsonService r0 = r7.mEpsonService // Catch:{ RemoteException -> 0x0190 }
  478. r0.epsonConnectEndJob() // Catch:{ RemoteException -> 0x0190 }
  479. goto L_0x0194
  480. L_0x0190:
  481. r0 = move-exception
  482. r0.printStackTrace()
  483. L_0x0194:
  484. return r2
  485. L_0x0195:
  486. epson.print.service.EpsonService r3 = r7.mEpsonService // Catch:{ Exception -> 0x01b2 }
  487. r4 = 100
  488. r3.epsNotifyPage(r4) // Catch:{ Exception -> 0x01b2 }
  489. epson.print.service.EpsonService r3 = r7.mEpsonService
  490. android.content.Context r3 = r3.getApplicationContext()
  491. com.epson.iprint.prtlogger.Analytics.savePrintInfo(r3, r5)
  492. if (r2 == 0) goto L_0x01ac
  493. epson.print.service.EpsonService r3 = r7.mEpsonService
  494. r3.epsNotifyError(r0, r2, r1)
  495. L_0x01ac:
  496. epson.print.service.EpsonService r0 = r7.mEpsonService // Catch:{ RemoteException -> 0x01d8 }
  497. r0.epsonConnectEndJob() // Catch:{ RemoteException -> 0x01d8 }
  498. goto L_0x01dc
  499. L_0x01b2:
  500. r3 = move-exception
  501. goto L_0x01bf
  502. L_0x01b4:
  503. r3 = move-exception
  504. goto L_0x01ba
  505. L_0x01b6:
  506. r3 = move-exception
  507. goto L_0x01be
  508. L_0x01b8:
  509. r3 = move-exception
  510. r2 = 0
  511. L_0x01ba:
  512. r5 = 0
  513. goto L_0x01de
  514. L_0x01bc:
  515. r3 = move-exception
  516. r2 = 0
  517. L_0x01be:
  518. r5 = 0
  519. L_0x01bf:
  520. r3.printStackTrace() // Catch:{ all -> 0x01dd }
  521. r2 = -1200(0xfffffffffffffb50, float:NaN)
  522. epson.print.service.EpsonService r3 = r7.mEpsonService
  523. android.content.Context r3 = r3.getApplicationContext()
  524. com.epson.iprint.prtlogger.Analytics.savePrintInfo(r3, r5)
  525. epson.print.service.EpsonService r3 = r7.mEpsonService
  526. r3.epsNotifyError(r0, r2, r1)
  527. epson.print.service.EpsonService r0 = r7.mEpsonService // Catch:{ RemoteException -> 0x01d8 }
  528. r0.epsonConnectEndJob() // Catch:{ RemoteException -> 0x01d8 }
  529. goto L_0x01dc
  530. L_0x01d8:
  531. r0 = move-exception
  532. r0.printStackTrace()
  533. L_0x01dc:
  534. return r1
  535. L_0x01dd:
  536. r3 = move-exception
  537. L_0x01de:
  538. epson.print.service.EpsonService r4 = r7.mEpsonService
  539. android.content.Context r4 = r4.getApplicationContext()
  540. com.epson.iprint.prtlogger.Analytics.savePrintInfo(r4, r5)
  541. if (r2 == 0) goto L_0x01ee
  542. epson.print.service.EpsonService r4 = r7.mEpsonService
  543. r4.epsNotifyError(r0, r2, r1)
  544. L_0x01ee:
  545. epson.print.service.EpsonService r0 = r7.mEpsonService // Catch:{ RemoteException -> 0x01f4 }
  546. r0.epsonConnectEndJob() // Catch:{ RemoteException -> 0x01f4 }
  547. goto L_0x01f8
  548. L_0x01f4:
  549. r0 = move-exception
  550. r0.printStackTrace()
  551. L_0x01f8:
  552. throw r3
  553. */
  554. throw new UnsupportedOperationException("Method not decompiled: epson.print.service.PrintAndLayoutThread.remotePrint():int");
  555. }
  556. protected int[] getRemotePrintableArea(int i, int i2) {
  557. Info_paper infoPaper = Info_paper.getInfoPaper(mEpsonService.getApplicationContext(), i);
  558. int[] iArr = new int[2];
  559. if (i2 == 2) {
  560. iArr[0] = infoPaper.getPaper_width_boder();
  561. iArr[1] = infoPaper.getPaper_height_boder();
  562. } else if (i2 == 1) {
  563. iArr[0] = infoPaper.getPaper_width_boderless();
  564. iArr[1] = infoPaper.getPaper_height_boderless();
  565. }
  566. return iArr;
  567. }
  568. static int convertBmpToJpeg(String str, String str2) {
  569. return new epsonImage().bmp2Jpg2(str, str2);
  570. }
  571. protected EPImageUtil getEPImageUtil() {
  572. return new EPImageUtil();
  573. }
  574. private void updateRemoteImageCreateProgress() {
  575. int i = mRemoteImageCreateProgress;
  576. int[] iArr = REMOTE_IMAGE_CREATE_PROGRESS;
  577. if (i < iArr.length) {
  578. mEpsonService.epsNotifyPage(iArr[i]);
  579. mRemoteImageCreateProgress++;
  580. return;
  581. }
  582. mEpsonService.epsNotifyPage(iArr[iArr.length - 1]);
  583. }
  584. /* JADX WARNING: Code restructure failed: missing block: B:26:0x0072, code lost:
  585. r7 = r7 + 1;
  586. r6[0] = r6[0] / 2;
  587. r6[1] = r6[1] / 2;
  588. */
  589. /* Code decompiled incorrectly, please refer to instructions dump. */
  590. private int makeRemoteFile(java.lang.String r18, java.lang.String r19) {
  591. /*
  592. r17 = this;
  593. r0 = r17
  594. r1 = r18
  595. r2 = r19
  596. java.util.List<com.epson.cameracopy.printlayout.ImageAndLayout> r3 = r0.mImageAndLayoutList
  597. r4 = 0
  598. java.lang.Object r3 = r3.get(r4)
  599. com.epson.cameracopy.printlayout.ImageAndLayout r3 = (com.epson.cameracopy.printlayout.ImageAndLayout) r3
  600. epson.print.EPImageUtil r5 = r17.getEPImageUtil()
  601. int r6 = r0.mPaperSizeId
  602. int r7 = r0.mLayout
  603. int[] r6 = r0.getRemotePrintableArea(r6, r7)
  604. r0.mRemoteImageCreateProgress = r4
  605. r7 = 0
  606. L_0x001e:
  607. r8 = 2
  608. if (r7 >= r8) goto L_0x007f
  609. boolean r9 = r0.createPrintImage(r3, r1, r6)
  610. if (r9 != 0) goto L_0x002a
  611. r1 = -5201(0xffffffffffffebaf, float:NaN)
  612. return r1
  613. L_0x002a:
  614. r17.updateRemoteImageCreateProgress()
  615. epson.print.service.EpsonService r9 = r0.mEpsonService
  616. boolean r9 = r9.getCancelPrinting()
  617. if (r9 == 0) goto L_0x0036
  618. return r4
  619. L_0x0036:
  620. java.io.File r9 = new java.io.File
  621. r9.<init>(r2)
  622. r10 = 1
  623. if (r7 < r10) goto L_0x0043
  624. int[] r11 = REMOTE_JPEG_QUALITYS
  625. int r11 = r11.length
  626. int r11 = r11 - r10
  627. goto L_0x0044
  628. L_0x0043:
  629. r11 = 0
  630. L_0x0044:
  631. int[] r12 = REMOTE_JPEG_QUALITYS
  632. int r13 = r12.length
  633. if (r11 >= r13) goto L_0x0072
  634. r12 = r12[r11]
  635. int r12 = r5.bmp2jpg(r1, r2, r12)
  636. long r13 = r9.length()
  637. if (r12 != 0) goto L_0x0063
  638. r15 = 0
  639. int r12 = (r13 > r15 ? 1 : (r13 == r15 ? 0 : -1))
  640. if (r12 <= 0) goto L_0x0063
  641. r15 = 10000000(0x989680, double:4.9406565E-317)
  642. int r12 = (r13 > r15 ? 1 : (r13 == r15 ? 0 : -1))
  643. if (r12 >= 0) goto L_0x0063
  644. return r4
  645. L_0x0063:
  646. r17.updateRemoteImageCreateProgress()
  647. epson.print.service.EpsonService r12 = r0.mEpsonService
  648. boolean r12 = r12.getCancelPrinting()
  649. if (r12 == 0) goto L_0x006f
  650. return r4
  651. L_0x006f:
  652. int r11 = r11 + 1
  653. goto L_0x0044
  654. L_0x0072:
  655. int r7 = r7 + 1
  656. r9 = r6[r4]
  657. int r9 = r9 / r8
  658. r6[r4] = r9
  659. r9 = r6[r10]
  660. int r9 = r9 / r8
  661. r6[r10] = r9
  662. goto L_0x001e
  663. L_0x007f:
  664. r1 = -1205(0xfffffffffffffb4b, float:NaN)
  665. return r1
  666. */
  667. throw new UnsupportedOperationException("Method not decompiled: epson.print.service.PrintAndLayoutThread.makeRemoteFile(java.lang.String, java.lang.String):int");
  668. }
  669. protected int test_makeRemoteFile(String str, String str2) {
  670. return makeRemoteFile(str, str2);
  671. }
  672. }