TikTok.apk(点击下载) / AuthorizeActivity.java


package com.ss.android.ugc.aweme.account.login.authorize;

import X.AbstractC09530Zy;
import X.AbstractC12340eV;
import X.AbstractC21120sf;
import X.AbstractC37338ElT;
import X.AbstractC42530Gn1;
import X.AbstractC42534Gn5;
import X.AbstractC42537Gn8;
import X.AbstractC42538Gn9;
import X.AbstractC42573Gni;
import X.AnonymousClass07L;
import X.AnonymousClass0ED;
import X.AnonymousClass0NL;
import X.AnonymousClass0VA;
import X.AnonymousClass0WE;
import X.AnonymousClass1AS;
import X.AnonymousClass1IM;
import X.AnonymousClass1MT;
import X.C09590a4;
import X.C09730aI;
import X.C12260eN;
import X.C12450eg;
import X.C12460eh;
import X.C12720f7;
import X.C13920h3;
import X.C14300hf;
import X.C16500lD;
import X.C17640n3;
import X.C20240rF;
import X.C21090sc;
import X.C23860x5;
import X.C37336ElR;
import X.C37337ElS;
import X.C37346Elb;
import X.C37347Elc;
import X.C37628Eq9;
import X.C38514FAp;
import X.C41725Ga2;
import X.C42140Ggj;
import X.C42174GhH;
import X.C42175GhI;
import X.C42409Gl4;
import X.C42478GmB;
import X.C42482GmF;
import X.C42515Gmm;
import X.C42516Gmn;
import X.C42519Gmq;
import X.C42523Gmu;
import X.C42554GnP;
import X.C42555GnQ;
import X.C42556GnR;
import X.C42557GnS;
import X.C42558GnT;
import X.C42559GnU;
import X.C42576Gnl;
import X.C43065Gve;
import X.C43240GyT;
import X.C68742nH;
import X.C70872qi;
import X.C83043Or;
import X.C98033tQ;
import X.C99453vi;
import X.C99473vk;
import X.DialogC42574Gnj;
import X.EnumC12350eW;
import X.EnumC14310hg;
import X.H39;
import X.HR2;
import X.N25;
import X.RunnableC42511Gmi;
import X.RunnableC42514Gml;
import X.RunnableC42520Gmr;
import X.RunnableC42524Gmv;
import X.RunnableC42526Gmx;
import X.RunnableC42531Gn2;
import X.RunnableC42532Gn3;
import andhook.lib.xposed.callbacks.XCallback;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.view.View;
import android.view.Window;
import com.bytedance.apm.agent.v2.instrumentation.ActivityAgent;
import com.bytedance.covode.number.Covode;
import com.bytedance.lobby.auth.AuthResult;
import com.bytedance.sysoptimizer.EnterTransitionCrashOptimizer;
import com.ss.android.ugc.aweme.account.base.SafeHandler;
import com.ss.android.ugc.aweme.account.login.model.CommonUserInfo;
import com.ss.android.ugc.aweme.account.login.model.TPLoginMethod;
import com.ss.android.ugc.aweme.account.login.model.TPUserInfo;
import com.ss.android.ugc.aweme.account.login.v2.base.CommonFlowActivity;
import com.ss.android.ugc.aweme.common.MobClick;
import com.ss.android.ugc.aweme.compliance.api.a;
import com.ss.android.ugc.aweme.local_test.LocalTestApi;
import com.ss.android.ugc.aweme.main.service.ILanguageService;
import com.ss.android.ugc.aweme.profile.model.User;
import com.ss.android.ugc.aweme.services.IAccountHelperService;
import com.zhiliaoapp.musically.R;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.g.b.m;

public class AuthorizeActivity extends N25 implements AbstractC37338ElT, AbstractC42534Gn5, AbstractC42530Gn1, AbstractC42537Gn8, AbstractC42573Gni, AbstractC12340eV {
    public static final boolean LJIILIIL = false;
    public static Set<Integer> LJJIFFI = new HashSet();
    public AuthResult LJIIIIZZ;
    public String LJIIIZ;
    public String LJIIJ;
    public String LJIIJJI;
    public String LJIIL;
    public C37336ElR LJIILJJIL;
    public C37346Elb LJIILL;
    public AbstractC42538Gn9 LJIILLIIL;
    public AbstractC09530Zy LJIIZILJ;
    public boolean LJIJ;
    public boolean LJIJI;
    public boolean LJIJJ;
    public DialogC42574Gnj LJIJJLI;
    public boolean LJIL;
    public boolean LJJ;
    public Handler LJJI = new SafeHandler(this);
    public boolean LJJII = false;
    public int LJJIII = -1;
    public String LJJIIJ = "";
    public AnonymousClass1AS LJJIIJZLJL;
    public boolean LJJIIZ = false;
    public boolean LJJIIZI = false;

