package com.tencent.mm.plugin.ipcall.ui;

import android.os.Bundle;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.model.aw;
import com.tencent.mm.plugin.ipcall.a.b.d;
import com.tencent.mm.plugin.ipcall.a.i;
import com.tencent.mm.pluginsdk.permission.b;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.al;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.ui.MMActivity;
import com.tencent.mm.ui.base.a;
import com.tencent.mm.ui.base.h;

@a(3)
public class IPCallTalkUI extends MMActivity implements j.a {
    private String gHT;
    private String nCh;
    private String nCi;
    private String nCj;
    private String nCk;
    private int nCl;
    private int nCm;
    private j nFX;

    public void onWindowFocusChanged(boolean z) {
        super.onWindowFocusChanged(z);
        AppMethodBeat.at(this, z);
    }

    public final int getForceOrientation() {
        return 1;
    }

    public void onCreate(Bundle bundle) {
        AppMethodBeat.i(22363);
        super.onCreate(bundle);
        getSupportActionBar().hide();
        getWindow().addFlags(6946944);
        this.gHT = getIntent().getStringExtra("IPCallTalkUI_nickname");
        this.nCh = getIntent().getStringExtra("IPCallTalkUI_phoneNumber");
        this.nCi = getIntent().getStringExtra("IPCallTalkUI_contactId");
        this.nCj = getIntent().getStringExtra("IPCallTalkUI_countryCode");
        this.nCk = getIntent().getStringExtra("IPCallTalkUI_toWechatUsername");
        this.nCl = getIntent().getIntExtra("IPCallTalkUI_dialScene", 0);
        this.nCm = getIntent().getIntExtra("IPCallTalkUI_countryType", 0);
        ab.i("MicroMsg.IPCallTalkUI", "onCreate, mNickname: %s, mPhoneNumber: %s, mContactId: %s, mCountryCode: %s, toUsername:%s, mDialScene:%d ,mCountryType:%d", new Object[]{this.gHT, this.nCh, this.nCi, this.nCj, this.nCk, Integer.valueOf(this.nCl), Integer.valueOf(this.nCm)});
        ab.i("MicroMsg.IPCallTalkUI", "summerper checkPermission checkMicrophone[%b],stack[%s]", new Object[]{Boolean.valueOf(b.a(this, "android.permission.RECORD_AUDIO", 80, null, null)), bo.dpG()});
        if (b.a(this, "android.permission.RECORD_AUDIO", 80, null, null)) {
            init();
            AppMethodBeat.o(22363);
            return;
        }
        AppMethodBeat.o(22363);
    }

    private void init() {
        AppMethodBeat.i(22364);
        this.nFX = new j(this);
        this.nFX.nGI = this;
        this.nFX.b(this.gHT, this.nCh, this.nCi, this.nCj, this.nCk, this.nCl, this.nCm);
        AppMethodBeat.o(22364);
    }

    public void onDestroy() {
        AppMethodBeat.i(22365);
        super.onDestroy();
        setScreenEnable(true);
        if (this.nFX != null) {
            j jVar = this.nFX;
            ab.i("MicroMsg.TalkUIController", "onDestroy");
            jVar.nGH.nuX = null;
            i.bHt().crP = null;
            i.bHt().nxk = null;
            i.bHt().a(null);
            com.tencent.mm.plugin.ipcall.a.b.b bHt = i.bHt();
            bHt.nxh.nxu = null;
            d dVar = bHt.nxh;
            dVar.mfW.dps();
            dVar.mfS.dpt();
            jVar.nGG = null;
            jVar.nGI = null;
        }
        AppMethodBeat.o(22365);
    }

    public final int getLayoutId() {
        return 2130969890;
    }

    public final void ix(boolean z) {
        AppMethodBeat.i(22366);
        if (z) {
            al.n(new 1(this), 3000);
            AppMethodBeat.o(22366);
            return;
        }
        AppMethodBeat.o(22366);
    }

