导航菜单

页面标题

页面副标题

050 IP Phone v2.3.0 - TestCallActivity.java 源代码

正在查看: 050 IP Phone v2.3.0 应用的 TestCallActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.ntt.voip.android.com050plus.setting;

import android.R;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.hardware.SensorManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import com.ntt.voip.android.com050plus.client.MainActivityStarter;
import com.oki_access.android.ims.call.SpitzApplication;
import com.oki_access.android.ims.call.provider.b;
import h4.d;
import h4.f;
import java.io.IOException;
import java.util.Timer;
import java.util.TimerTask;
import k4.b;
import k4.w;
import t4.d0;
import t4.h0;
import t4.z;
import y3.g;

public class TestCallActivity extends BasicTestCallActivity implements f.a, d.b {
    public static final String T0 = s4.b.d + "TEST_CALL_ACTIVE";
    public static final String U0 = s4.b.c + ".extra.TEST_CALL_ACTIVE";
    protected static final int[] V0 = {2131297361, 2131297368, 2131297373};
    public static boolean W0 = false;
    private h4.d A0;
    private h4.f B0;
    private Timer D0;
    private SensorManager E0;
    private Timer J0;
    private TimerTask K0;
    private k4.b N0;
    private Intent Q0;
    private int x0;
    protected b.a y0;

    private t f41z0;
    private boolean u0 = false;
    private int v0 = -1;
    private Bundle w0 = null;
    private final Handler C0 = new Handler(Looper.getMainLooper());
    private boolean F0 = false;
    private h0 G0 = null;
    private boolean H0 = false;
    private volatile boolean I0 = false;
    private j4.a L0 = null;
    private o4.d M0 = null;
    private final b.e O0 = new a();
    private BroadcastReceiver P0 = null;
    private BroadcastReceiver R0 = null;
    private Runnable S0 = new r();

    class a implements b.e {

        class RunnableC0027a implements Runnable {
            RunnableC0027a() {
            }

            @Override
            public void run() {
                if (!TestCallActivity.this.I0) {
                    z.h("TestCallActivity", "terminate: Invalid");
                } else {
                    TestCallActivity.this.I0 = false;
                    TestCallActivity.this.N1();
                }
            }
        }

        a() {
        }

        private void d() {
            TestCallActivity.this.C0.post(new RunnableC0027a());
        }

        @Override
        public void a(boolean z) {
            z.h("TestCallActivity", "CallingStateMonitor.onChanged. callable=[" + z + "]");
            if (z || TestCallActivity.this.x0 != 2 || TestCallActivity.this.N0.r()) {
                return;
            }
            z.h("TestCallActivity", "Calling state is busy. Terminate call.");
            TestCallActivity.this.f41z0.d(486);
            d();
        }

        @Override
        public void b(boolean z) {
            z.h("TestCallActivity", "onCallActiveChanged. active=[" + z + "]");
            if (z) {
                int i = TestCallActivity.this.x0;
                a aVar = null;
                if (i == 0) {
                    TestCallActivity.this.C0.post(new u(TestCallActivity.this, aVar));
                } else {
                    if (i != 1) {
                        return;
                    }
                    TestCallActivity.this.C0.post(new v(TestCallActivity.this, aVar));
                }
            }
        }

        @Override
        public void c(boolean z) {
            z.h("TestCallActivity", "onUnregisteredChanged. unreg=[" + z + "]");
            if (!z) {
                TestCallActivity.this.v1();
            } else {
                if (TestCallActivity.this.K0 != null) {
                    return;
                }
                z.h("TestCallActivity", "Unregistered. Terminate call.");
                TestCallActivity.this.f41z0.d(-3);
                d();
            }
        }
    }

    class b implements Runnable {
        b() {
        }

        @Override
        public void run() {
            if (TestCallActivity.W0) {
                if (TestCallActivity.this.H0) {
                    z.a("TestCallActivity", "onEstablished abort: terminated");
                } else {
                    TestCallActivity.this.F1();
                    TestCallActivity.this.P1(1);
                }
            }
        }
    }