    static {
        Covode.recordClassIndex(44513);
    }

    public static Bundle LIZ(Intent intent) {
        try {
            return intent.getExtras();
        } catch (Exception unused) {
            return null;
        }
    }

    public static View LIZ(Window window) {
        View decorView;
        if (C16500lD.LIZIZ) {
            decorView = window.getDecorView();
        } else {
            synchronized (C16500lD.LIZ) {
                try {
                    decorView = window.getDecorView();
                } finally {
                }
            }
        }
        return decorView;
    }

    public static String LIZ(Intent intent, String str) {
        try {
            return intent.getStringExtra(str);
        } catch (Exception unused) {
            return null;
        }
    }

    private void LIZ(int i2, String str, AnonymousClass1AS r12) {
        if (i2 != 1381) {
            if (TextUtils.isEmpty(str)) {
                str = getString(R.string.dld);
            }
            new C20240rF(getBaseContext()).LIZ(str).LIZIZ();
            return;
        }
        if (r12.LJII != null) {
            C42482GmF gmF = new C42482GmF(r12.LJII.optJSONObject("data"));
            if (gmF.LIZ) {
                CommonFlowActivity.LIZ(this, gmF.LIZ(), EnumC12350eW.CHANGE_PASSWORD, gmF.LIZIZ(), new C99453vi(this), null, true);
                return;
            }
        }
        new C20240rF(getBaseContext()).LIZIZ(R.string.c76).LIZIZ();
    }

    private void LIZ(Boolean bool) {
        if (!TextUtils.isEmpty(this.LJIIIZ) && "google_onetap".equals(this.LJIIIZ)) {
            C43240GyT gyT = new C43240GyT();
            gyT.LIZ("enter_from", this.LJIIJ).LIZ("enter_method", this.LJIIJJI);
            if (bool.booleanValue()) {
                gyT.LIZ("exit_method", "dismiss");
            } else {
                gyT.LIZ("exit_method", "continue");
            }
            C14300hf.LIZ("exit_google_onetap", gyT.LIZ);
        }
    }

    private void LIZ(String str) {
        C68742nH.LIZ("monitor_login_auth_without_ttp_platform_uid", new C12720f7().LIZ("platform", str).LIZ());
    }

    private String LIZIZ(AuthResult authResult) {
        return TextUtils.equals("google", authResult.LIZLLL) ? "" : authResult.LJFF;
    }

    private boolean LIZIZ(int i2, Intent intent) {
        Bundle LIZ;
        if (i2 == 0 || intent == null || (LIZ = LIZ(intent)) == null || !LIZ.containsKey("callback")) {
            return false;
        }
        try {
            Uri parse = Uri.parse(LIZ.getString("callback"));
            String scheme = parse.getScheme();
            if (scheme != null) {
                if (scheme.startsWith("snssdk")) {
                    if ("connect_switch".equals(parse.getQueryParameter("error_name"))) {
                        return true;
                    }
                }
            }
        } catch (Exception unused) {
        }
        return false;
    }

    private String LIZJ(AuthResult authResult) {
        return (TextUtils.equals("google", authResult.LIZLLL) || TextUtils.equals("google_onetap", authResult.LIZLLL)) ? authResult.LJFF : authResult.LJI;
    }

    private int LJIIIIZZ() {
        return this.LJIJJ ? 3 : 1;
    }

    private AnonymousClass1AS LJIIIZ() {
        AnonymousClass1AS r2 = new AnonymousClass1AS(false, 1);
        r2.LIZLLL = XCallback.PRIORITY_HIGHEST;
        r2.LJFF = C12450eg.LIZ.LIZ();
        r2.LJII = C12450eg.LIZ.LIZJ();
        return r2;
    }

    @Override // X.N25
    public final int LIZ() {
        return R.layout.jn;
    }

    public final void LIZ(int i2, Intent intent) {
        intent.putExtra("platform", this.LJIIIZ);
        if (Looper.myLooper() == Looper.getMainLooper()) {
            setResult(i2, intent);
            finish();
            return;
        }
        this.LJJI.post(new RunnableC42524Gmv(this, i2, intent));
    }

