APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:FreeTelec
版本号:1.13.0
包名称:fr.r0ro.android.FreeTelec

MD5 校验值:1c0b849068c6d731df1325f993a128f9

反编译源代码说明

m.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package fr.r0ro.android.FreeTelec;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.text.Editable;
import android.util.Log;
import android.widget.EditText;
import fr.r0ro.android.FreeTelec.atvremote2.PairingProtocol;
import fr.r0ro.android.FreeTelec.atvremote2.ProtoCrap;
import fr.r0ro.android.FreeTelec.atvremote2.RemoteProtocol;
import fr.r0ro.android.FreeTelec.protobuf.atvremote.Atvremote$RemoteMessage;
import fr.r0ro.android.FreeTelec.protobuf.atvremote_pairing.Polo$PairingMessage;
import fr.r0ro.teleclib.FreeboxScanner;

public class m extends h {

    Context f18441h;

    private final FreeboxScanner.Freebox f18442i;

    private PairingProtocol f18443j;

    private RemoteProtocol f18444k;

    private boolean f18445l;

    private boolean f18446m;

    private boolean f18447n;

    private RemoteProtocol.RemoteProtocolListener f18448o;

    PairingProtocol.PairingProtocolListener f18449p;

    class a extends RemoteProtocol.RemoteProtocolListener {
        a() {
        }

        @Override
        public void processIncomingMsg(Atvremote$RemoteMessage atvremote$RemoteMessage) {
            if (atvremote$RemoteMessage == null) {
                Log.w("TelecAtv2", "null incoming message");
                return;
            }
            if (!atvremote$RemoteMessage.hasPingRequest()) {
                Log.i("TelecAtv2", "processIncomingMsg: " + atvremote$RemoteMessage);
            }
            int i6 = c.f18452a[atvremote$RemoteMessage.getRequestCase().ordinal()];
            if (i6 == 1) {
                m.this.f18444k.sendConfigure();
            } else if (i6 == 2) {
                m.this.f18444k.sendRequestActive(622);
            } else {
                if (i6 != 3) {
                    return;
                }
                m.this.f18444k.sendPingResponse(atvremote$RemoteMessage.getPingRequest());
            }
        }

        @Override
        public void onConnectionLost(ProtoCrap protoCrap) {
            Log.i("TelecAtv2", "onConnectionLost");
            if (protoCrap == m.this.f18444k) {
                m.this.f18444k = null;
                m.this.f18445l = false;
            }
        }

        @Override
        public void onConnectionMade() {
            Log.i("TelecAtv2", "onConnectionMade");
            m.this.f18445l = true;
        }

        @Override
        public void onError(String str) {
            Log.e("TelecAtv2", "onError: " + str);
        }

        @Override
        protected void onNeedPairing() {
            m.this.f18446m = true;
            m.this.J();
        }
    }

    class b extends PairingProtocol.PairingProtocolListener {
        b() {
        }

        @Override
        public void processIncomingMsg(Polo$PairingMessage polo$PairingMessage) {
            Log.i("TelecAtv2", "processIncomingMsg: " + polo$PairingMessage);
            if (polo$PairingMessage.getProtocolVersion() != 2) {
                Log.e("TelecAtv2", "unexpected protocol version: " + polo$PairingMessage.getProtocolVersion());
                return;
            }
            if (polo$PairingMessage.getStatus() != Polo$PairingMessage.c.STATUS_OK) {
                Log.w("TelecAtv2", "message status != ok: " + polo$PairingMessage);
                if (polo$PairingMessage.getStatus() == Polo$PairingMessage.c.STATUS_BAD_SECRET) {
                    m.this.f18443j.disconnect();
                    m.this.f18447n = false;
                    return;
                }
                return;
            }
            int i6 = c.f18453b[polo$PairingMessage.getRequestCase().ordinal()];
            if (i6 == 1) {
                m.this.f18443j.sendSupportedOptions();
                return;
            }
            if (i6 == 2) {
                if (m.this.f18443j.checkOfferedOptions(polo$PairingMessage.getOptions())) {
                    m.this.f18443j.sendConfiguration();
                }
            } else {
                if (i6 == 3) {
                    m.this.C();
                    return;
                }
                if (i6 != 4) {
                    return;
                }
                Log.i("TelecAtv2", "Pairing success");
                m.this.f18447n = false;
                m.this.f18446m = false;
                m.this.f18443j.disconnect();
                m.this.a();
            }
        }

