package com.tencent.mm.plugin.backup.d;

import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.ai.f;
import com.tencent.mm.ai.m;
import com.tencent.mm.model.aw;
import com.tencent.mm.model.c;
import com.tencent.mm.plugin.backup.b.g;
import com.tencent.mm.plugin.backup.g.b;
import com.tencent.mm.plugin.backup.g.k;
import com.tencent.mm.plugin.backup.i.o;
import com.tencent.mm.plugin.report.service.h;
import com.tencent.mm.pointers.PLong;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.bo;

class c$6 implements f {
    final /* synthetic */ c jtN;

    c$6(c cVar) {
        this.jtN = cVar;
    }

    public final void onSceneEnd(int i, int i2, String str, m mVar) {
        AppMethodBeat.i(17251);
        b.b(3, c.h(this.jtN));
        ab.i("MicroMsg.BackupMoveRecoverServer", "backupmove receive startrequest response.[%d,%d,%s]", new Object[]{Integer.valueOf(i), Integer.valueOf(i2), str});
        if (i == 0 && i2 == 0) {
            k kVar = (k) mVar;
            o oVar = kVar.jyg;
            if (b.aSZ().jqO.equals(oVar.ID)) {
                Object obj;
                double d;
                b.aSZ().aSu().jrc = oVar.jBL;
                this.jtN.ceI = kVar.jyg.jBO.jBE;
                if (kVar.jyg.jBO.jBH.toLowerCase().contains("ios")) {
                    c.a(this.jtN, 1);
                } else {
                    c.a(this.jtN, 2);
                }
                c.a(this.jtN, kVar.jyg.jBS);
                c.b(this.jtN, kVar.jyg.jBU);
                ab.i("MicroMsg.BackupMoveRecoverServer", "move recover totalCount[%d], totalSize[%d], and wait old mobile's pushData", new Object[]{Long.valueOf(kVar.jyg.jBR), Long.valueOf(kVar.jyg.jBS)});
                if (c.i(this.jtN) && c.f(this.jtN)) {
                    int i3;
                    h hVar = h.pYm;
                    if (c.j(this.jtN) || c.k(this.jtN) == 1) {
                        i3 = 66;
                    } else {
                        i3 = 65;
                    }
                    hVar.a(485, (long) i3, 1, false);
                }
                if (kVar.jyg.jBQ == 3) {
                    obj = 1;
                } else {
                    obj = null;
                }
                if (obj != null) {
                    c.c(this.jtN, true);
                    ab.i("MicroMsg.BackupMoveRecoverServer", "isQuickBackup!!!");
                } else {
                    c.c(this.jtN, false);
                }
                PLong pLong = new PLong();
                PLong pLong2 = new PLong();
                aw.ZK();
                g.a(pLong, pLong2, c.getAccPath());
                long l = c.l(this.jtN);
                if (((double) c.l(this.jtN)) * 0.1d > 5.24288E8d) {
                    d = 5.24288E8d;
                } else {
                    d = ((double) c.l(this.jtN)) * 0.1d;
                }
                long j = ((long) d) + l;
                this.jtN.jtJ = j;
                if (pLong2.value < j) {
                    ab.e("MicroMsg.BackupMoveRecoverServer", "startRequestNotify Not Enough Space:%d < dataSize:%d, dataSize:%d", new Object[]{Long.valueOf(pLong2.value), Long.valueOf(j), Long.valueOf(c.l(this.jtN))});
                    h.pYm.e(11787, new Object[]{Integer.valueOf(5)});
                    b.aSZ().aTa().stop();
                    b.aSZ().aSu().jqW = -13;
                    this.jtN.rj(-13);
                    h.pYm.a(485, 5, 1, false);
                    AppMethodBeat.o(17251);
                    return;
                }
                c.b(this.jtN, bo.anU());
                b.aTU();
                AppMethodBeat.o(17251);
                return;
            }
            ab.e("MicroMsg.BackupMoveRecoverServer", "start response not the same id");
            b.aSZ().aSu().jqW = -5;
            this.jtN.rj(-5);
            AppMethodBeat.o(17251);
            return;
        }
        ab.e("MicroMsg.BackupMoveRecoverServer", "start request failed, errMsg:".concat(String.valueOf(str)));
        b.aSZ().aSu().jqW = -5;
        this.jtN.rj(-5);
        AppMethodBeat.o(17251);
    }
}