    @Override // X.AbstractC42534Gn5
    public final void LIZ(int i2, AuthResult authResult) {
        if (!isFinishing()) {
            if (i2 == -1) {
                C42576Gnl.LIZIZ.LIZ(true, 56004, C37628Eq9.LIZLLL(authResult), (AbstractC12340eV) this, (Map<String, ? extends Object>) null);
            } else if (i2 == 0) {
                C42576Gnl.LIZIZ.LIZ(true, -3005, C37628Eq9.LIZLLL(authResult), (AbstractC12340eV) this, (Map<String, ? extends Object>) null);
            }
            if (authResult == null || i2 != 1) {
                LIZ(0, new Intent());
                finish();
                return;
            }
            LIZ(authResult, false);
        }
    }

    @Override // X.AbstractC42530Gn1
    public final void LIZ(int i2, String str, String str2, AnonymousClass1AS r11) {
        if (!isFinishing()) {
            this.LJJIII = i2;
            this.LJJIIJ = str;
            this.LJJIIJZLJL = r11;
            boolean z = false;
            LIZ((Boolean) false);
            this.LJJ = i2 == 1011;
            C42519Gmq gmq = new C42519Gmq();
            gmq.LIZJ = this.LJIIIZ;
            gmq.LIZIZ = "0";
            gmq.LIZLLL = String.valueOf(i2);
            gmq.LJ = this.LJIL ? "/passport/auth/only_login/" : "/passport/auth/login/";
            gmq.LIZ();
            if (LIZ(getIntent()) != null && LIZ(getIntent()).getBoolean("age_gate_block", false)) {
                z = true;
            }
            if (!this.LJIL || !this.LJJ) {
                if (!this.LJJ && this.LJIJ) {
                    C42576Gnl.LIZIZ.LIZ(false, i2, this.LJIIIZ, (AbstractC12340eV) this, (Map<String, ? extends Object>) null);
                    if (i2 > 0 && !C38514FAp.LIZ.contains(Integer.valueOf(i2)) && !C38514FAp.LIZIZ.contains(Integer.valueOf(i2))) {
                        if (i2 == 1450) {
                            this.LJJIIZ = new C42174GhH().LIZ(this, r11);
                            return;
                        }
                        LIZ(i2, str, r11);
                    }
                }
                if (this.LJIJ) {
                    C42478GmB.LIZ(this.LJIIIZ, i2, "passport error:".concat(String.valueOf(str)));
                    C70872qi.LIZ(i2, str, this.LJIIIZ);
                }
                LJII();
                return;
            }
            if (!TextUtils.isEmpty(str2)) {
                this.LJIIIIZZ.LJIIJ.putString("profile_key", str2);
            }
            this.LJJI.post(new RunnableC42511Gmi(this, z));
        }
    }

    @Override // X.AbstractC42530Gn1
    public final void LIZ(C09730aI r5) {
        C12460eh.LIZ.LIZ(r5.LJIIIIZZ, ((AnonymousClass1MT) r5).LJIJ);
        C13920h3.LIZ(r5);
        LIZ((Boolean) false);
        if (this.LJIJ) {
            String str = this.LJIIIZ;
            if (C70872qi.LIZ()) {
                C68742nH.LIZ("aweme_thirdparty_login_error_rate", 1, C70872qi.LIZ(str).LIZ("app_language", ((ILanguageService) C12260eN.LIZ(ILanguageService.class)).LIZ()).LIZ("platform", str).LIZ());
            }
        }
        ((IAccountHelperService) C12260eN.LIZ(IAccountHelperService.class)).AppsFlyerUtilsTrackLoginSuccess(this.LJIIIZ);
        this.LJJI.post(new RunnableC42526Gmx(this, r5));
    }

    @Override // X.AbstractC37338ElT
    public final void LIZ(AuthResult authResult) {
        Set<String> keySet;
        if (LJIILIIL) {
            Bundle bundle = authResult.LJIIJ;
            C21090sc.LIZ("AuthorizeActivity");
            if (!(bundle == null || (keySet = bundle.keySet()) == null)) {
                Iterator<T> it = keySet.iterator();
                while (it.hasNext()) {
                    it.next();
                }
            }
        }
        if (!isFinishing() && !isDestroyed()) {
            this.LJIIIIZZ = authResult;
            if (authResult.LIZ) {
                LIZ(authResult, true);
            } else if (authResult.LIZIZ) {
                LIZ((Boolean) true);
                this.LJJI.post(new RunnableC42520Gmr(this));
            } else {
                this.LJJI.post(new RunnableC42514Gml(this));
            }
            AbstractC42538Gn9 gn9 = this.LJIILLIIL;
            if (gn9 != null) {
                gn9.LIZ(authResult);
            }
        }
    }