        @Override
        public void onConnectionLost(ProtoCrap protoCrap) {
            Log.i("TelecAtv2", "pairing connection lost: " + protoCrap);
            if (protoCrap == m.this.f18443j) {
                m.this.f18443j = null;
                m.this.f18447n = false;
            }
        }

        @Override
        public void onConnectionMade() {
            Log.i("TelecAtv2", "pairing connection ready");
            m.this.f18443j.sendPairingRequest();
        }

        @Override
        public void onError(String str) {
            Log.e("TelecAtv2", "onError: " + str);
        }
    }

    public static class c {

        static final int[] f18452a;

        static final int[] f18453b;

        static {
            int[] iArr = new int[Polo$PairingMessage.b.values().length];
            f18453b = iArr;
            try {
                iArr[Polo$PairingMessage.b.PAIRING_REQUEST_ACK.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                f18453b[Polo$PairingMessage.b.OPTIONS.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                f18453b[Polo$PairingMessage.b.CONFIGURATION_ACK.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                f18453b[Polo$PairingMessage.b.SECRET_ACK.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            int[] iArr2 = new int[Atvremote$RemoteMessage.b.values().length];
            f18452a = iArr2;
            try {
                iArr2[Atvremote$RemoteMessage.b.CONFIGURE.ordinal()] = 1;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                f18452a[Atvremote$RemoteMessage.b.SET_ACTIVE.ordinal()] = 2;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                f18452a[Atvremote$RemoteMessage.b.PING_REQUEST.ordinal()] = 3;
            } catch (NoSuchFieldError unused7) {
            }
        }
    }

    public m(Context context, FreeboxScanner.Freebox freebox) {
        super(freebox.name);
        this.f18443j = null;
        this.f18444k = null;
        this.f18445l = false;
        this.f18446m = false;
        this.f18447n = false;
        this.f18448o = new a();
        this.f18449p = new b();
        this.f18422b = 4;
        this.f18442i = freebox;
        this.f18441h = context;
    }

    public void D(EditText editText, DialogInterface dialogInterface, int i6) {
        Editable text = editText.getText();
        o("got pass: " + ((Object) text));
        if (this.f18443j.checkCode(text.toString().trim().toUpperCase())) {
            this.f18443j.sendSecret();
        } else {
            I();
        }
    }

    public void F() {
        final EditText editText = new EditText(FreeTelecActivity.C);
        editText.setInputType(1);
        editText.setAllCaps(true);
        new AlertDialog.Builder(FreeTelecActivity.C).setTitle("Merci de saisir le code affiché sur l'écran de votre Freebox").setMessage("Mot de passe:").setView(editText).setPositiveButton("Ok", new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i6) {
                fr.r0ro.android.FreeTelec.m.this.D(editText, dialogInterface, i6);
            }
        }).setNegativeButton("Annuler", new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i6) {
                fr.r0ro.android.FreeTelec.m.o("cancelled password request");
            }
        }).show();
    }

    public void G(DialogInterface dialogInterface, int i6) {
        C();
    }

