Video Downloader for FB v3.5.1版本的 MD5 值为:1db7d4aa9fc4356831f5521f52585a52

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


package com.appodeal.ads.a;

import android.content.Context;
import android.text.TextUtils;
import com.appodeal.ads.RestrictedData;
import com.appodeal.ads.bw;
import com.appodeal.ads.d;
import com.appodeal.ads.e;
import com.appodeal.ads.utils.Log;
import com.appodeal.ads.utils.LogConstants;
import com.appodeal.ads.utils.s;
import com.ironsource.eventsTracker.NativeEventsConstants;
import com.smaato.sdk.core.network.NetworkHttpRequest;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Locale;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONObject;

public class a implements d {

    private String f1512a;
    private String b;
    private volatile long c;

    public static class C0041a extends e {
        @Override
        public String a() {
            return "criteo";
        }

        @Override
        public d c() {
            return new a();
        }
    }

    public URL a(Context context, String str, RestrictedData restrictedData) throws Exception {
        return new URL(String.format(Locale.ENGLISH, "https://gum.criteo.com/appevent/v1/%s?gaid=%s&appId=%s&eventType=%s&limitedAdTracking=%d", this.f1512a, restrictedData.getIfa(), context.getPackageName(), str, Integer.valueOf(restrictedData.isLimitAdTrackingEnabled() ? 1 : 0)));
    }

    public JSONObject a(InputStream inputStream) {
        BufferedReader bufferedReader;
        try {
            StringBuilder sb = new StringBuilder(inputStream.available());
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
            while (true) {
                try {
                    try {
                        String readLine = bufferedReader.readLine();
                        if (readLine == null) {
                            break;
                        }
                        sb.append(readLine);
                        sb.append('\n');
                    } catch (Exception e) {
                        e = e;
                        Log.log(e);
                        bw.a(bufferedReader);
                        return null;
                    }
                } catch (Throwable th) {
                    th = th;
                    bw.a(bufferedReader);
                    throw th;
                }
            }
            if (sb.length() > 0) {
                sb.setLength(sb.length() - 1);
            }
            JSONObject jSONObject = new JSONObject(sb.toString());
            bw.a(bufferedReader);
            return jSONObject;
        } catch (Exception e2) {
            e = e2;
            bufferedReader = null;
        } catch (Throwable th2) {
            th = th2;
            bufferedReader = null;
            bw.a(bufferedReader);
            throw th;
        }
    }

    private boolean a() {
        return (TextUtils.isEmpty(this.f1512a) || TextUtils.isEmpty(this.b) || !((this.c > 0L ? 1 : (this.c == 0L ? 0 : -1)) == 0 || (System.currentTimeMillis() > this.c ? 1 : (System.currentTimeMillis() == this.c ? 0 : -1)) > 0)) ? false : true;
    }

    private void b(final Context context, final String str, final RestrictedData restrictedData) {
        if (a()) {
            s.f1761a.execute(new Runnable() {
                @Override
                public void run() {
                    HttpsURLConnection httpsURLConnection;
                    Closeable closeable;
                    Closeable closeable2 = null;
                    InputStream errorStream = null;
                    closeable2 = null;
                    HttpsURLConnection httpsURLConnection2 = null;
                    try {
                        httpsURLConnection = (HttpsURLConnection) a.this.a(context, str, restrictedData).openConnection();
                    } catch (Exception e) {
                        e = e;
                        closeable = null;
                    } catch (Throwable th) {
                        th = th;
                        httpsURLConnection = null;
                    }
                    try {
                        httpsURLConnection.setRequestMethod(NativeEventsConstants.HTTP_METHOD_GET);
                        httpsURLConnection.setRequestProperty(NetworkHttpRequest.Headers.KEY_USER_AGENT, a.this.b);
                        httpsURLConnection.setConnectTimeout(10000);
                        httpsURLConnection.setReadTimeout(10000);
                        int responseCode = httpsURLConnection.getResponseCode();
                        if (responseCode == 200) {
                            long j = 0;
                            errorStream = httpsURLConnection.getInputStream();
                            JSONObject a2 = a.this.a(errorStream);
                            if (a2 != null && a2.has("throttleSec")) {
                                j = System.currentTimeMillis() + (a2.getInt("throttleSec") * 1000);
                            }
                            a.this.c = j;
                        } else if (responseCode == 400) {
                            errorStream = httpsURLConnection.getErrorStream();
                            JSONObject a3 = a.this.a(errorStream);
                            if (a3 != null && a3.has("error")) {
                                Log.log(LogConstants.KEY_NETWORK, "Error", String.format(Locale.ENGLISH, "%s - %s", "Criteo", a3.getString("error")));
                            }
                        }
                        if (httpsURLConnection != null) {
                            try {
                                httpsURLConnection.disconnect();
                            } catch (Exception e2) {
                                Log.log(e2);
                            }
                        }
                        bw.a((Closeable) errorStream);
                    } catch (Exception e3) {
                        e = e3;
                        closeable = null;
                        httpsURLConnection2 = httpsURLConnection;
                        try {
                            Log.log(e);
                            if (httpsURLConnection2 != null) {
                                try {
                                    httpsURLConnection2.disconnect();
                                } catch (Exception e4) {
                                    Log.log(e4);
                                }
                            }
                            bw.a(closeable);
                        } catch (Throwable th2) {
                            th = th2;
                            httpsURLConnection = httpsURLConnection2;
                            closeable2 = closeable;
                            if (httpsURLConnection != null) {
                                try {
                                    httpsURLConnection.disconnect();
                                } catch (Exception e5) {
                                    Log.log(e5);
                                }
                            }
                            bw.a(closeable2);
                            throw th;
                        }
                    } catch (Throwable th3) {
                        th = th3;
                        if (httpsURLConnection != null) {
                        }
                        bw.a(closeable2);
                        throw th;
                    }
                }
            });
        }
    }

    @Override
    public void a(Context context, RestrictedData restrictedData) {
        b(context, "Active", restrictedData);
    }

    @Override
    public void a(Context context, JSONObject jSONObject, RestrictedData restrictedData) {
        try {
            this.f1512a = jSONObject.getString("sender_id");
            this.b = restrictedData.getHttpAgent(context);
        } catch (Exception e) {
            Log.log(e);
        }
        b(context, "Launch", restrictedData);
    }

    @Override
    public void b(Context context, RestrictedData restrictedData) {
        b(context, "Inactive", restrictedData);
    }
}