    public final void LIZ(AuthResult authResult, boolean z) {
        String LIZ = C37628Eq9.LIZ(authResult);
        String LIZJ = C37628Eq9.LIZJ(authResult);
        String LIZLLL = C37628Eq9.LIZLLL(authResult);
        long j = authResult.LJIIIIZZ / 1000;
        String LIZIZ = LIZIZ(authResult);
        String LIZJ2 = LIZJ(authResult);
        HashMap hashMap = new HashMap();
        if (!TextUtils.isEmpty(authResult.LJ)) {
            hashMap.put("uid", Uri.encode(authResult.LJ));
        }
        if (!TextUtils.isEmpty(LIZJ2)) {
            hashMap.put("access_token_secret", Uri.encode(LIZJ2));
        }
        if (!TextUtils.isEmpty(C37628Eq9.LIZIZ(authResult))) {
            hashMap.put("profile_key", Uri.encode(C37628Eq9.LIZIZ(authResult)));
        }
        int LJIIIIZZ2 = LJIIIIZZ();
        if (LJIIIIZZ2 == 1) {
            this.LJIL = z;
            if (this.LJIJ && C13920h3.LJI().isEnableMultiAccountLogin()) {
                hashMap.put("multi_login", Uri.encode("1"));
            }
            String str = TextUtils.equals("facebook", authResult.LIZLLL) ? authResult.LJII : authResult.LJ;
            if (TextUtils.isEmpty(str)) {
                LIZ(authResult.LIZLLL);
                AnonymousClass1AS LJIIIZ2 = LJIIIZ();
                LIZ(LJIIIZ2.LIZLLL, LJIIIZ2.LJFF, null, LJIIIZ2);
                return;
            }
            hashMap.put("ttp_platform_uid", AnonymousClass0NL.LIZJ(str));
            if (!z) {
                Map<String, String> LIZIZ2 = C43065Gve.LIZ.LIZIZ();
                if (LIZIZ2.size() > 0) {
                    hashMap.putAll(LIZIZ2);
                }
                if (this.LJIJ) {
                    if (this.LJIJI) {
                        hashMap.put("multi_signup", "1");
                    } else {
                        hashMap.put("multi_signup", "0");
                    }
                }
                if (!TextUtils.isEmpty(LIZ)) {
                    this.LJIIZILJ.LIZ(LIZJ, LIZLLL, LIZ, j, hashMap, new C42516Gmn(this));
                } else {
                    this.LJIIZILJ.LIZIZ(LIZJ, LIZLLL, LIZIZ, j, hashMap, new C42516Gmn(this));
                }
            } else if (!TextUtils.isEmpty(LIZ)) {
                this.LJIIZILJ.LIZJ(LIZJ, LIZLLL, LIZ, j, hashMap, new C42516Gmn(this));
            } else {
                this.LJIIZILJ.LIZLLL(LIZJ, LIZLLL, LIZIZ, j, hashMap, new C42516Gmn(this));
            }
        } else if (LJIIIIZZ2 != 3) {
            this.LJJI.post(new RunnableC42531Gn2(this));
        } else {
            Intent intent = new Intent();
            if (!TextUtils.isEmpty(LIZIZ)) {
                intent.putExtra("access_token", LIZIZ);
            }
            if (!TextUtils.isEmpty(LIZJ2)) {
                intent.putExtra("access_token_secret", LIZJ2);
            }
            if (!TextUtils.isEmpty(LIZ)) {
                intent.putExtra("code", LIZ);
            }
            if (j > 0) {
                intent.putExtra("expires_in", j);
            }
            if (!TextUtils.isEmpty(LIZJ)) {
                intent.putExtra("platform_id", LIZJ);
            }
            LIZ(-1, intent);
        }
        this.LJJI.post(new RunnableC42532Gn3(this));
    }