    class c implements Runnable {
        c() {
        }

        @Override
        public void run() {
            if (!TestCallActivity.this.I0) {
                z.h("TestCallActivity", "onFailed: Invalid");
            } else {
                TestCallActivity.this.I0 = false;
                TestCallActivity.this.N1();
            }
        }
    }

    class d implements Runnable {
        d() {
        }

        @Override
        public void run() {
            if (!TestCallActivity.this.I0) {
                z.h("TestCallActivity", "onTerminated: Invalid");
            } else {
                TestCallActivity.this.I0 = false;
                TestCallActivity.this.N1();
            }
        }
    }

    class e implements a3.f {
        e() {
        }

        @Override
        public void a() {
            z.h("TestCallActivity", "onClick: cancel");
            TestCallActivity.this.C0.post(new u(TestCallActivity.this, null));
        }
    }

    class f implements a3.f {
        f() {
        }

        @Override
        public void a() {
            z.h("TestCallActivity", "onClick: terminate");
            TestCallActivity.this.C0.post(new v(TestCallActivity.this, null));
        }
    }

    class g extends TimerTask {

        class a implements Runnable {
            a() {
            }

            @Override
            public void run() {
                TestCallActivity.this.o1();
            }
        }

        g() {
        }

        @Override
        public void run() {
            TestCallActivity.this.C0.post(new a());
        }
    }

    class h implements Runnable {
        h() {
        }

        @Override
        public void run() {
            if (TestCallActivity.this.H0) {
                z.h("TestCallActivity", "stop busy tone");
                TestCallActivity.this.B0.S();
            }
        }
    }

    class i implements Runnable {
        i() {
        }

        @Override
        public void run() {
            if (TestCallActivity.this.H0) {
                z.n("TestCallActivity", "auto close");
                TestCallActivity.this.finish();
            }
        }
    }

    class j extends TimerTask {

        class a implements Runnable {
            a() {
            }

            @Override
            public void run() {
                z.p("TestCallActivity", "Failed to outgoing call: Not registered.");
                TestCallActivity.this.D1();
            }
        }

        j() {
        }

        @Override
        public void run() {
            TestCallActivity.this.K0 = null;
            TestCallActivity.this.C0.post(new a());
        }
    }

    class k implements View.OnLayoutChangeListener {
        final View a;

        k(View view) {
            this.a = view;
        }

        @Override
        public void onLayoutChange(View view, int i, int i8, int i9, int i10, int i11, int i12, int i13, int i14) {
            this.a.removeOnLayoutChangeListener(this);
            TestCallActivity.this.p1();
        }
    }

    class l extends BroadcastReceiver {
        l() {
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            if (MainActivityStarter.w0.equals(intent.getAction())) {
                z.n("TestCallActivity", "Ready to start");
                TestCallActivity.this.A0.u();
                TestCallActivity.this.N0.w(TestCallActivity.this.O0);
            }
        }
    }

    class m extends BroadcastReceiver {
        m() {
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            if ("android.intent.action.ACTION_SHUTDOWN".equals(intent.getAction())) {
                z.h("TestCallActivity", "Shutdown...");
                TestCallActivity.this.finish();
            }
        }
    }