    public void H() {
        new AlertDialog.Builder(FreeTelecActivity.C).setTitle("Mot de passe incorrect").setMessage("Vous devez saisir le code de 6 caractères qui s'affiche sur l'écran de votre TV").setPositiveButton("Ok", new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i6) {
                fr.r0ro.android.FreeTelec.m.this.G(dialogInterface, i6);
            }
        }).show();
    }

    private void I() {
        FreeTelecActivity.C.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                fr.r0ro.android.FreeTelec.m.this.H();
            }
        });
    }

    public void J() {
        if (this.f18447n) {
            Log.w("TelecAtv2", "pairing already in progress");
            return;
        }
        Log.i("TelecAtv2", "start pairing");
        this.f18447n = true;
        FreeboxScanner.Freebox freebox = this.f18442i;
        PairingProtocol pairingProtocol = new PairingProtocol(freebox.hostname, freebox.port + 1, this.f18449p);
        this.f18443j = pairingProtocol;
        pairingProtocol.connect();
    }

    public static void o(String str) {
    }

    public void C() {
        if (FreeTelecActivity.C == null) {
            return;
        }
        o("ask password");
        FreeTelecActivity.C.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                fr.r0ro.android.FreeTelec.m.this.F();
            }
        });
    }

    @Override
    public void a() {
        Log.i("TelecAtv2", "connect to " + this.f18442i.hostname + ":" + this.f18442i.port);
        if (this.f18445l) {
            Log.w("TelecAtv2", "already conneted");
            return;
        }
        if (this.f18446m) {
            J();
            return;
        }
        FreeboxScanner.Freebox freebox = this.f18442i;
        RemoteProtocol remoteProtocol = new RemoteProtocol(freebox.hostname, freebox.port, this.f18448o);
        this.f18444k = remoteProtocol;
        remoteProtocol.connect();
    }

    @Override
    public void b() {
        Log.i("TelecAtv2", "disconnect");
        PairingProtocol pairingProtocol = this.f18443j;
        if (pairingProtocol != null) {
            pairingProtocol.disconnect();
            this.f18443j = null;
        }
        RemoteProtocol remoteProtocol = this.f18444k;
        if (remoteProtocol != null) {
            remoteProtocol.disconnect();
            this.f18444k = null;
        }
        this.f18445l = false;
    }

    public boolean equals(Object obj) {
        if (!(obj instanceof m)) {
            return false;
        }
        m mVar = (m) obj;
        return mVar.f18422b == this.f18422b && mVar.f18442i.equals(this.f18442i);
    }

    @Override
    public void f(int i6, boolean z5) {
        if (!this.f18445l) {
            Log.e("TelecAtv2", "not connected");
            return;
        }
        o("pressButtonDown: " + i6 + " long: " + z5);
        int intValue = h.f18420g.get(i6, -1).intValue();
        if (intValue < 0) {
            Log.w("TelecAtv2", "unable to find keyCode for buttonId " + i6);
            return;
        }
        if (intValue == 84) {
            Log.w("TelecAtv2", "should start voice");
            return;
        }
        if (intValue != 170) {
            this.f18444k.sendKeyEvent(intValue, 0);
            return;
        }
        String stbModel = this.f18444k.getStbModel();
        Log.i("TelecAtv2", "getStbModel: " + stbModel);
        stbModel.hashCode();
        this.f18444k.sendAppLink((stbModel.equals("fbx6lc") || stbModel.equals("fbx6lcv2")) ? "tv://?channel" : "https://oq.ee/home/");
    }

    protected void finalize() throws Throwable {
        if (this.f18445l) {
            o("finalize :: disconnect");
            b();
        }
        super.finalize();
    }

    @Override
    public void g(int i6) {
        if (this.f18445l) {
            o("pressButtonUp");
            int intValue = h.f18420g.get(i6, -1).intValue();
            if (intValue >= 0) {
                if (intValue == 170) {
                    return;
                }
                this.f18444k.sendKeyEvent(intValue, 1);
            } else {
                Log.w("TelecAtv2", "unable to find keyCode for buttonId " + i6);
            }
        }
    }

    @Override
    public int hashCode() {
        return (this.f18422b * 8192) + this.f18421a.hashCode() + (this.f18442i.hashCode() * 256);
    }

    @Override
    public boolean m() {
        return false;
    }

    @Override
    public boolean n() {
        return false;
    }

    public String toString() {
        return "TelecAtv2[" + hashCode() + "] freebox=" + this.f18442i;
    }
}