    /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARNING: Code restructure failed: missing block: B:62:0x0157, code lost:
        if (r10.equals(r9) != false) goto L_0x006a;
     */
    /* JADX WARNING: Removed duplicated region for block: B:11:0x0083  */
    /* JADX WARNING: Removed duplicated region for block: B:21:0x00ae  */
    /* JADX WARNING: Removed duplicated region for block: B:24:0x00ba  */
    /* JADX WARNING: Removed duplicated region for block: B:27:0x00c6  */
    /* JADX WARNING: Removed duplicated region for block: B:30:0x00d2  */
    /* JADX WARNING: Removed duplicated region for block: B:33:0x00de  */
    /* JADX WARNING: Removed duplicated region for block: B:36:0x00ea  */
    @Override // X.N25
    public final void LIZIZ() {
        super.LIZIZ();
        Window window = getWindow();
        if (Build.VERSION.SDK_INT >= 21) {
            window.clearFlags(201326592);
            LIZ(window).setSystemUiVisibility(1280);
            window.addFlags(Integer.MIN_VALUE);
            window.setStatusBarColor(0);
        } else {
            int i2 = Build.VERSION.SDK_INT;
            window.addFlags(67108864);
        }
        this.LJIIZILJ = C09590a4.LIZIZ(this);
        Intent intent = getIntent();
        this.LJIIIZ = LIZ(intent, "platform");
        this.LJIJ = intent.getBooleanExtra("is_login", true);
        this.LJIJI = intent.getBooleanExtra("is_multi_account_same_user", false);
        boolean booleanExtra = intent.getBooleanExtra("is_only_fetch_token", false);
        this.LJIJJ = booleanExtra;
        if (booleanExtra) {
            this.LJIJ = false;
        }
        String str = this.LJIIIZ;
        String str2 = "google_onetap";
        if (str != null) {
            switch (str.hashCode()) {
                case -1240244679:
                    if (str.equals("google")) {
                        LocalTestApi localTestApi = C17640n3.LIZ.LIZ;
                        m.LIZIZ(localTestApi, "");
                        localTestApi.getAccountDebugService();
                        if (!C37336ElR.LIZ().LIZ("google")) {
                            str2 = "google_web";
                            break;
                        } else {
                            str2 = "google";
                            break;
                        }
                    }
                    break;
                case -916346253:
                    if (str.equals("twitter")) {
                        str2 = "twitter";
                        break;
                    }
                    break;
                case 3765:
                    if (str.equals("vk")) {
                        str2 = "vk";
                        break;
                    }
                    break;
                case 3321844:
                    if (str.equals("line")) {
                        str2 = "line";
                        break;
                    }
                    break;
                case 28903346:
                    if (str.equals("instagram")) {
                        str2 = "instagram";
                        break;
                    }
                    break;
                case 323062851:
                    break;
                case 486515695:
                    if (str.equals("kakaotalk")) {
                        str2 = "kakaotalk";
                        break;
                    }
                    break;
                case 497130182:
                    if (str.equals("facebook")) {
                        str2 = "facebook";
                        break;
                    }
                    break;
            }
            this.LJIILJJIL = C37336ElR.LIZ();
            C37347Elc elc = new C37347Elc(this);
            elc.LIZJ = this;
            elc.LIZ = str2;
            C21090sc.LIZ(str2);
            AbstractC42538Gn9 gn9 = null;
            if (!TextUtils.isEmpty(str2)) {
                Bundle bundle = new Bundle();
                int hashCode = str2.hashCode();
                if (hashCode != -1240244679) {
                    if (hashCode != 28903346) {
                        if (hashCode == 497130182 && str2.equals("facebook")) {
                            if (AnonymousClass0WE.LJJI.LJIIJ()) {
                                bundle.putString("fb_read_permissions", "public_profile, email");
                            } else {
                                bundle.putString("fb_read_permissions", "public_profile, user_age_range, email, user_friends");
                            }
                        }
                    } else if (str2.equals("instagram")) {
                        bundle.putString("ig_redirect_url", "https://api.tiktokv.com/passport/auth/wap_login_success/");
                    }
                } else if (str2.equals("google")) {
                    bundle.putBoolean("google_force_sign_out", C42523Gmu.LIZIZ.LIZ());
                }
                if (bundle != null) {
                    elc.LIZ(bundle);
                }
            }
            this.LJIILL = elc.LIZ();
            C21090sc.LIZ(str2);
            switch (str2.hashCode()) {
                case -1240244679:
                    if (str2.equals("google")) {
                        gn9 = new C42556GnR();
                        break;
                    }
                    break;
                case -916346253:
                    if (str2.equals("twitter")) {
                        gn9 = new C42555GnQ();
                        break;
                    }
                    break;
                case 3765:
                    if (str2.equals("vk")) {
                        gn9 = new C42559GnU();
                        break;
                    }
                    break;
                case 3321844:
                    if (str2.equals("line")) {
                        gn9 = new C42557GnS();
                        break;
                    }
                    break;
                case 486515695:
                    if (str2.equals("kakaotalk")) {
                        gn9 = new C42558GnT();
                        break;
                    }
                    break;
                case 497130182:
                    if (str2.equals("facebook")) {
                        gn9 = new C42554GnP();
                        break;
                    }
                    break;
            }
            this.LJIILLIIL = gn9;
        }
        str2 = "";
        this.LJIILJJIL = C37336ElR.LIZ();
        C37347Elc elc2 = new C37347Elc(this);
        elc2.LIZJ = this;
        elc2.LIZ = str2;
        C21090sc.LIZ(str2);
        AbstractC42538Gn9 gn92 = null;
        if (!TextUtils.isEmpty(str2)) {
        }
        this.LJIILL = elc2.LIZ();
        C21090sc.LIZ(str2);
        switch (str2.hashCode()) {
            case -1240244679:
                break;
            case -916346253:
                break;
            case 3765:
                break;
            case 3321844:
                break;
            case 486515695:
                break;
            case 497130182:
                break;
        }
        this.LJIILLIIL = gn92;
    }