    class n implements DialogInterface.OnClickListener {
        n() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            TestCallActivity.this.finish();
        }
    }

    class o implements DialogInterface.OnCancelListener {
        o() {
        }

        @Override
        public void onCancel(DialogInterface dialogInterface) {
            TestCallActivity.this.finish();
        }
    }

    class p implements DialogInterface.OnClickListener {
        p() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            TestCallActivity.this.finish();
        }
    }

    class q implements DialogInterface.OnCancelListener {
        q() {
        }

        @Override
        public void onCancel(DialogInterface dialogInterface) {
            TestCallActivity.this.finish();
        }
    }

    class r implements Runnable {
        r() {
        }

        @Override
        public void run() {
            TestCallActivity testCallActivity = TestCallActivity.this;
            testCallActivity.B1(testCallActivity.Q0);
        }
    }

    class s extends TimerTask {

        class a implements Runnable {
            a() {
            }

            @Override
            public void run() {
                if (TestCallActivity.this.J0 != null) {
                    z.n("TestCallActivity", "Play SDT");
                    if (TestCallActivity.this.B0 == null || TestCallActivity.this.B0.C()) {
                        return;
                    }
                    TestCallActivity.this.B0.E();
                }
            }
        }

        s() {
        }

        @Override
        public void run() {
            TestCallActivity.this.C0.post(new a());
        }
    }

    private class t {
        int a;
        String b;

        private t() {
        }

        int a() {
            return this.a;
        }

        String b() {
            return this.b;
        }

        public int c(b.a aVar) {
            if (aVar != null && aVar.f() > 0) {
                return 1;
            }
            z.h("TestCallActivity", "Result:reason = " + this.b + ", cause = " + this.a);
            int i = this.a;
            if (i == 0) {
                return 1;
            }
            if (i == 400 || i == 500) {
                return 5;
            }
            if (i == 600 || i == 486) {
                return 6;
            }
            return i != 487 ? 4 : 3;
        }

        void d(int i) {
            this.a = i;
        }

        void e(String str) {
            this.b = str;
        }

        t(TestCallActivity testCallActivity, a aVar) {
            this();
        }
    }

    private class u implements Runnable {
        private u() {
        }

        @Override
        public void run() {
            z.n("TestCallActivity", "sp51Cancel: cancel run");
            TestCallActivity.this.l1();
            TestCallActivity.this.C0.removeCallbacks(TestCallActivity.this.S0);
            if (TestCallActivity.this.I0) {
                try {
                    TestCallActivity.this.I0 = false;
                    TestCallActivity.this.f41z0.d(487);
                    z.a("TestCallActivity", "sp51Cancel: cancel");
                    if (TestCallActivity.this.B0 != null) {
                        TestCallActivity.this.B0.Q();
                    }
                    TestCallActivity.this.findViewById(com.oki_access.android.ims.call.d.d.Z2()).setEnabled(false);
                    TestCallActivity.this.N1();
                } catch (IOException e) {
                    TestCallActivity.this.f41z0.d(-2);
                    TestCallActivity.this.f41z0.e(e.getMessage());
                    TestCallActivity.this.N1();
                }
            } else {
                z.a("TestCallActivity", "sp51Cancel: cancel Invlid");
                TestCallActivity.this.findViewById(com.oki_access.android.ims.call.d.d.Z2()).setEnabled(false);
            }
            z.n("TestCallActivity", "sp51Cancel: cancel end");
        }

        u(TestCallActivity testCallActivity, a aVar) {
            this();
        }
    }

    private class v implements Runnable {
        private v() {
        }

        @Override
        public void run() {
            z.n("TestCallActivity", "sp53Terminate: terminate run");
            if (TestCallActivity.this.I0) {
                try {
                    TestCallActivity.this.I0 = false;
                    TestCallActivity.this.f41z0.d(0);
                    TestCallActivity.this.B0.Q();
                    TestCallActivity.this.findViewById(com.oki_access.android.ims.call.d.d.j3()).setEnabled(false);
                    TestCallActivity.this.N1();
                } catch (IOException e) {
                    TestCallActivity.this.f41z0.d(-2);
                    TestCallActivity.this.f41z0.e(e.getMessage());
                    TestCallActivity.this.N1();
                }
            } else {
                z.a("TestCallActivity", "sp53Terminate: terminate Invlid");
                TestCallActivity.this.findViewById(com.oki_access.android.ims.call.d.d.j3()).setEnabled(false);
            }
            z.n("TestCallActivity", "sp53Terminate: terminate end");
        }

        v(TestCallActivity testCallActivity, a aVar) {
            this();
        }
    }

    private void C1(int i8, Bundle bundle) {
        if (this.u0) {
            t4.p.s(this, i8, bundle);
            if (i8 == this.v0) {
                this.v0 = -1;
                this.w0 = null;
                return;
            }
            return;
        }
        this.v0 = i8;
        this.w0 = bundle;
        z.h("TestCallActivity", "App is in background. Pending showDialog id: " + this.v0);
    }

    public void D1() {
        C1(10, null);
    }

    private void E1(int i8) {
        ((ImageView) findViewById(2131297355)).setImageResource(2131230952);
        ((TextView) findViewById(2131297349)).setText("");
        ((TextView) findViewById(2131297354)).setText(2131886719);
    }

    private void G1() {
        z.a("TestCallActivity", "startKeyGuard");
        if (!s1()) {
            this.G0 = h0.f(this);
        }
        if (this.G0.j("TestCallActivity", 1)) {
            return;
        }
        this.G0.d("TestCallActivity", 1);
    }

    private void H1() {
        z.n("TestCallActivity", "outgoing call");
        this.C0.postDelayed(this.S0, 250L);
    }

    private void I1() {
        int intValue = Integer.valueOf(d0.a(getString(2131887722))).intValue();
        j jVar = new j();
        this.K0 = jVar;
        this.D0.schedule(jVar, intValue);
    }

    private void J1() {
        M1();
        z.n("TestCallActivity", "Start SDT");
        Timer timer = new Timer();
        this.J0 = timer;
        timer.schedule(new s(), this.A0.G(65585));
    }

    private void L1() {
        z.a("TestCallActivity", "stopKeyGuard");
        if (s1() && this.G0.j("TestCallActivity", 1)) {
            this.G0.k("TestCallActivity", 1);
        }
    }

    private void M1() {
        if (this.J0 != null) {
            z.n("TestCallActivity", "Stop SDT");
            this.J0.cancel();
            this.J0 = null;
            this.B0.R();
        }
    }

    public synchronized void N1() {
        int G;
        int G2;
        try {
            M1();
            K1();
            int c8 = this.f41z0.c(this.y0);
            z.h("TestCallActivity", "terminateCall: result=[" + c8 + "]");
            P1(2);
            this.H0 = true;
            L1();
            int i8 = -1;
            switch (c8) {
                case 1:
                    G = this.A0.G(1114115);
                    break;
                case 2:
                    G = this.A0.G(1114116);
                    break;
                case 3:
                    G = this.A0.G(1114118);
                    break;
                case 4:
                    i8 = this.A0.G(1114117);
                    G = i8;
                    break;
                case 5:
                    q1("SIP Error", this.f41z0.a() + " " + this.f41z0.b());
                    G2 = this.A0.G(1114117);
                    i8 = G2;
                    G = -1;
                    break;
                case 6:
                    q1(null, getString(2131886721));
                    G2 = this.A0.G(1114117);
                    i8 = G2;
                    G = -1;
                    break;
                default:
                    G = i8;
                    break;
            }
            if (i8 > 0) {
                z.h("TestCallActivity", "start busy tone");
                h4.f fVar = this.B0;
                if (fVar != null) {
                    fVar.D();
                    this.C0.postDelayed(new h(), i8);
                }
            }
            z.h("TestCallActivity", "terminateCall: auto close delay=[" + G + "]");
            if (G > 0) {
                this.C0.postDelayed(new i(), G);
            }
        } catch (Throwable th) {
            throw th;
        }
    }

    private void O1() {
        K1();
    }

    public void P1(int i8) {
        if (i8 != 1) {
            E1(i8);
        }
        FrameLayout frameLayout = (FrameLayout) findViewById(2131297351);
        TextView textView = (TextView) findViewById(2131297356);
        ImageView imageView = (ImageView) findViewById(2131297357);
        int[] iArr = V0;
        View findViewById = findViewById(iArr[this.x0]);
        if (findViewById != null) {
            findViewById.setVisibility(4);
        }
        if (i8 == 0) {
            z.n("TestCallActivity", "update SCREEN_SP51 (" + i8 + ")");
            textView.setText(2131888688);
            imageView.setImageResource(2131231301);
            r1();
            findViewById(2131297358).setEnabled(true);
            this.I0 = true;
        } else if (i8 == 1) {
            z.n("TestCallActivity", "update SCREEN_SP53 (" + i8 + ")");
            textView.setText("");
            imageView.setImageResource(2131230951);
            findViewById(2131297365).setEnabled(true);
            this.I0 = true;
        } else if (i8 != 2) {
            z.n("TestCallActivity", "update SCREEN_??? (" + i8 + ")");
        } else {
            z.n("TestCallActivity", "update SCREEN_SP54 (" + i8 + ")");
            textView.setText(2131888708);
            imageView.setVisibility(4);
            findViewById(2131297350).setVisibility(4);
        }
        View findViewById2 = findViewById(iArr[i8]);
        findViewById2.setVisibility(0);
        frameLayout.bringChildToFront(findViewById2);
        this.x0 = i8;
        m1();
    }

    private void k1(boolean z) {
        z.a("TestCallActivity", "adjustLayoutOnMultiWindowModeChange isInMultiWindowMode: " + z);
        View findViewById = findViewById(R.id.content);
        View findViewById2 = findViewById(2131297352);
        ViewGroup.LayoutParams layoutParams = findViewById2 != null ? findViewById2.getLayoutParams() : null;
        View findViewById3 = findViewById(2131297353);
        if (findViewById == null || findViewById2 == null || layoutParams == null || findViewById3 == null) {
            return;
        }
        if (z) {
            layoutParams.height = 0;
            findViewById2.setLayoutParams(layoutParams);
        } else {
            layoutParams.height = findViewById.getHeight() - findViewById3.getHeight();
            findViewById2.setLayoutParams(layoutParams);
        }
    }

    public void l1() {
        TimerTask timerTask = this.K0;
        if (timerTask != null) {
            timerTask.cancel();
            this.K0 = null;
        }
    }

    private void m1() {
        z.a("TestCallActivity", "checkOnLayoutChange");
        View findViewById = findViewById(R.id.content);
        if (findViewById != null) {
            findViewById.addOnLayoutChangeListener(new k(findViewById));
        }
    }

    private synchronized void n1() {
        try {
            z.h("TestCallActivity", "cleanup");
            BroadcastReceiver broadcastReceiver = this.R0;
            if (broadcastReceiver != null) {
                unregisterReceiver(broadcastReceiver);
                this.R0 = null;
            }
            BroadcastReceiver broadcastReceiver2 = this.P0;
            if (broadcastReceiver2 != null) {
                unregisterReceiver(broadcastReceiver2);
                this.P0 = null;
            }
            k4.b bVar = this.N0;
            if (bVar != null) {
                bVar.F(this.O0);
                this.N0 = null;
            }
            if (!W0) {
                z.h("TestCallActivity", "ignore cleanup");
                return;
            }
            this.H0 = false;
            M1();
            h4.f fVar = this.B0;
            if (fVar != null) {
                fVar.S();
            }
            int i8 = this.x0;
            if (i8 == 1 || i8 == 0) {
                O1();
            }
            h4.d dVar = this.A0;
            if (dVar != null) {
                dVar.W();
                this.A0.t();
            }
            L1();
            W0 = false;
            this.L0.D0(this, false);
            this.I0 = false;
            this.L0.e0(this, false);
            z.h("TestCallActivity", "cleanup finish");
        } catch (Throwable th) {
            throw th;
        }
    }

    public void o1() {
        this.y0.D();
        w1();
    }

    public void p1() {
        z.a("TestCallActivity", "doOnLayoutChange");
        k1(isInMultiWindowMode());
    }

    private void q1(String str, String str2) {
        Bundle bundle = new Bundle();
        bundle.putString("error_title", str);
        bundle.putString("error_message", str2);
        C1(11, bundle);
    }

    private boolean t1(q5.f fVar, boolean z) {
        try {
            z.a("TestCallActivity", "makeCall uri=[" + fVar + "], isAnonymous=[" + z + "], screen=[" + this.x0 + "]");
            this.x0 = 0;
            try {
                int K = this.A0.K();
                z.a("TestCallActivity", "terminal state=[" + z4.q.a(K) + "]");
                if (K != 1) {
                    z.h("TestCallActivity", "No active registration.");
                    this.x0 = 2;
                }
                int B = this.A0.B();
                z.a("TestCallActivity", "connection state=[" + z4.l.a(B) + "]");
                if (B != 1) {
                    z.h("TestCallActivity", "Terminal is not connected.");
                    this.x0 = 2;
                }
            } catch (Exception e8) {
                z.h("TestCallActivity", "IMS service is not ready");
                z.b("TestCallActivity", "Internal bus error", e8);
                this.x0 = 2;
            }
            int i8 = this.x0;
            if (i8 != 0) {
                return false;
            }
            P1(i8);
            this.B0 = this.A0.T(fVar, z, this);
            return true;
        } catch (b5.c e9) {
            z.q("TestCallActivity", "failed to connect beagle", e9);
            return false;
        } catch (IOException e10) {
            z.q("TestCallActivity", "failed to send INVITE", e10);
            return false;
        } catch (RuntimeException e11) {
            z.q("TestCallActivity", "failed to send INVITE", e11);
            return false;
        }
    }

    @Override
    public void A(h4.f fVar) {
    }

    protected void A1() {
        M0(new e());
        O0(new f());
    }

    protected void B1(Intent intent) {
        if (!W0) {
            z.h("TestCallActivity", "Failed to setupCall: isActive: false");
            return;
        }
        Uri data = intent.getData();
        z.n("TestCallActivity", "outgoing call. data=[" + data + "]");
        b.a aVar = new b.a(2);
        this.y0 = aVar;
        aVar.u(System.currentTimeMillis());
        q5.f x12 = x1(data.toString(), this.y0);
        z.h("TestCallActivity", "outgoing call. callee=[" + x12 + "]");
        if (x12 == null || this.N0.p()) {
            z.p("TestCallActivity", "Failed to outgoing call.");
            D1();
            return;
        }
        if (!t1(x12, false)) {
            z.p("TestCallActivity", "Failed to make call.");
            D1();
            return;
        }
        this.A0.f0();
        J1();
        z.n("TestCallActivity", "outgoing call. call=[" + this.y0 + "], privacy=[false]");
        this.x0 = 0;
    }

    @Override
    public void C(h4.f fVar) {
        z.h("TestCallActivity", "onEstablished");
        M1();
        this.y0.u(System.currentTimeMillis());
        z.h("TestCallActivity", "setVolumeControlStream(AudioManager.STREAM_VOICE_CALL)");
        setVolumeControlStream(0);
        this.C0.post(new b());
    }

    @Override
    public void D(h4.f fVar) {
    }

    @Override
    public void E() {
    }

    @Override
    public void F(h4.f fVar, boolean z) {
    }

    protected void F1() {
        this.y0.w(0L);
        w1();
        this.D0.schedule(new g(), 1000L, 1000L);
    }

    @Override
    public void G(h4.f fVar) {
    }

    protected void K1() {
        Timer timer = this.D0;
        if (timer != null) {
            timer.cancel();
        }
    }

    @Override
    protected g.b P() {
        return g.b.COM0604C;
    }

    @Override
    public void a(boolean z) {
    }

    @Override
    public void b(h4.f fVar, int i8, String str) {
        u1(i8, str);
    }

    @Override
    public void c(int i8) {
    }

    @Override
    public synchronized void d(h4.f fVar) {
    }

    @Override
    public boolean f(m5.b bVar) {
        return true;
    }

    @Override
    public void h(h4.f fVar) {
    }

    @Override
    public void k(h4.f fVar) {
    }

    @Override
    public void l(h4.f fVar) {
    }

    @Override
    public void m(h4.f fVar, int i8, String str) {
        z.h("TestCallActivity", "onStarting: cause=[" + i8 + "], phrasae=[" + str + "]");
        M1();
    }

    @Override
    public void n(h4.f fVar) {
    }

    @Override
    public synchronized void onCreate(Bundle bundle) {
        try {
            z.n("TestCallActivity", "onCreate[" + getTaskId() + "]");
            z.a("TestCallActivity", "onCreate. version_code=[" + Build.VERSION.SDK_INT + "]");
            super.onCreate(bundle);
            if (isInMultiWindowMode()) {
                setRequestedOrientation(-1);
            } else {
                setRequestedOrientation(1);
            }
            Intent intent = getIntent();
            this.Q0 = intent;
            String action = intent.getAction();
            if (!e4.a.g.equals(action)) {
                z.n("TestCallActivity", "Unknown action: action=[" + action + "]");
                finish();
                return;
            }
            j4.a aVar = (j4.a) SpitzApplication.J(2);
            this.L0 = aVar;
            aVar.e0(this, true);
            this.M0 = (o4.d) SpitzApplication.J(1);
            h4.d E = h4.d.E(this, new h4.j());
            this.A0 = E;
            try {
                E.V(this, this.C0);
                this.N0 = k4.b.m();
                boolean z = !com.ntt.voip.android.client.push.call.c.F(this) && ((SpitzApplication) getApplication()).K();
                if (!z) {
                    l lVar = new l();
                    this.R0 = lVar;
                    ContextCompat.registerReceiver(this, lVar, new IntentFilter(MainActivityStarter.w0), 4);
                    o4.d dVar = this.M0;
                    dVar.H(this, dVar.B(this));
                    ((SpitzApplication) getApplication()).G();
                }
                this.D0 = new Timer();
                W0 = true;
                this.L0.D0(this, true);
                setContentView(2131492902);
                A1();
                this.A0.a0(this);
                new w(this.A0);
                this.f41z0 = new t(this, null);
                this.H0 = false;
                this.E0 = null;
                G1();
                m mVar = new m();
                this.P0 = mVar;
                ContextCompat.registerReceiver(this, mVar, new IntentFilter("android.intent.action.ACTION_SHUTDOWN"), 2);
                setVolumeControlStream(0);
                I1();
                if (z) {
                    z.n("TestCallActivity", "Service is Ready");
                    this.A0.u();
                    this.N0.w(this.O0);
                }
                P1(0);
                z.n("TestCallActivity", "onCreate finish");
            } catch (Exception e8) {
                z.n("TestCallActivity", "onCreateTestCall Exception=[" + e8.toString() + "]");
                this.L0.e0(this, false);
                finish();
            }
        } catch (Throwable th) {
            throw th;
        }
    }

    @Override
    protected void onDestroy() {
        z.n("TestCallActivity", "onDestroy[" + getTaskId() + "]");
        super.onDestroy();
        n1();
    }

    public void onMultiWindowModeChanged(boolean z, @NonNull Configuration configuration) {
        super/*androidx.activity.ComponentActivity*/.onMultiWindowModeChanged(z, configuration);
        if (isInMultiWindowMode()) {
            setRequestedOrientation(-1);
        } else {
            setRequestedOrientation(1);
        }
        m1();
    }

    protected void onNewIntent(Intent intent) {
        z.n("TestCallActivity", "onNewIntent[" + getTaskId() + "]");
        super/*androidx.activity.ComponentActivity*/.onNewIntent(intent);
    }

    @Override
    protected void onPause() {
        this.u0 = false;
        z.n("TestCallActivity", "onPause[" + getTaskId() + "]");
        super.onPause();
        if (!t4.t.m(this)) {
            L1();
        }
        if (isFinishing()) {
            n1();
        } else if (this.H0) {
            z.h("TestCallActivity", "onPause finish");
            n1();
            finish();
        }
    }

    @Override
    protected void onRestart() {
        z.a("TestCallActivity", "onRestart");
        super.onRestart();
    }

    @Override
    protected void onResume() {
        this.u0 = true;
        z.n("TestCallActivity", "onResume[" + getTaskId() + "]");
        super.onResume();
        h4.d dVar = this.A0;
        if (dVar != null) {
            dVar.Y();
        }
        if (s1()) {
            G1();
        }
        int i8 = this.v0;
        if (-1 != i8) {
            C1(i8, this.w0);
        }
    }

    @Override
    protected void onStart() {
        z.a("TestCallActivity", "onStart");
        super.onStart();
    }

    @Override
    protected void onStop() {
        z.a("TestCallActivity", "onStop");
        super.onStop();
    }

    public void onWindowFocusChanged(boolean z) {
        z.n("TestCallActivity", "onWindowFocusChanged[" + getTaskId() + "], hasFocus: " + z);
        super/*android.app.Activity*/.onWindowFocusChanged(z);
        if (!t4.t.m(this) || z) {
            return;
        }
        L1();
    }

    @Override
    public void p(h4.f fVar) {
    }

    @Override
    public void r() {
    }

    protected void r1() {
        this.L0.R(this);
    }

    @Override
    public void s(h4.f fVar) {
    }

    protected boolean s1() {
        return this.G0 != null;
    }

    @Override
    public void t(h4.f fVar) {
    }

    public void u1(int i8, String str) {
        z.h("TestCallActivity", "onFailed. cause=[" + i8 + "/" + w4.c.a(i8) + "], phrase=[" + str + "]");
        this.f41z0.d(i8);
        this.f41z0.e(str);
        this.C0.post(new c());
    }

    public void v1() {
        z.h("TestCallActivity", "onRegistered");
        if (this.K0 != null) {
            l1();
            H1();
        }
    }

    protected void w1() {
        ((TextView) findViewById(2131297350)).setText(k4.h.c(this, this.y0.f()));
    }

    @Override
    public void x(h4.f fVar) {
    }

    protected q5.f x1(String str, b.a aVar) {
        String z12 = z1(str);
        if (z12 == null) {
            z.c("TestCallActivity", "Failed to resolve URI.");
            return null;
        }
        z.n("TestCallActivity", "number=[" + z12 + "]");
        aVar.A(z12);
        String y12 = y1(z12);
        if (y12 == null) {
            z.p("TestCallActivity", "Illegal phone number.");
            return null;
        }
        q5.d y = this.A0.y(y12);
        z.n("TestCallActivity", "uri=[" + y + "]");
        return y;
    }

    @Override
    public Dialog y(int i8, Bundle bundle, t4.p pVar) {
        if (i8 == 0) {
            return new g4.a(this);
        }
        if (i8 == 10) {
            AlertDialog create = new AlertDialog.Builder(this).setNeutralButton(2131887431, new n()).setMessage(getString(2131888675)).create();
            pVar.p(new o());
            return create;
        }
        if (i8 != 11) {
            return super.y(i8, bundle, pVar);
        }
        String string = bundle.getString("error_title");
        String string2 = bundle.getString("error_message");
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        if (string != null) {
            builder.setTitle(string);
        }
        builder.setMessage(string2);
        builder.setPositiveButton(2131887431, new p());
        pVar.p(new q());
        return builder.create();
    }

    protected String y1(String str) {
        String replaceAll = str.replace("%2B", "+").replace("%23", "#").replaceAll("[-.()]+", "");
        z.n("TestCallActivity", "Removed visual-separator [" + replaceAll + "]");
        if (replaceAll.matches("[*#0-9a-fA-F]+")) {
            z.n("TestCallActivity", "Phone number is local");
        } else {
            if (!replaceAll.matches("^[+][0-9]+")) {
                z.n("TestCallActivity", "Phone number is illegal");
                return null;
            }
            z.n("TestCallActivity", "Phone number is global");
        }
        return this.L0.v0(replaceAll);
    }

    @Override
    public void z(h4.f fVar, int i8, int i9) {
        z.h("TestCallActivity", "onTerminated: cause=[" + w4.c.a(i8) + "]");
        this.f41z0.d(i8);
        this.C0.post(new d());
    }

    protected String z1(String str) {
        try {
            q5.f j8 = q5.f.j(str);
            if (j8.i()) {
                return ((q5.e) j8).r();
            }
            return null;
        } catch (i5.q e8) {
            z.q("TestCallActivity", "failed to parse URI. data=[" + str + "]", e8);
            return null;
        } catch (IllegalArgumentException e9) {
            z.q("TestCallActivity", "failed to parse URI. data=[" + str + "]", e9);
            return null;
        }
    }
}