Wolves Themes v1.0版本的 MD5 值为:cddc92b47f6b7c4a195c9625507eb51c

以下内容为反编译后的 ak.java 源代码,内容仅作参考


package com.chartboost.sdk.impl;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Handler;
import com.chartboost.sdk.Libraries.CBLogging;
import com.chartboost.sdk.Model.CBError;
import com.google.android.gms.common.util.CrashUtils;
import com.mopub.common.Constants;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.concurrent.Executor;
public class ak {
    final ai a;
    final Handler b;
    private final Executor c;
    private final ah d;

    public ak(Executor executor, ah ahVar, ai aiVar, Handler handler) {
        this.c = executor;
        this.d = ahVar;
        this.a = aiVar;
        this.b = handler;
    }

    public void a(com.chartboost.sdk.Model.c cVar, boolean z, String str, CBError.CBClickError cBClickError, aj ajVar) {
        if (cVar != null) {
            cVar.x = false;
            if (cVar.b()) {
                cVar.l = 4;
            }
        }
        if (!z) {
            if (com.chartboost.sdk.i.c != null) {
                com.chartboost.sdk.i.c.didFailToRecordClick(str, cBClickError);
            }
        } else if (cVar != null && cVar.w != null) {
            this.d.a(cVar.w);
        } else if (ajVar != null) {
            this.d.a(ajVar);
        }
    }

    public void a(final com.chartboost.sdk.Model.c cVar, final String str, final Activity activity, final aj ajVar) {
        try {
            String scheme = new URI(str).getScheme();
            if (scheme == null) {
                a(cVar, false, str, CBError.CBClickError.URI_INVALID, ajVar);
            } else if (!scheme.equals(Constants.HTTP) && !scheme.equals(Constants.HTTPS)) {
                a(cVar, str, (Context) activity, ajVar);
            } else {
                this.c.execute(new Runnable() {
                    @Override
                    public void run() {
                        HttpURLConnection httpURLConnection;
                        Exception e;
                        try {
                            String str2 = str;
                            if (ak.this.a.b()) {
                                HttpURLConnection httpURLConnection2 = null;
                                try {
                                    try {
                                        httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
                                        try {
                                            httpURLConnection.setInstanceFollowRedirects(false);
                                            httpURLConnection.setConnectTimeout(10000);
                                            httpURLConnection.setReadTimeout(10000);
                                            String headerField = httpURLConnection.getHeaderField("Location");
                                            if (headerField != null) {
                                                str2 = headerField;
                                            }
                                        } catch (Exception e2) {
                                            e = e2;
                                            CBLogging.b("CBURLOpener", "Exception raised while opening a HTTP Conection", e);
                                        }
                                    } catch (Throwable th) {
                                        th = th;
                                        if (0 != 0) {
                                            httpURLConnection2.disconnect();
                                        }
                                        throw th;
                                    }
                                } catch (Exception e3) {
                                    httpURLConnection = null;
                                    e = e3;
                                } catch (Throwable th2) {
                                    th = th2;
                                    if (0 != 0) {
                                    }
                                    throw th;
                                }
                            }
                            a(str2);
                        } catch (Exception e4) {
                            com.chartboost.sdk.Tracking.a.a(ak.class, "open followTask", e4);
                        }
                    }

                    private void a(final String str2) {
                        Runnable runnable = new Runnable() {
                            @Override
                            public void run() {
                                try {
                                    ak.this.a(cVar, str2, (Context) activity, ajVar);
                                } catch (Exception e) {
                                    com.chartboost.sdk.Tracking.a.a(ak.class, "open openOnUiThread Runnable.run", e);
                                }
                            }
                        };
                        if (activity != null) {
                            activity.runOnUiThread(runnable);
                        } else {
                            ak.this.b.post(runnable);
                        }
                    }
                });
            }
        } catch (URISyntaxException unused) {
            a(cVar, false, str, CBError.CBClickError.URI_INVALID, ajVar);
        }
    }

    void a(com.chartboost.sdk.Model.c cVar, String str, Context context, aj ajVar) {
        String str2;
        Exception e;
        String str3;
        if (cVar != null && cVar.b()) {
            cVar.l = 5;
        }
        if (context == null) {
            context = com.chartboost.sdk.i.m;
        }
        if (context == null) {
            a(cVar, false, str, CBError.CBClickError.NO_HOST_ACTIVITY, ajVar);
            return;
        }
        try {
            Intent intent = new Intent("android.intent.action.VIEW");
            if (!(context instanceof Activity)) {
                intent.addFlags(CrashUtils.ErrorDialogData.BINDER_CRASH);
            }
            intent.setData(Uri.parse(str));
            context.startActivity(intent);
        } catch (Exception unused) {
            if (str.startsWith("market://")) {
                try {
                    String str4 = "http://market.android.com/" + str.substring(9);
                    try {
                        Intent intent2 = new Intent("android.intent.action.VIEW");
                        if (!(context instanceof Activity)) {
                            intent2.addFlags(CrashUtils.ErrorDialogData.BINDER_CRASH);
                        }
                        intent2.setData(Uri.parse(str4));
                        context.startActivity(intent2);
                        str3 = str4;
                    } catch (Exception e2) {
                        e = e2;
                        str2 = str4;
                        CBLogging.b("CBURLOpener", "Exception raised openeing an inavld playstore URL", e);
                        a(cVar, false, str2, CBError.CBClickError.URI_UNRECOGNIZED, ajVar);
                        return;
                    }
                } catch (Exception e3) {
                    str2 = str;
                    e = e3;
                }
            } else {
                a(cVar, false, str, CBError.CBClickError.URI_UNRECOGNIZED, ajVar);
            }
        }
        str3 = str;
        a(cVar, true, str3, null, ajVar);
    }

    public boolean a(String str) {
        try {
            Context context = com.chartboost.sdk.i.m;
            Intent intent = new Intent("android.intent.action.VIEW");
            if (!(context instanceof Activity)) {
                intent.addFlags(CrashUtils.ErrorDialogData.BINDER_CRASH);
            }
            intent.setData(Uri.parse(str));
            return context.getPackageManager().queryIntentActivities(intent, 65536).size() > 0;
        } catch (Exception e) {
            CBLogging.b("CBURLOpener", "Cannot open URL", e);
            com.chartboost.sdk.Tracking.a.a(ak.class, "canOpenURL", e);
            return false;
        }
    }

    public void a(com.chartboost.sdk.Model.c cVar, String str, aj ajVar) {
        a(cVar, str, cVar != null ? cVar.g.a() : null, ajVar);
    }
}