    @Override // X.AbstractC42537Gn8
    public final void LIZIZ(int i2, AuthResult authResult) {
        if (i2 == -1) {
            LIZ(authResult, false);
            return;
        }
        LIZ(0, new Intent());
        finish();
    }

    public final void LIZIZ(C09730aI r2) {
        this.LJJIIZI = true;
        C42175GhI.LIZIZ = null;
        LIZ(r2);
    }

    public final /* synthetic */ void LIZJ(final C09730aI r9) {
        AuthResult authResult;
        boolean z;
        if (this.LJIJ) {
            if (!TextUtils.isEmpty(this.LJIIIZ) && "facebook".equals(this.LJIIIZ) && r9 != null && (authResult = this.LJIIIIZZ) != null) {
                String[] stringArray = authResult.LJIIJ.getStringArray("fb_granted_permissions");
                int length = stringArray.length;
                int i2 = 0;
                while (true) {
                    if (i2 >= length) {
                        z = false;
                        break;
                    } else if ("user_friends".equals(stringArray[i2])) {
                        z = true;
                        break;
                    } else {
                        i2++;
                    }
                }
                String valueOf = String.valueOf(r9.LIZ);
                String str = this.LJIIIIZZ.LJFF;
                long j = this.LJIIIIZZ.LJIIIIZZ;
                if (z) {
                    HR2.LIZ.LJIIIZ().LIZ(valueOf, str, j);
                } else {
                    HR2.LIZ.LJIIIZ().LIZIZ(valueOf);
                }
            }
            final Intent intent = new Intent();
            C41725Ga2 ga2 = null;
            if (a.LJII().LIZ() != EnumC14310hg.PASS && this.LJJ) {
                EnumC14310hg r0 = EnumC14310hg.PASS;
                ga2 = new C41725Ga2(false, r0, r0);
            }
            Bundle bundle = new Bundle(LIZ(getIntent()));
            if (r9.LJ) {
                bundle.putBoolean("new_user_need_set_username", true);
                bundle.putBoolean("new_user_need_get_recommend_username", true);
                bundle.putString("set_username_platform", C37628Eq9.LIZ(this.LJIILL));
                bundle.putString("enter_from", this.LJIIJ);
                bundle.putString("enter_method", this.LJIIJJI);
            }
            bundle.putInt("current_scene", (r9.LJ ? EnumC12350eW.SIGN_UP : EnumC12350eW.LOGIN).getValue());
            bundle.putString("platform", C37628Eq9.LIZ(this.LJIILL));
            bundle.putString("login_path", "third_party_auth");
            if (ga2 != null) {
                bundle.putSerializable("age_gate_response", ga2);
            }
            C98033tQ.LIZ(bundle, new AnonymousClass1IM<AnonymousClass0ED<Bundle>, C23860x5>() {
                /* class com.ss.android.ugc.aweme.account.login.authorize.AuthorizeActivity.AnonymousClass1 */

                static {
                    Covode.recordClassIndex(44514);
                }

                /* Return type fixed from 'java.lang.Object' to match base method */
                /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                @Override // X.AnonymousClass1IM
                public final /* synthetic */ C23860x5 invoke(AnonymousClass0ED<Bundle> r12) {
                    if (r12.LIZJ()) {
                        AuthorizeActivity.this.LIZ(0, intent);
                    } else {
                        C42409Gl4.LIZ(11);
                        AuthorizeActivity.this.LIZ(-1, intent);
                        C42576Gnl.LIZIZ.LIZ(r9.LJ, AuthorizeActivity.this.LJIIIZ, AuthorizeActivity.this, r9, (Map<String, ? extends Object>) null);
                    }
                    User LJFF = C13920h3.LJFF();
                    String uid = LJFF.getUid();
                    if (!TextUtils.isEmpty(uid) && AuthorizeActivity.this.getIntent().getBooleanExtra("need_remember_login_method", true)) {
                        C83043Or.LIZIZ(new TPLoginMethod(uid, AuthorizeActivity.this.LJIIIZ, TPUserInfo.from(LJFF), false, CommonUserInfo.defaultCommonUserInfo(), Long.valueOf(System.currentTimeMillis())));
                    }
                    if (C13920h3.LIZLLL()) {
                        C13920h3.LIZ(1, 1, (Object) "");
                        C13920h3.LIZ(C13920h3.LJFF());
                    }
                    if (AuthorizeActivity.this.LJIIIIZZ == null) {
                        return null;
                    }
                    ((IAccountHelperService) C12260eN.LIZ(IAccountHelperService.class)).friendUploadToken(AuthorizeActivity.this.LJIIIZ, AuthorizeActivity.this.LJIIIIZZ.LJFF, AuthorizeActivity.this.LJIIIIZZ.LJI);
                    return null;
                }
            });
            if ("find_account".equals(this.LJIIJ)) {
                AbstractC21120sf.LIZ(new C99473vk());
                return;
            }
            return;
        }
        LIZ(-1, new Intent());
    }

