123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149 |
- package epson.maintain;
- import android.content.Context;
- import android.os.AsyncTask;
- import android.support.annotation.VisibleForTesting;
- 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;
- }
- /* access modifiers changed from: package-private */
- public void endConnect() {
- mFWUpdateTask.cancel(true);
- }
- /* access modifiers changed from: package-private */
- public void startProc(FWUpdateStep fWUpdateStep) {
- mProcStep = fWUpdateStep;
- mProcResult = FWUpdateProcResult.None;
- mFWUpdateTask = buildFWUpdateTask();
- mFWUpdateTask.execute(new FWUpdateStep[]{fWUpdateStep});
- }
- /* access modifiers changed from: package-private */
- public 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);
- }
- /* access modifiers changed from: package-private */
- public 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;
- }
- /* access modifiers changed from: package-private */
- public String getStartUpdateURL() {
- return IPAddressUtils.buildURL(mSendProtocol, mPrinter.getIp(), "/FIRMWAREUPDATE");
- }
- /* access modifiers changed from: package-private */
- public 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);
- }
- /* access modifiers changed from: package-private */
- public 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);
- }
- }
- /* access modifiers changed from: package-private */
- public 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");
- }
- /* access modifiers changed from: package-private */
- public 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");
- }
- /* access modifiers changed from: package-private */
- public 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);
- }
- }
- }
|