12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139 |
- package epson.maintain;
- import android.content.Context;
- import android.os.AsyncTask;
- import android.util.Log;
- import com.epson.iprint.prtlogger.Analytics;
- import com.epson.mobilephone.common.escpr.EscprLib;
- import com.epson.mobilephone.common.maintain2.BatteryInfoEx;
- import com.epson.mobilephone.common.maintain2.MaintainPrinter2;
- import epson.common.ExternalFileUtils;
- import epson.common.IPAddressUtils;
- import epson.print.CommonDefine;
- import epson.print.MyPrinter;
- import epson.print.Util.EPLog;
- import java.io.File;
- import java.io.FilterOutputStream;
- import java.io.IOException;
- import java.io.OutputStream;
- import java.util.EnumMap;
- import java.util.Locale;
- import java.util.UUID;
- public class FirmwareManager {
- static final int BUFFER_SIZE = 4096;
- static final boolean DEV_FWUPDATE = false;
- static final String EVAL_UPDATEINF_URL_PREFIX = "https://epsonpfu-stg.ebz.epson.net";
- static String FW_POST_FILE_NAME = "/FWUPDATE_POST_DATA.dat";
- private static String FW_POST_FILE_PATH = null;
- private static final String TAG = "FirmwareManager";
- static final String UPDATEINF_URL_PREFIX = "https://epsonpfu.ebz.epson.net";
- private final String boundary;
- private final String lineEnd;
- int mCurRomNum;
- String mCurVer;
- byte[] mDlData;
- AsyncTask<FWUpdateStep, Integer, FWUpdateProcResult> mFWUpdateTask;
- private FirmInfFile mFirmInfFile;
- String mMarketID;
- String mNewVer;
- private final MyPrinter mPrinter;
- private String mPrinterMainVersion;
- FWUpdateProcResult mProcResult;
- FWUpdateStep mProcStep;
- String mSendProtocol;
- long mTotalSize;
- private volatile String mUpdateInfUrl;
- private volatile FWUpdateListener mUpdateListener;
- private final MaintainPrinterWrapper maintainPrinter;
- private final String twoHyphens;
- public interface FWUpdateListener {
- void fwManagerDidEndProc(FWUpdateProcResult fWUpdateProcResult, FWUpdateStep fWUpdateStep);
- void fwManagerProcDoing(int i);
- }
- public enum FWUpdateProcResult {
- None,
- Success,
- Cancel,
- Fail,
- NotVerUp,
- NotSupport,
- Interrupted,
- DiskFull,
- NotAC,
- PrinterBadStatus
- }
- public enum FWUpdateStep {
- Init,
- GetPrinterFWVersion,
- GetUpdateInf,
- Download,
- ReadyUpdate,
- Send
- }
- public interface ProgressListener {
- void transferred(long j);
- }
- public FirmwareManager(Context context, MyPrinter myPrinter) {
- this(myPrinter, new File(ExternalFileUtils.getInstance(context).getDownloadDir(), FW_POST_FILE_NAME).getPath(), new MaintainPrinterWrapper());
- }
- @VisibleForTesting
- FirmwareManager(MyPrinter myPrinter, @NonNull String str, @Nullable MaintainPrinterWrapper maintainPrinterWrapper) {
- twoHyphens = "--";
- boundary = "*****" + UUID.randomUUID().toString() + "*****";
- lineEnd = "\r\n";
- mFirmInfFile = new FirmInfFile();
- mProcResult = FWUpdateProcResult.None;
- mProcStep = FWUpdateStep.Init;
- mFWUpdateTask = buildFWUpdateTask();
- mPrinter = myPrinter;
- FW_POST_FILE_PATH = str;
- maintainPrinter = maintainPrinterWrapper;
- }
- private void endConnect() {
- mFWUpdateTask.cancel(true);
- }
- private void startProc(FWUpdateStep fWUpdateStep) {
- mProcStep = fWUpdateStep;
- mProcResult = FWUpdateProcResult.None;
- mFWUpdateTask = buildFWUpdateTask();
- mFWUpdateTask.execute(new FWUpdateStep[]{fWUpdateStep});
- }
- private void endWithProcResult(FWUpdateProcResult fWUpdateProcResult) {
- endConnect();
- if (fWUpdateProcResult != FWUpdateProcResult.Success) {
- removeSavedFile();
- }
- mProcResult = fWUpdateProcResult;
- if (mUpdateListener != null) {
- mUpdateListener.fwManagerDidEndProc(mProcResult, mProcStep);
- }
- }
- public void cancelProc() {
- endWithProcResult(FWUpdateProcResult.Cancel);
- }
- public void interruptProc() {
- endWithProcResult(FWUpdateProcResult.Interrupted);
- }
- private String getUpdateInfURL() {
- return String.format("%s/%s_model_%s/UPDATE.INF", new Object[]{getUpdateInfSchemeAndHost(), mPrinter.getName().replaceAll(" ", CommonDefine.UNDER_BAR), mMarketID});
- }
- private static String getUpdateInfSchemeAndHost() {
- return DEV_FWUPDATE ? EVAL_UPDATEINF_URL_PREFIX : UPDATEINF_URL_PREFIX;
- }
- private String getStartUpdateURL() {
- return IPAddressUtils.buildURL(mSendProtocol, mPrinter.getIp(), "/FIRMWAREUPDATE");
- }
- private String getSendFWURL() {
- return IPAddressUtils.buildURL(mSendProtocol, mPrinter.getIp(), "/DOWN/FIRMWAREUPDATE/ROM1");
- }
- private String getNextRomURL() {
- mCurRomNum++;
- return mFirmInfFile.getRomUrl(mCurRomNum);
- }
- public void startVersionCheck(FWUpdateListener fWUpdateListener) {
- mUpdateListener = fWUpdateListener;
- startProc(FWUpdateStep.GetPrinterFWVersion);
- }
- private FWUpdateProcResult getPrinterFWVer() {
- int firmwareInfo;
- String str;
- EnumMap enumMap = new EnumMap(EscprLib.PrinterFirmInfo.class);
- int i = 0;
- while (true) {
- firmwareInfo = maintainPrinter.getFirmwareInfo(enumMap);
- EPLog.m305d(TAG, "getFirmwareInfo = " + firmwareInfo);
- if (firmwareInfo != -1100) {
- break;
- }
- int i2 = i + 1;
- if (i >= 5) {
- break;
- }
- i = i2;
- }
- FWUpdateProcResult fWUpdateProcResult = FWUpdateProcResult.Fail;
- if (firmwareInfo == -1016) {
- return FWUpdateProcResult.NotSupport;
- }
- if (firmwareInfo != 0 || enumMap.isEmpty()) {
- return fWUpdateProcResult;
- }
- boolean equals = ((String) enumMap.get(EscprLib.PrinterFirmInfo.NicFlg)).equals("1");
- mMarketID = (String) enumMap.get(EscprLib.PrinterFirmInfo.MarketID);
- mPrinterMainVersion = (String) enumMap.get(EscprLib.PrinterFirmInfo.MainVer);
- String str2 = mPrinterMainVersion;
- if (str2 == null) {
- return FWUpdateProcResult.NotSupport;
- }
- mCurVer = String.format("%s.%s", new Object[]{str2, enumMap.get(EscprLib.PrinterFirmInfo.NetVer)});
- if (mCurVer == null || (str = mMarketID) == null || "NA".equals(str) || equals) {
- return FWUpdateProcResult.NotSupport;
- }
- mUpdateInfUrl = getUpdateInfUrlForAllUrlVer(enumMap);
- if (mUpdateInfUrl == null) {
- return FWUpdateProcResult.NotSupport;
- }
- FWUpdateProcResult checkNotBatteryPowered = checkNotBatteryPowered();
- return checkNotBatteryPowered != FWUpdateProcResult.Success ? checkNotBatteryPowered : checkNotBatteryPowered;
- }
- private FWUpdateProcResult checkNotBatteryPowered() {
- int batteryInfoEx;
- FWUpdateProcResult fWUpdateProcResult = FWUpdateProcResult.Success;
- BatteryInfoEx batteryInfoEx2 = new BatteryInfoEx();
- int i = 0;
- while (true) {
- batteryInfoEx = maintainPrinter.getBatteryInfoEx(batteryInfoEx2);
- EPLog.m305d(TAG, "getBatteryInfoEx = " + batteryInfoEx);
- if (batteryInfoEx != -1100) {
- break;
- }
- int i2 = i + 1;
- if (i >= 5) {
- break;
- }
- i = i2;
- }
- return (batteryInfoEx != 0 || batteryInfoEx2.powerSourceType == -1 || batteryInfoEx2.powerSourceType == 1) ? fWUpdateProcResult : FWUpdateProcResult.NotAC;
- }
- /* access modifiers changed from: package-private */
- @Nullable
- public String getUpdateInfUrlForAllUrlVer(@NonNull EnumMap<EscprLib.PrinterFirmInfo, String> enumMap) {
- String str = enumMap.get(EscprLib.PrinterFirmInfo.UrlVer);
- if (str == null) {
- return null;
- }
- char c = 65535;
- switch (str.hashCode()) {
- case 1536:
- if (str.equals("00")) {
- c = 0;
- break;
- }
- break;
- case 1537:
- if (str.equals("01")) {
- c = 1;
- break;
- }
- break;
- }
- switch (c) {
- case 0:
- return getUpdateInfURL();
- case 1:
- return getUpdateInfUrlV01(enumMap);
- default:
- return null;
- }
- }
- @Nullable
- @VisibleForTesting
- static String getUpdateInfUrlV01(@NonNull EnumMap<EscprLib.PrinterFirmInfo, String> enumMap) {
- String str;
- String str2 = enumMap.get(EscprLib.PrinterFirmInfo.FY);
- if (str2 == null || (str = enumMap.get(EscprLib.PrinterFirmInfo.MainVer)) == null || str.length() < 2) {
- return null;
- }
- return String.format(Locale.US, "%s/%s_%s_00/UPDATE.INF", new Object[]{getUpdateInfSchemeAndHost(), str2, str.substring(0, 2)});
- }
- public void startGetUpdateInf(FWUpdateListener fWUpdateListener) {
- mUpdateListener = fWUpdateListener;
- startProc(FWUpdateStep.GetUpdateInf);
- }
- /* access modifiers changed from: private */
- /* JADX WARNING: Can't wrap try/catch for region: R(2:10|11) */
- /* JADX WARNING: Code restructure failed: missing block: B:11:?, code lost:
- endWithProcResult(epson.maintain.FirmwareManager.FWUpdateProcResult.Fail);
- */
- /* JADX WARNING: Missing exception handler attribute for start block: B:10:0x001a */
- /* Code decompiled incorrectly, please refer to instructions dump. */
- public synchronized void localCheckInfFileVersion(byte[] r3) {
- /*
- r2 = this;
- monitor-enter(r2)
- epson.maintain.FirmInfFile r0 = r2.mFirmInfFile // Catch:{ all -> 0x002b }
- boolean r3 = r0.checkInfFileVersion(r3) // Catch:{ all -> 0x002b }
- if (r3 != 0) goto L_0x0010
- epson.maintain.FirmwareManager$FWUpdateProcResult r3 = epson.maintain.FirmwareManager.FWUpdateProcResult.Fail // Catch:{ all -> 0x002b }
- r2.endWithProcResult(r3) // Catch:{ all -> 0x002b }
- monitor-exit(r2)
- return
- L_0x0010:
- r3 = 0
- epson.maintain.FirmInfFile r0 = r2.mFirmInfFile // Catch:{ IllegalArgumentException -> 0x001a }
- java.lang.String r1 = r2.mPrinterMainVersion // Catch:{ IllegalArgumentException -> 0x001a }
- int r3 = r0.compareVersion(r1) // Catch:{ IllegalArgumentException -> 0x001a }
- goto L_0x001f
- L_0x001a:
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.Fail // Catch:{ all -> 0x002b }
- r2.endWithProcResult(r0) // Catch:{ all -> 0x002b }
- L_0x001f:
- if (r3 < 0) goto L_0x0024
- epson.maintain.FirmwareManager$FWUpdateProcResult r3 = epson.maintain.FirmwareManager.FWUpdateProcResult.NotVerUp // Catch:{ all -> 0x002b }
- goto L_0x0026
- L_0x0024:
- epson.maintain.FirmwareManager$FWUpdateProcResult r3 = epson.maintain.FirmwareManager.FWUpdateProcResult.Success // Catch:{ all -> 0x002b }
- L_0x0026:
- r2.endWithProcResult(r3) // Catch:{ all -> 0x002b }
- monitor-exit(r2)
- return
- L_0x002b:
- r3 = move-exception
- monitor-exit(r2)
- throw r3
- */
- throw new UnsupportedOperationException("Method not decompiled: epson.maintain.FirmwareManager.localCheckInfFileVersion(byte[]):void");
- }
- public void startFWDownload(FWUpdateListener fWUpdateListener) {
- mUpdateListener = fWUpdateListener;
- startProc(FWUpdateStep.Download);
- }
- public static void removeSavedFile() {
- try {
- File file = new File(FW_POST_FILE_PATH);
- if (file.exists()) {
- file.delete();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- static File createNewSaveFile() throws IOException, SecurityException {
- File file = new File(FW_POST_FILE_PATH);
- file.getParentFile().mkdirs();
- file.createNewFile();
- return file;
- }
- public static boolean isExistSaveFile() {
- try {
- return new File(FW_POST_FILE_PATH).exists();
- } catch (Exception unused) {
- return false;
- }
- }
- public void startFWUpdate(FWUpdateListener fWUpdateListener) {
- mUpdateListener = fWUpdateListener;
- startProc(FWUpdateStep.ReadyUpdate);
- }
- public static class CountingOutputStream extends FilterOutputStream {
- private final ProgressListener listener;
- private long transferred = 0;
- public CountingOutputStream(OutputStream outputStream, ProgressListener progressListener) {
- super(outputStream);
- listener = progressListener;
- }
- public void write(byte[] bArr, int i, int i2) throws IOException {
- out.write(bArr, i, i2);
- transferred += (long) i2;
- listener.transferred(this.transferred);
- }
- public void write(int i) throws IOException {
- out.write(i);
- transferred++;
- listener.transferred(this.transferred);
- }
- }
- private AsyncTask<FWUpdateStep, Integer, FWUpdateProcResult> buildFWUpdateTask() {
- return new LocalAsyncTask();
- }
- class LocalAsyncTask extends AsyncTask<FWUpdateStep, Integer, FWUpdateProcResult> {
- LocalAsyncTask() {
- }
- protected void onPreExecute() {
- FirmwareManager.mDlData = null;
- publishProgress(new Integer[0]);
- }
- protected FWUpdateProcResult doInBackground(FWUpdateStep... fWUpdateStepArr) {
- FirmwareManager.mProcResult = FWUpdateProcResult.None;
- int[] iArr = C20021.$SwitchMap$epson$maintain$FirmwareManager$FWUpdateStep;
- FirmwareManager firmwareManager = FirmwareManager.this;
- FWUpdateStep fWUpdateStep = fWUpdateStepArr[0];
- firmwareManager.mProcStep = fWUpdateStep;
- switch (iArr[fWUpdateStep.ordinal()]) {
- case 1:
- return FirmwareManager.this.getPrinterFWVer();
- case 2:
- if (FirmwareManager.mUpdateInfUrl == null) {
- return FWUpdateProcResult.NotSupport;
- }
- return download(FirmwareManager.mUpdateInfUrl, (File) null, false);
- case 3:
- switch (FirmwareManager.mFirmInfFile.getInfFileVersion()) {
- case 1:
- return downloadNewFW();
- case 2:
- return extractFirmDataFromRcx();
- default:
- return FWUpdateProcResult.Fail;
- }
- case 4:
- if (FirmwareManager.mPrinter.getIp() != null && FirmwareManager.isExistSaveFile()) {
- FirmwareManager firmwareManager2 = FirmwareManager.this;
- firmwareManager2.mSendProtocol = "https";
- FWUpdateProcResult download = download(firmwareManager2.getStartUpdateURL(), (File) null, false);
- if (download == FWUpdateProcResult.Success) {
- return download;
- }
- FirmwareManager firmwareManager3 = FirmwareManager.this;
- firmwareManager3.mSendProtocol = Analytics.EXTENSION_STRING_WEB;
- return download(firmwareManager3.getStartUpdateURL(), (File) null, false);
- }
- case 5:
- return sendFW();
- }
- return FWUpdateProcResult.Fail;
- }
- protected void onPostExecute(FWUpdateProcResult fWUpdateProcResult) {
- if (fWUpdateProcResult == FWUpdateProcResult.Success) {
- switch (FirmwareManager.mProcStep) {
- case GetPrinterFWVersion:
- FirmwareManager.this.endWithProcResult(fWUpdateProcResult);
- return;
- case GetUpdateInf:
- FirmwareManager firmwareManager = FirmwareManager.this;
- firmwareManager.localCheckInfFileVersion(firmwareManager.mDlData);
- return;
- case Download:
- FirmwareManager.this.endWithProcResult(fWUpdateProcResult);
- return;
- case ReadyUpdate:
- FirmwareManager.this.startProc(FWUpdateStep.Send);
- return;
- case Send:
- FirmwareManager.this.endWithProcResult(fWUpdateProcResult);
- return;
- default:
- FirmwareManager.this.endWithProcResult(FWUpdateProcResult.Fail);
- return;
- }
- } else {
- FirmwareManager.this.endWithProcResult(fWUpdateProcResult);
- }
- }
- protected void onProgressUpdate(Integer... numArr) {
- int i = 0;
- if (numArr.length == 1 && C20021.$SwitchMap$epson$maintain$FirmwareManager$FWUpdateStep[FirmwareManager.mProcStep.ordinal()] != 4) {
- i = numArr[0].intValue();
- }
- FirmwareManager.mUpdateListener.fwManagerProcDoing(i);
- }
- protected void onCancelled() {
- Log.d(toString(), "onCancelled");
- }
- private FWUpdateProcResult downloadEfuFile(File file) {
- String str = FirmwareManager.mFirmInfFile.getfuUrl();
- if (str == null) {
- return FWUpdateProcResult.NotSupport;
- }
- return download(str, file, false);
- }
- /* JADX WARNING: Code restructure failed: missing block: B:19:0x0059, code lost:
- if (r2.exists() != false) goto L_0x005b;
- */
- /* JADX WARNING: Code restructure failed: missing block: B:20:0x005b, code lost:
- r2.delete();
- */
- /* JADX WARNING: Code restructure failed: missing block: B:21:0x005f, code lost:
- r0 = move-exception;
- */
- /* JADX WARNING: Code restructure failed: missing block: B:23:?, code lost:
- r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.Fail;
- */
- /* JADX WARNING: Code restructure failed: missing block: B:25:0x0067, code lost:
- if (r1.exists() != false) goto L_0x0069;
- */
- /* JADX WARNING: Code restructure failed: missing block: B:26:0x0069, code lost:
- r1.delete();
- */
- /* JADX WARNING: Code restructure failed: missing block: B:28:0x0070, code lost:
- if (r2.exists() == false) goto L_0x0085;
- */
- /* JADX WARNING: Code restructure failed: missing block: B:30:?, code lost:
- r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.DiskFull;
- */
- /* JADX WARNING: Code restructure failed: missing block: B:32:0x0079, code lost:
- if (r1.exists() != false) goto L_0x007b;
- */
- /* JADX WARNING: Code restructure failed: missing block: B:33:0x007b, code lost:
- r1.delete();
- */
- /* JADX WARNING: Code restructure failed: missing block: B:35:0x0082, code lost:
- if (r2.exists() == false) goto L_0x0085;
- */
- /* JADX WARNING: Code restructure failed: missing block: B:36:0x0085, code lost:
- return r0;
- */
- /* JADX WARNING: Code restructure failed: missing block: B:38:0x008a, code lost:
- if (r1.exists() != false) goto L_0x008c;
- */
- /* JADX WARNING: Code restructure failed: missing block: B:39:0x008c, code lost:
- r1.delete();
- */
- /* JADX WARNING: Code restructure failed: missing block: B:41:0x0093, code lost:
- if (r2.exists() != false) goto L_0x0095;
- */
- /* JADX WARNING: Code restructure failed: missing block: B:42:0x0095, code lost:
- r2.delete();
- */
- /* JADX WARNING: Code restructure failed: missing block: B:43:0x0098, code lost:
- throw r0;
- */
- /* JADX WARNING: Exception block dominator not found, dom blocks: [B:22:0x0061, B:29:0x0073] */
- /* JADX WARNING: Missing exception handler attribute for start block: B:22:0x0061 */
- /* JADX WARNING: Missing exception handler attribute for start block: B:29:0x0073 */
- /* JADX WARNING: Unknown top exception splitter block from list: {B:22:0x0061=Splitter:B:22:0x0061, B:29:0x0073=Splitter:B:29:0x0073} */
- /* Code decompiled incorrectly, please refer to instructions dump. */
- private epson.maintain.FirmwareManager.FWUpdateProcResult extractFirmDataFromRcx() {
- /*
- r5 = this;
- java.io.File r0 = epson.maintain.FirmwareManager.createNewSaveFile() // Catch:{ IOException -> 0x0099 }
- java.io.File r1 = new java.io.File
- java.io.File r2 = r0.getParentFile()
- java.lang.String r3 = "zip.efu"
- r1.<init>(r2, r3)
- java.io.File r2 = new java.io.File
- java.io.File r3 = r0.getParentFile()
- java.lang.String r4 = "unzip.efu"
- r2.<init>(r3, r4)
- epson.maintain.FirmwareManager$FWUpdateProcResult r3 = epson.maintain.FirmwareManager.FWUpdateProcResult.Fail
- epson.maintain.FirmwareManager$FWUpdateProcResult r3 = r5.downloadEfuFile(r1) // Catch:{ WriteException -> 0x0073, IOException -> 0x0061 }
- epson.maintain.FirmwareManager$FWUpdateProcResult r4 = epson.maintain.FirmwareManager.FWUpdateProcResult.Success // Catch:{ WriteException -> 0x0073, IOException -> 0x0061 }
- if (r3 == r4) goto L_0x0037
- boolean r0 = r1.exists()
- if (r0 == 0) goto L_0x002d
- r1.delete()
- L_0x002d:
- boolean r0 = r2.exists()
- if (r0 == 0) goto L_0x0036
- r2.delete()
- L_0x0036:
- return r3
- L_0x0037:
- java.lang.String r3 = r1.getPath() // Catch:{ WriteException -> 0x0073, IOException -> 0x0061 }
- java.lang.String r4 = r2.getPath() // Catch:{ WriteException -> 0x0073, IOException -> 0x0061 }
- epson.maintain.EfuReader.unzipOnlyOneEntry(r3, r4) // Catch:{ WriteException -> 0x0073, IOException -> 0x0061 }
- epson.maintain.EfuReader r3 = new epson.maintain.EfuReader // Catch:{ WriteException -> 0x0073, IOException -> 0x0061 }
- r3.<init>() // Catch:{ WriteException -> 0x0073, IOException -> 0x0061 }
- r3.writeOnlyOneFirmwareData(r2, r0) // Catch:{ WriteException -> 0x0073, IOException -> 0x0061 }
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.Success // Catch:{ WriteException -> 0x0073, IOException -> 0x0061 }
- boolean r3 = r1.exists()
- if (r3 == 0) goto L_0x0055
- r1.delete()
- L_0x0055:
- boolean r1 = r2.exists()
- if (r1 == 0) goto L_0x0085
- L_0x005b:
- r2.delete()
- goto L_0x0085
- L_0x005f:
- r0 = move-exception
- goto L_0x0086
- L_0x0061:
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.Fail // Catch:{ all -> 0x005f }
- boolean r3 = r1.exists()
- if (r3 == 0) goto L_0x006c
- r1.delete()
- L_0x006c:
- boolean r1 = r2.exists()
- if (r1 == 0) goto L_0x0085
- goto L_0x005b
- L_0x0073:
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.DiskFull // Catch:{ all -> 0x005f }
- boolean r3 = r1.exists()
- if (r3 == 0) goto L_0x007e
- r1.delete()
- L_0x007e:
- boolean r1 = r2.exists()
- if (r1 == 0) goto L_0x0085
- goto L_0x005b
- L_0x0085:
- return r0
- L_0x0086:
- boolean r3 = r1.exists()
- if (r3 == 0) goto L_0x008f
- r1.delete()
- L_0x008f:
- boolean r1 = r2.exists()
- if (r1 == 0) goto L_0x0098
- r2.delete()
- L_0x0098:
- throw r0
- L_0x0099:
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.DiskFull
- return r0
- */
- throw new UnsupportedOperationException("Method not decompiled: epson.maintain.FirmwareManager.LocalAsyncTask.extractFirmDataFromRcx():epson.maintain.FirmwareManager$FWUpdateProcResult");
- }
- private FWUpdateProcResult download(String str, File file, boolean z) {
- return download(str, file, z, 1, 1);
- }
- /* JADX WARNING: type inference failed for: r0v7, types: [java.net.URLConnection] */
- /* access modifiers changed from: package-private */
- /* JADX WARNING: Code restructure failed: missing block: B:105:0x0139, code lost:
- if (r13 != null) goto L_0x0105;
- */
- /* JADX WARNING: Code restructure failed: missing block: B:75:0x0103, code lost:
- if (r13 != null) goto L_0x0105;
- */
- /* JADX WARNING: Code restructure failed: missing block: B:78:?, code lost:
- r13.disconnect();
- */
- /* JADX WARNING: Failed to process nested try/catch */
- /* JADX WARNING: Missing exception handler attribute for start block: B:73:0x0100 */
- /* JADX WARNING: Multi-variable type inference failed */
- /* JADX WARNING: Removed duplicated region for block: B:102:0x0134 A[SYNTHETIC, Splitter:B:102:0x0134] */
- /* JADX WARNING: Removed duplicated region for block: B:111:0x0142 A[SYNTHETIC, Splitter:B:111:0x0142] */
- /* JADX WARNING: Removed duplicated region for block: B:115:0x0149 A[SYNTHETIC, Splitter:B:115:0x0149] */
- /* JADX WARNING: Removed duplicated region for block: B:119:0x0150 A[SYNTHETIC, Splitter:B:119:0x0150] */
- /* JADX WARNING: Removed duplicated region for block: B:98:0x012d A[SYNTHETIC, Splitter:B:98:0x012d] */
- /* JADX WARNING: Unknown top exception splitter block from list: {B:39:0x0076=Splitter:B:39:0x0076, B:32:0x006e=Splitter:B:32:0x006e} */
- /* Code decompiled incorrectly, please refer to instructions dump. */
- public epson.maintain.FirmwareManager.FWUpdateProcResult download(java.lang.String r20, java.io.File r21, boolean r22, int r23, int r24) {
- /*
- r19 = this;
- r1 = r19
- r0 = r20
- r2 = r21
- if (r0 != 0) goto L_0x000b
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.Fail
- return r0
- L_0x000b:
- r3 = 1
- java.lang.Integer[] r4 = new java.lang.Integer[r3]
- int r5 = r23 + -1
- double r5 = r5
- r7 = 4636737291354636288(0x4059000000000000, double:100.0)
- double r9 = r5 * r7
- r11 = r24
- double r11 = r11
- double r9 = r9 / r11
- int r9 = r9
- java.lang.Integer r9 = java.lang.Integer.valueOf(r9)
- r10 = 0
- r4[r10] = r9
- r1.publishProgress(r4)
- epson.maintain.FirmwareManager$FWUpdateProcResult r4 = epson.maintain.FirmwareManager.FWUpdateProcResult.Success
- java.net.URL r13 = new java.net.URL // Catch:{ Exception -> 0x0122, all -> 0x011d }
- r13.<init>(r0) // Catch:{ Exception -> 0x0122, all -> 0x011d }
- java.net.URLConnection r0 = r13.openConnection() // Catch:{ Exception -> 0x0122, all -> 0x011d }
- r13 = r0
- java.net.HttpURLConnection r13 = (java.net.HttpURLConnection) r13 // Catch:{ Exception -> 0x0122, all -> 0x011d }
- java.lang.String r0 = "GET"
- r13.setRequestMethod(r0) // Catch:{ Exception -> 0x0119, all -> 0x0116 }
- r13.connect() // Catch:{ Exception -> 0x0119, all -> 0x0116 }
- int r0 = r13.getResponseCode() // Catch:{ Exception -> 0x0119, all -> 0x0116 }
- r14 = 400(0x190, float:5.6E-43)
- r15 = 500(0x1f4, float:7.0E-43)
- if (r14 > r0) goto L_0x004e
- if (r0 >= r15) goto L_0x004e
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.NotSupport // Catch:{ Exception -> 0x0119, all -> 0x0116 }
- if (r13 == 0) goto L_0x004d
- r13.disconnect() // Catch:{ Exception -> 0x004d }
- L_0x004d:
- return r0
- L_0x004e:
- if (r15 > r0) goto L_0x0076
- r14 = 600(0x258, float:8.41E-43)
- if (r0 >= r14) goto L_0x0076
- if (r15 != r0) goto L_0x006e
- int[] r0 = epson.maintain.FirmwareManager.C20021.$SwitchMap$epson$maintain$FirmwareManager$FWUpdateStep // Catch:{ Exception -> 0x0119, all -> 0x0116 }
- epson.maintain.FirmwareManager r2 = epson.maintain.FirmwareManager.this // Catch:{ Exception -> 0x0119, all -> 0x0116 }
- epson.maintain.FirmwareManager$FWUpdateStep r2 = r2.mProcStep // Catch:{ Exception -> 0x0119, all -> 0x0116 }
- int r2 = r2.ordinal() // Catch:{ Exception -> 0x0119, all -> 0x0116 }
- r0 = r0[r2] // Catch:{ Exception -> 0x0119, all -> 0x0116 }
- switch(r0) {
- case 4: goto L_0x0066;
- case 5: goto L_0x0066;
- default: goto L_0x0065;
- } // Catch:{ Exception -> 0x0119, all -> 0x0116 }
- L_0x0065:
- goto L_0x006e
- L_0x0066:
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.PrinterBadStatus // Catch:{ Exception -> 0x0119, all -> 0x0116 }
- if (r13 == 0) goto L_0x006d
- r13.disconnect() // Catch:{ Exception -> 0x006d }
- L_0x006d:
- return r0
- L_0x006e:
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.Fail // Catch:{ Exception -> 0x0119, all -> 0x0116 }
- if (r13 == 0) goto L_0x0075
- r13.disconnect() // Catch:{ Exception -> 0x0075 }
- L_0x0075:
- return r0
- L_0x0076:
- java.io.BufferedInputStream r14 = new java.io.BufferedInputStream // Catch:{ Exception -> 0x0119, all -> 0x0116 }
- java.io.InputStream r0 = r13.getInputStream() // Catch:{ Exception -> 0x0119, all -> 0x0116 }
- r15 = 4096(0x1000, float:5.74E-42)
- r14.<init>(r0, r15) // Catch:{ Exception -> 0x0119, all -> 0x0116 }
- if (r2 == 0) goto L_0x008b
- java.io.FileOutputStream r0 = new java.io.FileOutputStream // Catch:{ Exception -> 0x0112, all -> 0x010f }
- r9 = r22
- r0.<init>(r2, r9) // Catch:{ Exception -> 0x0112, all -> 0x010f }
- goto L_0x0090
- L_0x008b:
- java.io.ByteArrayOutputStream r0 = new java.io.ByteArrayOutputStream // Catch:{ Exception -> 0x0112, all -> 0x010f }
- r0.<init>() // Catch:{ Exception -> 0x0112, all -> 0x010f }
- L_0x0090:
- r9 = r0
- byte[] r0 = new byte[r15] // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- int r2 = r13.getContentLength() // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- long r7 = (long) r2 // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- r17 = 0
- L_0x009a:
- int r2 = r14.read(r0) // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- r15 = -1
- if (r2 == r15) goto L_0x00e5
- boolean r15 = r19.isCancelled() // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- if (r15 == 0) goto L_0x00ad
- r13.disconnect() // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- epson.maintain.FirmwareManager$FWUpdateProcResult r4 = epson.maintain.FirmwareManager.FWUpdateProcResult.Cancel // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- goto L_0x00e7
- L_0x00ad:
- r24 = r4
- long r3 = (long) r2
- long r3 = r17 + r3
- r9.write(r0, r10, r2) // Catch:{ IOException -> 0x00da }
- r2 = 1
- java.lang.Integer[] r15 = new java.lang.Integer[r2] // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- r16 = r11
- double r10 = r3 // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- r22 = r3
- double r2 = r7 // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- double r10 = r10 / r2
- double r10 = r10 + r5
- r2 = 4636737291354636288(0x4059000000000000, double:100.0)
- double r10 = r10 * r2
- double r10 = r10 / r16
- int r10 = r10 // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- java.lang.Integer r10 = java.lang.Integer.valueOf(r10) // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- r11 = 0
- r15[r11] = r10 // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- r1.publishProgress(r15) // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- r4 = r24
- r11 = r16
- r3 = 1
- r10 = 0
- r17 = r22
- goto L_0x009a
- L_0x00da:
- boolean r0 = r9 instanceof java.io.ByteArrayOutputStream // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- if (r0 == 0) goto L_0x00e1
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.Fail // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- goto L_0x00e3
- L_0x00e1:
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.DiskFull // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- L_0x00e3:
- r4 = r0
- goto L_0x00e7
- L_0x00e5:
- r24 = r4
- L_0x00e7:
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.Success // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- if (r4 != r0) goto L_0x00fd
- r9.flush() // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- boolean r0 = r9 instanceof java.io.ByteArrayOutputStream // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- if (r0 == 0) goto L_0x00fd
- epson.maintain.FirmwareManager r0 = epson.maintain.FirmwareManager.this // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- r2 = r9
- java.io.ByteArrayOutputStream r2 = (java.io.ByteArrayOutputStream) r2 // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- byte[] r2 = r2.toByteArray() // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- r0.mDlData = r2 // Catch:{ Exception -> 0x010b, all -> 0x0109 }
- L_0x00fd:
- r14.close() // Catch:{ Exception -> 0x0100 }
- L_0x0100:
- r9.close() // Catch:{ Exception -> 0x0103 }
- L_0x0103:
- if (r13 == 0) goto L_0x013c
- L_0x0105:
- r13.disconnect() // Catch:{ Exception -> 0x013c }
- goto L_0x013c
- L_0x0109:
- r0 = move-exception
- goto L_0x0140
- L_0x010b:
- r0 = move-exception
- r2 = r9
- r9 = r14
- goto L_0x0126
- L_0x010f:
- r0 = move-exception
- r9 = 0
- goto L_0x0140
- L_0x0112:
- r0 = move-exception
- r9 = r14
- r2 = 0
- goto L_0x0126
- L_0x0116:
- r0 = move-exception
- r9 = 0
- goto L_0x0120
- L_0x0119:
- r0 = move-exception
- r2 = 0
- r9 = 0
- goto L_0x0126
- L_0x011d:
- r0 = move-exception
- r9 = 0
- r13 = 0
- L_0x0120:
- r14 = 0
- goto L_0x0140
- L_0x0122:
- r0 = move-exception
- r2 = 0
- r9 = 0
- r13 = 0
- L_0x0126:
- r0.printStackTrace() // Catch:{ all -> 0x013d }
- epson.maintain.FirmwareManager$FWUpdateProcResult r4 = epson.maintain.FirmwareManager.FWUpdateProcResult.Fail // Catch:{ all -> 0x013d }
- if (r9 == 0) goto L_0x0132
- r9.close() // Catch:{ Exception -> 0x0131 }
- goto L_0x0132
- L_0x0131:
- L_0x0132:
- if (r2 == 0) goto L_0x0139
- r2.close() // Catch:{ Exception -> 0x0138 }
- goto L_0x0139
- L_0x0138:
- L_0x0139:
- if (r13 == 0) goto L_0x013c
- goto L_0x0105
- L_0x013c:
- return r4
- L_0x013d:
- r0 = move-exception
- r14 = r9
- r9 = r2
- L_0x0140:
- if (r14 == 0) goto L_0x0147
- r14.close() // Catch:{ Exception -> 0x0146 }
- goto L_0x0147
- L_0x0146:
- L_0x0147:
- if (r9 == 0) goto L_0x014e
- r9.close() // Catch:{ Exception -> 0x014d }
- goto L_0x014e
- L_0x014d:
- L_0x014e:
- if (r13 == 0) goto L_0x0153
- r13.disconnect() // Catch:{ Exception -> 0x0153 }
- L_0x0153:
- throw r0
- */
- throw new UnsupportedOperationException("Method not decompiled: epson.maintain.FirmwareManager.LocalAsyncTask.download(java.lang.String, java.io.File, boolean, int, int):epson.maintain.FirmwareManager$FWUpdateProcResult");
- }
- private FWUpdateProcResult downloadNewFW() {
- String access$500;
- FWUpdateProcResult fWUpdateProcResult = FWUpdateProcResult.Success;
- try {
- File createNewSaveFile = FirmwareManager.createNewSaveFile();
- String access$5002 = FirmwareManager.this.getNextRomURL();
- if (access$5002 == null || FirmwareManager.mCurVer == null || FirmwareManager.mFirmInfFile.getMainVersion() == null) {
- return FWUpdateProcResult.Fail;
- }
- int romNum = FirmwareManager.mFirmInfFile.getRomNum();
- FWUpdateProcResult download = download(access$5002, createNewSaveFile, false, FirmwareManager.mCurRomNum, romNum);
- while (download == FWUpdateProcResult.Success && (access$500 = FirmwareManager.this.getNextRomURL()) != null) {
- if (isCancelled()) {
- return FWUpdateProcResult.Cancel;
- }
- download = download(access$500, createNewSaveFile, true, FirmwareManager.mCurRomNum, romNum);
- }
- return download;
- } catch (IOException e) {
- e.printStackTrace();
- return FWUpdateProcResult.DiskFull;
- } catch (Exception e2) {
- e2.printStackTrace();
- return FWUpdateProcResult.Fail;
- }
- }
- /* access modifiers changed from: package-private */
- /* JADX WARNING: Can't wrap try/catch for region: R(19:0|1|2|3|4|5|6|(3:7|8|(3:10|11|12)(1:65))|18|19|20|21|22|23|24|(1:(1:31))(1:27)|(2:33|34)|56|(2:59|66)(1:67)) */
- /* JADX WARNING: Can't wrap try/catch for region: R(7:35|39|40|41|42|43|44) */
- /* JADX WARNING: Missing exception handler attribute for start block: B:21:0x0160 */
- /* JADX WARNING: Missing exception handler attribute for start block: B:23:0x0163 */
- /* JADX WARNING: Missing exception handler attribute for start block: B:41:0x0187 */
- /* JADX WARNING: Missing exception handler attribute for start block: B:43:0x018a */
- /* JADX WARNING: Removed duplicated region for block: B:26:0x016d A[ADDED_TO_REGION, Catch:{ all -> 0x0180, Exception -> 0x018d, all -> 0x018b }] */
- /* JADX WARNING: Removed duplicated region for block: B:33:0x017c A[SYNTHETIC, Splitter:B:33:0x017c] */
- /* JADX WARNING: Removed duplicated region for block: B:59:0x01a4 */
- /* JADX WARNING: Removed duplicated region for block: B:61:0x01a9 A[SYNTHETIC, Splitter:B:61:0x01a9] */
- /* JADX WARNING: Removed duplicated region for block: B:67:? A[RETURN, SYNTHETIC] */
- /* JADX WARNING: Unknown top exception splitter block from list: {B:23:0x0163=Splitter:B:23:0x0163, B:43:0x018a=Splitter:B:43:0x018a} */
- /* Code decompiled incorrectly, please refer to instructions dump. */
- public epson.maintain.FirmwareManager.FWUpdateProcResult sendFW() {
- /*
- r10 = this;
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.Success
- r1 = 0
- java.net.URL r2 = new java.net.URL // Catch:{ Exception -> 0x0193 }
- epson.maintain.FirmwareManager r3 = epson.maintain.FirmwareManager.this // Catch:{ Exception -> 0x0193 }
- java.lang.String r3 = r3.getSendFWURL() // Catch:{ Exception -> 0x0193 }
- r2.<init>(r3) // Catch:{ Exception -> 0x0193 }
- java.net.URLConnection r2 = r2.openConnection() // Catch:{ Exception -> 0x0193 }
- java.net.HttpURLConnection r2 = (java.net.HttpURLConnection) r2 // Catch:{ Exception -> 0x0193 }
- java.io.ByteArrayOutputStream r1 = new java.io.ByteArrayOutputStream // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r1.<init>() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.StringBuilder r3 = new java.lang.StringBuilder // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r3.<init>() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r4 = "--"
- r3.append(r4) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- epson.maintain.FirmwareManager r4 = epson.maintain.FirmwareManager.this // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r4 = r4.boundary // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r3.append(r4) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r4 = "\r\n"
- r3.append(r4) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r3 = r3.toString() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r4 = "UTF-8"
- byte[] r3 = r3.getBytes(r4) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r1.write(r3) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.StringBuilder r3 = new java.lang.StringBuilder // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r3.<init>() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r4 = "Content-Disposition: form-data; name=\"\"fname\"\"; filename=\""
- r3.append(r4) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.io.File r4 = new java.io.File // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r5 = epson.maintain.FirmwareManager.FW_POST_FILE_PATH // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r4.<init>(r5) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r4 = r4.getName() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r3.append(r4) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r4 = "\""
- r3.append(r4) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r4 = "\r\n"
- r3.append(r4) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r3 = r3.toString() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r4 = "UTF-8"
- byte[] r3 = r3.getBytes(r4) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r1.write(r3) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r3 = "Content-Type: application/octet-stream\r\n"
- java.lang.String r4 = "UTF-8"
- byte[] r3 = r3.getBytes(r4) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r1.write(r3) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r3 = "Content-Transfer-Encoding: binary\r\n"
- java.lang.String r4 = "UTF-8"
- byte[] r3 = r3.getBytes(r4) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r1.write(r3) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r3 = "\r\n"
- java.lang.String r4 = "UTF-8"
- byte[] r3 = r3.getBytes(r4) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r1.write(r3) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.io.File r3 = new java.io.File // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r4 = epson.maintain.FirmwareManager.FW_POST_FILE_PATH // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r3.<init>(r4) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.io.ByteArrayOutputStream r4 = new java.io.ByteArrayOutputStream // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r4.<init>() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.StringBuilder r5 = new java.lang.StringBuilder // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r5.<init>() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r6 = "--"
- r5.append(r6) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- epson.maintain.FirmwareManager r6 = epson.maintain.FirmwareManager.this // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r6 = r6.boundary // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r5.append(r6) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r6 = "--"
- r5.append(r6) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r6 = "\r\n"
- r5.append(r6) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r5 = r5.toString() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r6 = "UTF-8"
- byte[] r5 = r5.getBytes(r6) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r4.write(r5) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- epson.maintain.FirmwareManager r5 = epson.maintain.FirmwareManager.this // Catch:{ Exception -> 0x018d, all -> 0x018b }
- int r6 = r1.size() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- long r6 = (long) r6 // Catch:{ Exception -> 0x018d, all -> 0x018b }
- long r8 = r3.length() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- long r6 = r6 + r8
- int r8 = r4.size() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- long r8 = (long) r8 // Catch:{ Exception -> 0x018d, all -> 0x018b }
- long r6 = r6 + r8
- r5.mTotalSize = r6 // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r5 = "POST"
- r2.setRequestMethod(r5) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r5 = 1
- r2.setDoOutput(r5) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r5 = "Content-Type"
- java.lang.StringBuilder r6 = new java.lang.StringBuilder // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r6.<init>() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r7 = "multipart/form-data; boundary="
- r6.append(r7) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- epson.maintain.FirmwareManager r7 = epson.maintain.FirmwareManager.this // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r7 = r7.boundary // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r6.append(r7) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r6 = r6.toString() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r2.setRequestProperty(r5, r6) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- epson.maintain.FirmwareManager r5 = epson.maintain.FirmwareManager.this // Catch:{ Exception -> 0x018d, all -> 0x018b }
- long r5 = r5.mTotalSize // Catch:{ Exception -> 0x018d, all -> 0x018b }
- int r6 = r5 // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r2.setFixedLengthStreamingMode(r6) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r2.connect() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.io.BufferedInputStream r5 = new java.io.BufferedInputStream // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.io.FileInputStream r6 = new java.io.FileInputStream // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.lang.String r3 = r3.getPath() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r6.<init>(r3) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r3 = 4096(0x1000, float:5.74E-42)
- r5.<init>(r6, r3) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- epson.maintain.FirmwareManager$CountingOutputStream r6 = new epson.maintain.FirmwareManager$CountingOutputStream // Catch:{ Exception -> 0x018d, all -> 0x018b }
- java.io.OutputStream r7 = r2.getOutputStream() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- epson.maintain.FirmwareManager$LocalAsyncTask$1 r8 = new epson.maintain.FirmwareManager$LocalAsyncTask$1 // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r8.<init>(r2) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r6.<init>(r7, r8) // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r1.writeTo(r6) // Catch:{ IOException -> 0x0182 }
- byte[] r1 = new byte[r3] // Catch:{ IOException -> 0x0182 }
- L_0x012f:
- int r3 = r5.read(r1) // Catch:{ IOException -> 0x0182 }
- r7 = -1
- if (r3 == r7) goto L_0x0157
- r7 = 0
- r6.write(r1, r7, r3) // Catch:{ IOException -> 0x013b }
- goto L_0x012f
- L_0x013b:
- r0 = move-exception
- java.lang.String r1 = "FirmwareManager"
- java.lang.StringBuilder r3 = new java.lang.StringBuilder // Catch:{ IOException -> 0x0182 }
- r3.<init>() // Catch:{ IOException -> 0x0182 }
- java.lang.String r4 = "error: in executeFile() : "
- r3.append(r4) // Catch:{ IOException -> 0x0182 }
- java.lang.String r4 = r0.toString() // Catch:{ IOException -> 0x0182 }
- r3.append(r4) // Catch:{ IOException -> 0x0182 }
- java.lang.String r3 = r3.toString() // Catch:{ IOException -> 0x0182 }
- epson.print.Util.EPLog.m318w((java.lang.String) r1, (java.lang.String) r3) // Catch:{ IOException -> 0x0182 }
- throw r0 // Catch:{ IOException -> 0x0182 }
- L_0x0157:
- r4.writeTo(r6) // Catch:{ IOException -> 0x0182 }
- r6.flush() // Catch:{ IOException -> 0x0182 }
- r5.close() // Catch:{ IOException -> 0x0160 }
- L_0x0160:
- r6.close() // Catch:{ IOException -> 0x0163 }
- L_0x0163:
- int r1 = r2.getResponseCode() // Catch:{ Exception -> 0x018d, all -> 0x018b }
- r3 = 400(0x190, float:5.6E-43)
- r4 = 500(0x1f4, float:7.0E-43)
- if (r3 > r1) goto L_0x0172
- if (r1 >= r4) goto L_0x0172
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.NotSupport // Catch:{ Exception -> 0x018d, all -> 0x018b }
- goto L_0x017a
- L_0x0172:
- if (r4 > r1) goto L_0x017a
- r3 = 600(0x258, float:8.41E-43)
- if (r1 >= r3) goto L_0x017a
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.Fail // Catch:{ Exception -> 0x018d, all -> 0x018b }
- L_0x017a:
- if (r2 == 0) goto L_0x019e
- r2.disconnect() // Catch:{ Exception -> 0x019e }
- goto L_0x019e
- L_0x0180:
- r0 = move-exception
- goto L_0x0184
- L_0x0182:
- r0 = move-exception
- throw r0 // Catch:{ all -> 0x0180 }
- L_0x0184:
- r5.close() // Catch:{ IOException -> 0x0187 }
- L_0x0187:
- r6.close() // Catch:{ IOException -> 0x018a }
- L_0x018a:
- throw r0 // Catch:{ Exception -> 0x018d, all -> 0x018b }
- L_0x018b:
- r0 = move-exception
- goto L_0x01a7
- L_0x018d:
- r0 = move-exception
- r1 = r2
- goto L_0x0194
- L_0x0190:
- r0 = move-exception
- r2 = r1
- goto L_0x01a7
- L_0x0193:
- r0 = move-exception
- L_0x0194:
- r0.printStackTrace() // Catch:{ all -> 0x0190 }
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.Fail // Catch:{ all -> 0x0190 }
- if (r1 == 0) goto L_0x019e
- r1.disconnect() // Catch:{ Exception -> 0x019e }
- L_0x019e:
- boolean r1 = r10.isCancelled()
- if (r1 == 0) goto L_0x01a6
- epson.maintain.FirmwareManager$FWUpdateProcResult r0 = epson.maintain.FirmwareManager.FWUpdateProcResult.Cancel
- L_0x01a6:
- return r0
- L_0x01a7:
- if (r2 == 0) goto L_0x01ac
- r2.disconnect() // Catch:{ Exception -> 0x01ac }
- L_0x01ac:
- throw r0
- */
- throw new UnsupportedOperationException("Method not decompiled: epson.maintain.FirmwareManager.LocalAsyncTask.sendFW():epson.maintain.FirmwareManager$FWUpdateProcResult");
- }
- }
- @VisibleForTesting
- static class MaintainPrinterWrapper {
- private final MaintainPrinter2 mMaintainPrinter2 = MaintainPrinter2.getInstance();
- MaintainPrinterWrapper() {
- }
- public int getFirmwareInfo(EnumMap<EscprLib.PrinterFirmInfo, String> enumMap) {
- return mMaintainPrinter2.getFirmwareInfo(enumMap);
- }
- public int getBatteryInfoEx(BatteryInfoEx batteryInfoEx) {
- return mMaintainPrinter2.getBatteryInfo(batteryInfoEx);
- }
- }
- }
|