    public final void LJFF() {
        if (this.LJIJJLI == null) {
            DialogC42574Gnj gnj = new DialogC42574Gnj(this);
            this.LJIJJLI = gnj;
            gnj.LIZ = this;
        }
        H39.LIZ(this.LJIJJLI);
    }

    @Override // X.AbstractC42573Gni
    public final void LJI() {
        LIZ(0, new Intent());
    }

    public final void LJII() {
        C42175GhI.LIZIZ = null;
        if (this.LJIJ) {
            C42478GmB.LIZ(this.LJIIIZ, this.LJJIII, "passport error:" + this.LJJIIJ);
            C70872qi.LIZ(this.LJJIII, this.LJJIIJ, this.LJIIIZ);
        }
        Intent intent = new Intent();
        intent.putExtra("error_code", this.LJJIII);
        if (a.LJII().LIZ() == EnumC14310hg.US_FTC && this.LJJ && !TextUtils.equals(this.LJIIIZ, "facebook") && !TextUtils.equals(this.LJIIIZ, "google") && C42140Ggj.LIZ() != EnumC14310hg.PASS.getValue()) {
            LIZ(0, intent);
        } else if (this.LJJIIJZLJL.LIZ()) {
            intent.putExtra("description", this.LJJIII);
            intent.putExtra("repeat_bind_error", true);
            LIZ(999, intent);
        } else {
            intent.putExtra("description", this.LJJIII);
            LIZ(0, intent);
        }
    }

    @Override // X.AbstractC12340eV
    public final String aq_() {
        return this.LJIIJ;
    }

    @Override // X.AbstractC12340eV
    public final String ar_() {
        return this.LJIIJJI;
    }

    @Override // X.AbstractC12340eV
    public final String as_() {
        return LIZ(getIntent(), "enter_type");
    }

    @Override // X.AbstractC12340eV
    public final String at_() {
        return this.LJIIL;
    }

    @Override // X.AbstractC12340eV
    public final Bundle av_() {
        return LIZ(getIntent());
    }

    @Override // X.ActivityC34531Yc
    public void finish() {
        H39.LIZIZ(this.LJIJJLI);
        super.finish();
    }

    @Override // X.ActivityC31021Kp, X.ActivityC34411Xq, X.ActivityC34531Yc
    public void onActivityResult(int i2, int i3, Intent intent) {
        if (i2 == 32972) {
            if (LIZIZ(i3, intent)) {
                Intent intent2 = new Intent();
                intent2.putExtra("repeat_bind_error", true);
                LIZ(0, intent2);
                return;
            }
            this.LJIIZILJ.LIZ(this.LJIIIZ, new C42515Gmm(this));
        }
        super.onActivityResult(i2, i3, intent);
    }

