VegeFruits v7.1版本的 MD5 值为:2ff167dfba698c783e879938fe00b9ce

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


package com.appodeal.ads.networks;

import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.support.annotation.VisibleForTesting;
import com.appodeal.ads.Appodeal;
import com.appodeal.ads.UserSettings;
import com.appodeal.ads.az;
import com.mopub.common.GpsHelper;
import com.tapjoy.TapjoyConstants;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Locale;

public class u implements Runnable {

    @VisibleForTesting
    String a;
    private final a b;
    private final int c;
    private final int d;
    private final Handler e;
    private final int f = 0;
    private final int g = 1;

    public interface a {
        void a(int i, int i2);

        void a(String str, int i, int i2);
    }

    public u(Activity activity, a aVar, int i, int i2, String str, String str2, int i3) {
        String str3;
        this.b = aVar;
        this.c = i;
        this.d = i2;
        String packageName = activity.getPackageName();
        Uri.Builder buildUpon = Uri.parse("https://api.pubnative.net/api/v3/native").buildUpon();
        buildUpon.appendQueryParameter("apptoken", str).appendQueryParameter("zoneid", str2).appendQueryParameter("bundleid", packageName).appendQueryParameter("os", TapjoyConstants.TJC_DEVICE_PLATFORM_TYPE).appendQueryParameter("osver", Build.VERSION.RELEASE).appendQueryParameter("srvi", "1").appendQueryParameter("af", "title,description,icon,banner,cta,rating").appendQueryParameter("al", "m").appendQueryParameter("mf", "contentinfo").appendQueryParameter("locale", Locale.getDefault().getLanguage()).appendQueryParameter("adcount", String.valueOf(i3)).appendQueryParameter("ua", System.getProperty("http.agent")).appendQueryParameter("coppa", com.appodeal.ads.f.h ? "1" : "0");
        if (!com.appodeal.ads.f.h) {
            buildUpon.appendQueryParameter("devicemodel", Build.MODEL);
        }
        String w = az.w(activity);
        if (w == null || Integer.valueOf(w).intValue() == 1) {
            buildUpon.appendQueryParameter("dnt", "0");
        } else {
            buildUpon.appendQueryParameter("dnt", "1");
        }
        String string = activity.getSharedPreferences("appodeal", 0).getString(GpsHelper.ADVERTISING_ID_KEY, null);
        buildUpon.appendQueryParameter("gid", string == null ? az.l(activity) : string);
        if (!com.appodeal.ads.f.h) {
            Location e = az.e((Context) activity);
            if (e != null) {
                buildUpon.appendQueryParameter("lat", String.valueOf(e.getLatitude()));
                buildUpon.appendQueryParameter("long", String.valueOf(e.getLongitude()));
            } else {
                UserSettings u = az.u(activity);
                if (u.g() != null) {
                    buildUpon.appendQueryParameter("lat", String.valueOf(u.g()));
                }
                if (u.h() != null) {
                    buildUpon.appendQueryParameter("long", String.valueOf(u.h()));
                }
            }
            UserSettings u2 = az.u(activity);
            UserSettings.Gender gender = u2.getGender();
            if (gender != null) {
                switch (gender.getValue()) {
                    case 1:
                        str3 = "f";
                        break;
                    case 2:
                        str3 = "m";
                        break;
                    default:
                        str3 = null;
                        break;
                }
                if (str3 != null) {
                    buildUpon.appendQueryParameter("gender", str3);
                }
            }
            Integer age = u2.getAge();
            if (age != null) {
                buildUpon.appendQueryParameter("age", String.valueOf(age));
            }
            String b = u2.b();
            if (b != null) {
                buildUpon.appendQueryParameter("keywords", b);
            }
            String c = u2.c();
            if (c != null) {
                buildUpon.appendQueryParameter("ip", c);
            }
        }
        this.a = buildUpon.build().toString();
        this.e = new Handler(Looper.getMainLooper()) {
            @Override
            public void handleMessage(Message message) {
                if (u.this.b != null) {
                    switch (message.what) {
                        case 0:
                            u.this.b.a(u.this.c, u.this.d);
                            return;
                        case 1:
                            String str4 = (String) message.obj;
                            if (str4 == null) {
                                u.this.b.a(u.this.c, u.this.d);
                                return;
                            } else {
                                u.this.b.a(str4, u.this.c, u.this.d);
                                return;
                            }
                        default:
                            return;
                    }
                }
            }
        };
    }

    public void a() {
        com.appodeal.ads.utils.r.a.execute(this);
    }

    @Override
    public void run() {
        HttpURLConnection httpURLConnection;
        HttpURLConnection httpURLConnection2 = null;
        httpURLConnection2 = null;
        try {
            try {
                httpURLConnection = (HttpURLConnection) new URL(this.a).openConnection();
            } catch (Throwable th) {
                th = th;
            }
        } catch (Exception e) {
            e = e;
        }
        try {
            httpURLConnection.setConnectTimeout(20000);
            httpURLConnection.setReadTimeout(20000);
            httpURLConnection.setRequestProperty("User-Agent", System.getProperty("http.agent"));
            String a2 = az.a(httpURLConnection.getInputStream());
            if (a2 == null || a2.isEmpty() || a2.equals(" ")) {
                Handler handler = this.e;
                handler.sendEmptyMessage(0);
                httpURLConnection2 = handler;
            } else {
                Message obtainMessage = this.e.obtainMessage(1, a2);
                this.e.sendMessage(obtainMessage);
                httpURLConnection2 = obtainMessage;
            }
            if (httpURLConnection != null) {
                httpURLConnection.disconnect();
            }
        } catch (Exception e2) {
            httpURLConnection2 = httpURLConnection;
            e = e2;
            Appodeal.a(e);
            this.e.sendEmptyMessage(0);
            if (httpURLConnection2 != null) {
                httpURLConnection2.disconnect();
            }
        } catch (Throwable th2) {
            httpURLConnection2 = httpURLConnection;
            th = th2;
            if (httpURLConnection2 != null) {
                httpURLConnection2.disconnect();
            }
            throw th;
        }
    }
}