导航菜单

页面标题

页面副标题

饼干视频 v4.1.0 - TTDelegateActivity.java 源代码

正在查看: 饼干视频 v4.1.0 应用的 TTDelegateActivity.java JAVA 源代码文件

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


package com.ss.android.downloadlib.activity;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import com.sigmob.sdk.base.k;
import com.ss.android.download.api.config.fo;
import com.ss.android.download.api.config.sc;
import com.ss.android.download.api.constant.BaseConstants;
import com.ss.android.download.api.model.ud;
import com.ss.android.downloadad.api.constant.AdBaseConstants;
import com.ss.android.downloadad.api.i.ud;
import com.ss.android.downloadlib.addownload.i.q;
import com.ss.android.downloadlib.addownload.qc;
import com.ss.android.downloadlib.addownload.rq;
import com.ss.android.downloadlib.addownload.ud.e;
import com.ss.android.downloadlib.guide.install.i;
import com.ss.android.downloadlib.ht.w;
import com.ss.android.downloadlib.ht.y;
import com.ss.android.downloadlib.ms;
import com.ss.android.socialbase.appdownloader.fu;
import com.ss.android.socialbase.downloader.downloader.Downloader;
import com.ss.android.socialbase.downloader.model.DownloadInfo;
import java.lang.ref.WeakReference;
import org.json.JSONObject;

public class TTDelegateActivity extends Activity implements ActivityCompat.OnRequestPermissionsResultCallback {
    private static i gg;
    private ud fu;
    public Intent i = null;
    private boolean ud;

    private static Intent fu(@NonNull com.ss.android.downloadad.api.i.i iVar) {
        return new Intent(qc.getContext(), (Class<?>) TTDelegateActivity.class);
    }

    public static void i(String str, String[] strArr) {
        Intent intent = new Intent(qc.getContext(), (Class<?>) TTDelegateActivity.class);
        intent.addFlags(268435456);
        intent.putExtra("type", 1);
        intent.putExtra("permission_id_key", str);
        intent.putExtra("permission_content_key", strArr);
        if (qc.getContext() != null) {
            qc.getContext().startActivity(intent);
        }
    }

    public static void ud(String str, com.ss.android.downloadad.api.i.i iVar) {
        Intent fu = fu(iVar);
        fu.addFlags(268435456);
        fu.putExtra("type", 11);
        fu.putExtra(k.p, str);
        if (qc.getContext() != null) {
            qc.getContext().startActivity(fu);
        }
    }

    @Override
    public void onCreate(@Nullable Bundle bundle) {
        super.onCreate(bundle);
        ud();
        this.i = getIntent();
        qc.ud(this);
        i();
    }