    @Override // X.ActivityC31021Kp, X.AnonymousClass114, X.N25, X.ActivityC34411Xq, X.ActivityC34531Yc, X.ActivityC32381Pv
    public void onCreate(Bundle bundle) {
        AnonymousClass0VA.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.account.login.authorize.AuthorizeActivity", "onCreate", true);
        super.onCreate(bundle);
        LJJIFFI.add(Integer.valueOf(hashCode()));
        if (LJJIFFI.size() != 1) {
            finish();
            ActivityAgent.onTrace("com.ss.android.ugc.aweme.account.login.authorize.AuthorizeActivity", "onCreate", false);
            return;
        }
        this.LJIIJ = LIZ(getIntent(), "enter_from");
        this.LJIIJJI = LIZ(getIntent(), "enter_method");
        this.LJIIL = LIZ(getIntent(), "auth_from_app");
        a.LJII().LIZIZ(null);
        if (!(this.LJIILJJIL == null || this.LJIILL == null)) {
            C14300hf.onEvent(MobClick.obtain().setEventName("sign_in").setLabelName(this.LJIIIZ));
            C42478GmB.LIZ = System.currentTimeMillis();
            if ("google_web".equals(this.LJIILL.LIZIZ)) {
                LJFF();
            }
            this.LJIILJJIL.LIZ(this.LJIILL);
            if (this.LJIJ) {
                C14300hf.LIZ("token_request", new C43240GyT().LIZ("enter_method", this.LJIIJJI).LIZ("enter_from", this.LJIIJ).LIZ("platform", this.LJIIIZ).LIZ("_perf_monitor", 1).LIZ);
            }
        }
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.account.login.authorize.AuthorizeActivity", "onCreate", false);
    }

    @Override // X.ActivityC31021Kp, X.ActivityC34531Yc, X.ActivityC32381Pv
    public void onDestroy() {
        AnonymousClass0VA.LJ(this);
        super.onDestroy();
        if (this.LJIILJJIL != null) {
            C37337ElS LIZ = C37337ElS.LIZ();
            synchronized (LIZ.LIZ) {
                try {
                    for (Map.Entry<AnonymousClass07L<String, Integer>, List<AbstractC37338ElT>> entry : LIZ.LIZ.entrySet()) {
                        List<AbstractC37338ElT> value = entry.getValue();
                        if (value != null) {
                            value.remove(this);
                        }
                    }
                } catch (Throwable th) {
                    throw th;
                }
            }
        }
        Set<Integer> set = LJJIFFI;
        if (set != null) {
            set.remove(Integer.valueOf(hashCode()));
        }
    }

    @Override // X.ActivityC31021Kp, X.ActivityC34531Yc
    public void onPause() {
        AnonymousClass0VA.LIZJ(this);
        super.onPause();
    }

    @Override // X.ActivityC31021Kp, X.ActivityC34531Yc
    public void onResume() {
        AnonymousClass0VA.LIZIZ(this);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.account.login.authorize.AuthorizeActivity", "onResume", true);
        super.onResume();
        if (this.LJJIIZ && !this.LJJIIZI) {
            LJII();
        }
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.account.login.authorize.AuthorizeActivity", "onResume", false);
    }

    @Override // X.ActivityC31021Kp, X.ActivityC34531Yc, X.ActivityC32381Pv
    public void onStart() {
        AnonymousClass0VA.LIZ(this);
        super.onStart();
    }

    @Override // X.ActivityC31021Kp, X.ActivityC34531Yc, X.ActivityC32381Pv
    public void onStop() {
        AnonymousClass0VA.LIZLLL(this);
        super.onStop();
        if (EnterTransitionCrashOptimizer.getContext() != null && Build.VERSION.SDK_INT >= 21) {
            try {
                LIZ(getWindow()).getViewTreeObserver().dispatchOnPreDraw();
            } catch (Throwable unused) {
            }
        }
        if (Build.VERSION.SDK_INT >= 21) {
            try {
                LIZ(getWindow()).getViewTreeObserver().dispatchOnPreDraw();
            } catch (Throwable unused2) {
            }
        }
    }

    @Override // X.ActivityC34531Yc
    public void onWindowFocusChanged(boolean z) {
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.account.login.authorize.AuthorizeActivity", "onWindowFocusChanged", true);
        super.onWindowFocusChanged(z);
    }
}