    public void onBackPressed() {
    }

    /* JADX WARNING: Removed duplicated region for block: B:10:0x002d  */
    /* JADX WARNING: Removed duplicated region for block: B:10:0x002d  */
    public boolean onKeyDown(int r5, android.view.KeyEvent r6) {
        /*
        r4 = this;
        r2 = -1;
        r3 = 22367; // 0x575f float:3.1343E-41 double:1.1051E-319;
        r0 = 1;
        com.tencent.matrix.trace.core.AppMethodBeat.i(r3);
        r1 = r4.nFX;
        if (r1 == 0) goto L_0x004a;
    L_0x000b:
        r1 = com.tencent.mm.plugin.ipcall.a.i.bHu();
        r1 = r1.bHl();
        if (r1 == 0) goto L_0x0048;
    L_0x0015:
        r1 = 25;
        if (r5 != r1) goto L_0x0031;
    L_0x0019:
        r1 = com.tencent.mm.plugin.ipcall.a.i.bHt();
        r1 = r1.bHJ();
        if (r1 == r2) goto L_0x0048;
    L_0x0023:
        r2 = com.tencent.mm.model.aw.ZL();
        r2.iK(r1);
        r1 = r0;
    L_0x002b:
        if (r1 == 0) goto L_0x004a;
    L_0x002d:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r3);
    L_0x0030:
        return r0;
    L_0x0031:
        r1 = 24;
        if (r5 != r1) goto L_0x0048;
    L_0x0035:
        r1 = com.tencent.mm.plugin.ipcall.a.i.bHt();
        r1 = r1.bHJ();
        if (r1 == r2) goto L_0x0048;
    L_0x003f:
        r2 = com.tencent.mm.model.aw.ZL();
        r2.iJ(r1);
        r1 = r0;
        goto L_0x002b;
    L_0x0048:
        r1 = 0;
        goto L_0x002b;
    L_0x004a:
        r0 = super.onKeyDown(r5, r6);
        com.tencent.matrix.trace.core.AppMethodBeat.o(r3);
        goto L_0x0030;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.plugin.ipcall.ui.IPCallTalkUI.onKeyDown(int, android.view.KeyEvent):boolean");
    }

    public void onPause() {
        AppMethodBeat.i(22368);
        ab.d("MicroMsg.IPCallTalkUI", "onPause");
        super.onPause();
        if (this.nFX != null) {
            ab.d("MicroMsg.TalkUIController", "onPause");
        }
        AppMethodBeat.o(22368);
    }

    public void onResume() {
        AppMethodBeat.i(22369);
        ab.d("MicroMsg.IPCallTalkUI", "onResume");
        super.onResume();
        if (this.nFX != null) {
            ab.d("MicroMsg.TalkUIController", "onResume");
            aw.getNotification().cancel(42);
        }
        AppMethodBeat.o(22369);
    }

    public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        AppMethodBeat.i(22370);
        if (iArr == null || iArr.length <= 0) {
            ab.i("MicroMsg.IPCallTalkUI", "onRequestPermissionsResult grantResults length 0. requestCode[%d], tid[%d]", new Object[]{Integer.valueOf(i), Long.valueOf(Thread.currentThread().getId())});
            AppMethodBeat.o(22370);
            return;
        }
        ab.i("MicroMsg.IPCallTalkUI", "onRequestPermissionsResult requestCode[%d],grantResults[%d] tid[%d]", new Object[]{Integer.valueOf(i), Integer.valueOf(iArr[0]), Long.valueOf(Thread.currentThread().getId())});
        switch (i) {
            case 80:
                if (iArr[0] != 0) {
                    h.a(this, getString(2131301928), getString(2131301936), getString(2131300878), getString(2131297773), false, new 2(this), new 3(this));
                    break;
                }
                init();
                AppMethodBeat.o(22370);
                return;
        }
        AppMethodBeat.o(22370);
    }
}