    @Override
    public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
        this.i = intent;
        qc.ud(this);
        i();
    }

    @Override
    public void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr) {
        super.onRequestPermissionsResult(i, strArr, iArr);
        qc.q().i(this, i, strArr, iArr);
    }

    @Override
    public void onStop() {
        ud udVar;
        super.onStop();
        if (!this.ud || (udVar = this.fu) == null) {
            return;
        }
        DownloadInfo i = !TextUtils.isEmpty(udVar.z()) ? ms.i(qc.getContext()).i(this.fu.z(), null, true) : ms.i(qc.getContext()).ud(this.fu.i());
        if (i == null || i.getCurBytes() < i.getTotalBytes() || isFinishing()) {
            return;
        }
        finish();
    }

    private void fu() {
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.downloadlib.activity.TTDelegateActivity.fu():void");
    }

    public static void ud(String str, long j, String str2) {
        Intent intent = new Intent(qc.getContext(), (Class<?>) TTDelegateActivity.class);
        intent.addFlags(268435456);
        intent.putExtra("type", 14);
        intent.putExtra(k.p, str);
        intent.putExtra("model_id", j);
        intent.putExtra("market_app_id", str2);
        if (qc.getContext() != null) {
            qc.getContext().startActivity(intent);
        }
    }

    public static void i(String str, com.ss.android.downloadad.api.i.i iVar) {
        Intent fu = fu(iVar);
        fu.addFlags(268435456);
        fu.putExtra("type", 2);
        fu.putExtra(AdBaseConstants.MARKET_OPEN_INTENT_OPEN_URL, str);
        if (qc.getContext() != null) {
            qc.getContext().startActivity(fu);
        }
    }

    public static void i(com.ss.android.downloadad.api.i.i iVar) {
        Intent fu = fu(iVar);
        fu.addFlags(268435456);
        fu.putExtra("type", 4);
        fu.putExtra("model_id", iVar.ud());
        if (qc.getContext() != null) {
            qc.getContext().startActivity(fu);
        }
    }

    public static void ud(@NonNull com.ss.android.downloadad.api.i.i iVar) {
        i(iVar, 5, "", "", "", "");
    }

    public static void ud(@NonNull com.ss.android.downloadad.api.i.i iVar, String str, String str2, String str3) {
        i(iVar, 7, str, str2, str3, "");
    }

    public static void ud(@NonNull com.ss.android.downloadad.api.i.i iVar, String str, String str2, String str3, String str4) {
        i(iVar, 20, str, str2, str3, str4);
    }

    private void ud() {
        Window window = getWindow();
        WindowManager.LayoutParams attributes = window.getAttributes();
        attributes.alpha = 0.0f;
        window.setAttributes(attributes);
    }

    public static void i(com.ss.android.downloadad.api.i.i iVar, i iVar2) {
        Intent fu = fu(iVar);
        fu.addFlags(268435456);
        fu.putExtra("type", 9);
        gg = iVar2;
        if (qc.getContext() != null) {
            qc.getContext().startActivity(fu);
        }
    }

    private void ud(final String str, String[] strArr) {
        if (!TextUtils.isEmpty(str) && strArr != null && strArr.length > 0) {
            sc scVar = new sc() {
                private WeakReference<Activity> fu;

                {
                    this.fu = new WeakReference<>(TTDelegateActivity.this);
                }

                @Override
                public void i() {
                    com.ss.android.downloadlib.ht.ms.i(str);
                    fu.i(this.fu.get());
                }

                @Override
                public void i(String str2) {
                    com.ss.android.downloadlib.ht.ms.i(str, str2);
                    fu.i(this.fu.get());
                }
            };
            try {
                qc.q().i(this, strArr, scVar);
                return;
            } catch (Exception e) {
                qc.sc().i(e, "requestPermission");
                scVar.i();
                return;
            }
        }
        fu.i((Activity) this);
    }

    public static void i(long j) {
        Intent intent = new Intent(qc.getContext(), (Class<?>) TTDelegateActivity.class);
        intent.addFlags(268435456);
        intent.putExtra("type", 10);
        intent.putExtra("app_info_id", j);
        if (qc.getContext() != null) {
            qc.getContext().startActivity(intent);
        }
    }

    private void ud(String str) {
        Intent ht = y.ht(this, str);
        if (ht == null) {
            return;
        }
        try {
            ht.addFlags(268435456);
            ht.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
            startActivity(ht);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            fu.i((Activity) this);
        }
    }

    public static void i(String str, long j, String str2, @NonNull JSONObject jSONObject) {
        Intent intent = new Intent(qc.getContext(), (Class<?>) TTDelegateActivity.class);
        intent.addFlags(268435456);
        intent.putExtra("type", 12);
        intent.putExtra(k.p, str);
        intent.putExtra("model_id", j);
        intent.putExtra("param", str2);
        intent.putExtra("ext_json", jSONObject.toString());
        if (qc.getContext() != null) {
            qc.getContext().startActivity(intent);
        }
    }

    private void ud(long j) {
        final ud gg2 = e.i().gg(j);
        if (gg2 == null) {
            com.ss.android.downloadlib.q.fu.i().i("showOpenAppDialogInner nativeModel null");
            fu.i((Activity) this);
            return;
        }
        fo fu = qc.fu();
        ud.i i = new ud.i(this).i("已安装完成");
        Object[] objArr = new Object[1];
        objArr[0] = TextUtils.isEmpty(gg2.ie()) ? "刚刚下载的应用" : gg2.ie();
        fu.ud(i.ud(String.format("%1$s已安装完成,是否立即打开?", objArr)).fu("打开").gg("取消").i(false).i(y.gg(this, gg2.q())).i(new ud.InterfaceC3349ud() {
            @Override
            public void fu(DialogInterface dialogInterface) {
                fu.i((Activity) TTDelegateActivity.this);
            }

            @Override
            public void i(DialogInterface dialogInterface) {
                com.ss.android.downloadlib.ud.i.ud(gg2);
                TTDelegateActivity tTDelegateActivity = TTDelegateActivity.this;
                if (tTDelegateActivity != null && !tTDelegateActivity.isFinishing()) {
                    dialogInterface.dismiss();
                }
                fu.i((Activity) TTDelegateActivity.this);
            }

            @Override
            public void ud(DialogInterface dialogInterface) {
                com.ss.android.downloadlib.gg.i.i().ud("market_openapp_cancel", gg2);
                TTDelegateActivity tTDelegateActivity = TTDelegateActivity.this;
                if (tTDelegateActivity != null && !tTDelegateActivity.isFinishing()) {
                    dialogInterface.dismiss();
                }
                fu.i((Activity) TTDelegateActivity.this);
            }
        }).i(2).i());
        com.ss.android.downloadlib.gg.i.i().ud("market_openapp_window_show", gg2);
    }

    public static void i(String str, long j, String str2) {
        Intent intent = new Intent(qc.getContext(), (Class<?>) TTDelegateActivity.class);
        intent.addFlags(268435456);
        intent.putExtra("type", 13);
        intent.putExtra(k.p, str);
        intent.putExtra("model_id", j);
        intent.putExtra(BaseConstants.VIVO_MARKET_NEED_COMMENT, str2);
        if (qc.getContext() != null) {
            qc.getContext().startActivity(intent);
        }
    }

    public static void i(String str, long j) {
        Intent intent = new Intent(qc.getContext(), (Class<?>) TTDelegateActivity.class);
        intent.addFlags(268435456);
        intent.putExtra("type", 15);
        intent.putExtra(k.p, str);
        intent.putExtra("model_id", j);
        if (qc.getContext() != null) {
            qc.getContext().startActivity(intent);
        }
    }

    private void fu(long j) {
        new com.ss.android.downloadlib.addownload.compliance.i(this, j).show();
    }

    public static void i(Context context, String str, long j) {
        Intent intent = new Intent(context, (Class<?>) TTDelegateActivity.class);
        intent.addFlags(268435456);
        intent.putExtra("type", 16);
        intent.putExtra(k.p, str);
        intent.putExtra("model_id", j);
        if (context != null) {
            context.startActivity(intent);
        }
    }

    public static void i(@NonNull com.ss.android.downloadad.api.i.i iVar, String str) {
        i(iVar, 19, "", "", "", str);
    }

    public static void i(@NonNull com.ss.android.downloadad.api.i.i iVar, String str, String str2, String str3) {
        i(iVar, 8, str, str2, str3, "");
    }

    public static void i(@NonNull com.ss.android.downloadad.api.i.i iVar, String str, String str2, String str3, String str4) {
        i(iVar, 21, str, str2, str3, str4);
    }

    private static void i(@NonNull com.ss.android.downloadad.api.i.i iVar, int i, String str, String str2, String str3, String str4) {
        Intent fu = fu(iVar);
        fu.addFlags(268435456);
        fu.putExtra("type", i);
        if (!TextUtils.isEmpty(str2)) {
            fu.putExtra("positive_button_text", str2);
        }
        if (!TextUtils.isEmpty(str3)) {
            fu.putExtra("negative_button_text", str3);
        }
        if (!TextUtils.isEmpty(str4)) {
            fu.putExtra("delete_button_text", str4);
        }
        if (!TextUtils.isEmpty(str)) {
            fu.putExtra("message_text", str);
        }
        fu.putExtra("model_id", iVar.ud());
        if (qc.getContext() != null) {
            qc.getContext().startActivity(fu);
        }
    }

    public void i() {
        Intent intent = this.i;
        if (intent != null) {
            switch (intent.getIntExtra("type", 0)) {
                case 1:
                    ud(this.i.getStringExtra("permission_id_key"), this.i.getStringArrayExtra("permission_content_key"));
                    break;
                case 2:
                    i(this.i.getStringExtra(AdBaseConstants.MARKET_OPEN_INTENT_OPEN_URL));
                    break;
                case 3:
                case 6:
                case 17:
                case 18:
                default:
                    fu.i((Activity) this);
                    break;
                case 4:
                    ud(this.i.getLongExtra("model_id", 0L));
                    break;
                case 5:
                    i(this.i.getLongExtra("model_id", 0L), "");
                    break;
                case 7:
                case 8:
                case 20:
                case 21:
                    fu();
                    break;
                case 9:
                    i iVar = gg;
                    if (iVar != null) {
                        iVar.i();
                    }
                    fu.i((Activity) this);
                    break;
                case 10:
                    fu(this.i.getLongExtra("app_info_id", 0L));
                    break;
                case 11:
                    ud(this.i.getStringExtra(k.p));
                    break;
                case 12:
                    w.i(this, this.i.getStringExtra(k.p), this.i.getLongExtra("model_id", 0L), this.i.getStringExtra("param"), this.i.getStringExtra("ext_json"));
                    fu.i((Activity) this);
                    break;
                case 13:
                    w.i(this, this.i.getStringExtra(k.p), this.i.getLongExtra("model_id", 0L), this.i.getStringExtra(BaseConstants.VIVO_MARKET_NEED_COMMENT));
                    fu.i((Activity) this);
                    break;
                case 14:
                    w.ud(this, this.i.getStringExtra(k.p), this.i.getLongExtra("model_id", 0L), this.i.getStringExtra("market_app_id"));
                    fu.i((Activity) this);
                    break;
                case 15:
                    w.i(this, this.i.getStringExtra(k.p), this.i.getLongExtra("model_id", 0L));
                    fu.i((Activity) this);
                    break;
                case 16:
                    w.ud(this, this.i.getStringExtra(k.p), this.i.getLongExtra("model_id", 0L));
                    fu.i((Activity) this);
                    break;
                case 19:
                    i(this.i.getLongExtra("model_id", 0L), this.i.getStringExtra("delete_button_text"));
                    break;
            }
            this.i = null;
        }
    }

    private void i(long j, String str) {
        if (rq.i() == null) {
            return;
        }
        com.ss.android.downloadad.api.i.ud gg2 = e.i().gg(j);
        if (gg2 != null) {
            DownloadInfo downloadInfo = Downloader.getInstance(qc.getContext()).getDownloadInfo(gg2.c());
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.putOpt("time_after_click", Long.valueOf(System.currentTimeMillis() - gg2.wp()));
                jSONObject.putOpt("click_download_size", Long.valueOf(gg2.lq()));
                if (downloadInfo != null) {
                    jSONObject.putOpt("download_length", Long.valueOf(downloadInfo.getCurBytes()));
                    jSONObject.putOpt("download_percent", Long.valueOf(downloadInfo.getCurBytes() / downloadInfo.getTotalBytes()));
                    jSONObject.putOpt("download_apk_size", Long.valueOf(downloadInfo.getTotalBytes()));
                    jSONObject.putOpt("download_current_bytes", Integer.valueOf((int) (downloadInfo.getCurBytes() / BaseConstants.MB_VALUE)));
                    jSONObject.putOpt("download_total_bytes", Integer.valueOf((int) (downloadInfo.getTotalBytes() / BaseConstants.MB_VALUE)));
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (!TextUtils.isEmpty(str)) {
                com.ss.android.downloadlib.gg.i.i().i("cancel_pause_reserve_wifi_dialog_show", jSONObject, gg2);
            } else {
                com.ss.android.downloadlib.gg.i.i().ud("pause_reserve_wifi_dialog_show", jSONObject, gg2);
            }
        }
        q.i i = new q.i(this).i(false).i(rq.i());
        if (!TextUtils.isEmpty(str)) {
            i.gg(str).i(rq.ud());
        }
        i.i().show();
        this.ud = true;
        this.fu = gg2;
    }

    private void i(String str) {
        try {
            if (TextUtils.isEmpty(str)) {
                return;
            }
            Uri parse = Uri.parse(str);
            Intent intent = new Intent("android.intent.action.VIEW");
            intent.setData(parse);
            intent.putExtra(AdBaseConstants.MARKET_OPEN_INTENT_OPEN_URL, str);
            intent.addFlags(268435456);
            if (com.ss.android.socialbase.downloader.ht.i.fu().i("fix_app_link_flag")) {
                intent.addFlags(67108864);
            }
            intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
            startActivity(intent);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            fu.i((Activity) this);
        }
    }
}