13Poker by gametower unlimited gems v0.4版本的 MD5 值为:51324fc0f195c34821074948ab266846

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


package com.arywlxuccphewsou;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.graphics.Rect;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.view.Window;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.json.JSONObject;
public class AdRequest {
    private JSONObject f25a;
    private int c;
    private int d;
    private TelephonyManager e;
    private String f;
    private boolean g;
    private boolean h;
    private boolean i;
    private String j;
    private String k;
    private String l;
    private List m;
    private Context o;
    private Activity p;
    private boolean b = false;
    private boolean n = false;

    public AdRequest(Context context, String str, String str2) {
        this.g = false;
        this.h = false;
        this.i = false;
        if (context instanceof Activity) {
            this.p = (Activity) context;
        } else {
            this.o = context;
        }
        this.j = str;
        this.g = str2.equals("audio");
        this.h = str2.equals("reengagement");
        this.i = str2.equals("reengagement_alarm");
    }

    private String a(Context context, SharedPreferences sharedPreferences) {
        String str;
        String str2;
        if (this.g) {
            AudioManager audioManager = (AudioManager) context.getSystemService("audio");
            str = "&level=" + (Math.round((audioManager.getStreamVolume(3) / audioManager.getStreamMaxVolume(3)) * 100.0d) / 100.0d);
            if (sharedPreferences.getBoolean("SD_IS_AUDIOTRACK_" + this.j, false)) {
                str = str + "&audio_counter=" + sharedPreferences.getInt("SD_ITERATION_COUNTER_AUDIO_" + this.j, 0);
            }
        } else {
            str = "";
        }
        if (this.h || this.i) {
            String str3 = "standard,";
            int i = -1;
            try {
                Class<?> cls = Class.forName(context.getPackageName() + ".R$layout");
                i = cls.getField("reengagement").getInt(cls);
            } catch (Exception e) {
            }
            if (i != -1) {
                try {
                    Class<?> cls2 = Class.forName(context.getPackageName() + ".R$id");
                    int i2 = cls2.getField("appimgview").getInt(cls2);
                    int i3 = cls2.getField("appimg").getInt(cls2);
                    int i4 = cls2.getField("appimgtext").getInt(cls2);
                    if (i2 != -1 && i3 != -1 && i4 != -1) {
                        str3 = "standard,banner,";
                    }
                } catch (Exception e2) {
                }
                try {
                    Class<?> cls3 = Class.forName(context.getPackageName() + ".R$id");
                    int i5 = cls3.getField("appcustomview").getInt(cls3);
                    int i6 = cls3.getField("appcustomtitle").getInt(cls3);
                    int i7 = cls3.getField("appcustomdescription").getInt(cls3);
                    int i8 = cls3.getField("appcustomsmalltext").getInt(cls3);
                    int i9 = cls3.getField("appcustomcta").getInt(cls3);
                    if (i5 != -1 && i6 != -1 && i7 != -1 && i8 != -1 && i9 != -1) {
                        str3 = str3 + "customtext,";
                    }
                } catch (Exception e3) {
                }
            }
            String str4 = str + "&reengagement_supported=" + str3.substring(0, str3.length() - 1);
            String str5 = "";
            try {
                PackageManager packageManager = context.getPackageManager();
                ActivityInfo[] activityInfoArr = packageManager.getPackageInfo(context.getPackageName(), 1).activities;
                if ((activityInfoArr != null ? activityInfoArr.length : 0) > 0) {
                    str5 = ",custom";
                    Intent intent = new Intent("android.intent.action.MAIN", (Uri) null);
                    intent.addCategory("android.intent.category.LAUNCHER");
                    intent.setPackage(context.getPackageName());
                    if (packageManager.queryIntentActivities(intent, 0).size() > 0) {
                        str5 = str5 + ",default";
                    }
                    for (ActivityInfo activityInfo : activityInfoArr) {
                        if (activityInfo.name.equals("com.arywlxuccphewsou.ReEngagementActivity")) {
                            str5 = str5 + ",server";
                            break;
                        }
                        continue;
                    }
                }
            } catch (Exception e4) {
            }
            if (str5.equals("")) {
                str2 = str4;
            } else {
                if (str5.startsWith(",")) {
                    str5 = str5.substring(1);
                }
                str2 = str4 + "&reengagement_customsupport=" + str5;
            }
            str = str2 + "&iteration_counter=" + sharedPreferences.getInt("SD_ITERATION_COUNTER_" + this.j, 0);
        }
        if (this.h) {
            str = str + "&launch_type=App";
        }
        return this.i ? str + "&launch_type=Alarm" : str;
    }

    public JSONObject makeLBRequest() {
        boolean z;
        HttpResponse execute;
        if (this.b) {
            return null;
        }
        this.b = true;
        Context context = this.p != null ? this.p : this.o;
        SharedPreferences sharedPreferences = context.getSharedPreferences("Preference", 0);
        if (this.p != null) {
            DisplayMetrics displayMetrics = new DisplayMetrics();
            this.p.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
            Rect rect = new Rect();
            Window window = this.p.getWindow();
            window.getDecorView().getWindowVisibleDisplayFrame(rect);
            int i = rect.top;
            int top = window.findViewById(16908290).getTop();
            int i2 = top > i ? top - i : 0;
            this.c = displayMetrics.widthPixels;
            this.k = this.j;
            String string = sharedPreferences.getString("sectionidXLrg", null);
            String string2 = sharedPreferences.getString("sectionidLrg", null);
            String string3 = sharedPreferences.getString("sectionidMed", null);
            if (this.c > 720) {
                if (string != null && !string.equals("")) {
                    this.k = string;
                } else if (string2 != null && !string2.equals("")) {
                    this.k = string2;
                } else if (string3 != null && !string3.equals("")) {
                    this.k = string3;
                }
            } else if (this.c > 480) {
                if (string2 != null && !string2.equals("")) {
                    this.k = string2;
                } else if (string3 != null && !string3.equals("")) {
                    this.k = string3;
                }
            } else if (this.c > 320 && string3 != null && !string3.equals("")) {
                this.k = string3;
            }
            AdLog.d(AdController.LB_LOG, "SectionIdToUse =" + this.k);
            this.d = (displayMetrics.heightPixels - i) - i2;
            AdLog.d(AdController.LB_LOG, "Device Width = " + this.c + ", Height = " + this.d);
            AdLog.d(AdController.LB_LOG, "SBH = " + i + ", TBH = " + i2);
        }
        BasicHttpParams basicHttpParams = new BasicHttpParams();
        basicHttpParams.setParameter("http.protocol.version", HttpVersion.HTTP_1_1);
        DefaultHttpClient defaultHttpClient = new DefaultHttpClient(basicHttpParams);
        HttpConnectionParams.setConnectionTimeout(basicHttpParams, 5000);
        HttpConnectionParams.setSoTimeout(basicHttpParams, 3000);
        if (this.p != null) {
            this.e = (TelephonyManager) this.p.getBaseContext().getSystemService("phone");
        } else {
            this.e = (TelephonyManager) this.o.getSystemService("phone");
        }
        String[] strArr = {"http://ad.leadboltapps.net", "http://ad.leadbolt.net"};
        if (Build.VERSION.SDK_INT >= 17) {
            System.setProperty("http.keepAlive", "false");
        }
        if (this.k == null) {
            this.k = this.j;
        }
        String trim = AdEncryption.encrypt(("&section_id=" + this.k + "&appId=null&optin=" + sharedPreferences.getString("SD_APP_OPTIN", "0") + a(context, sharedPreferences)).trim()).trim();
        ArrayList arrayList = new ArrayList(2);
        arrayList.add(new BasicNameValuePair("ref", AdRefValues.adRefValues(context, this.e, this.l, this.m, this.n, this.c, this.d)));
        int i3 = 0;
        boolean z2 = false;
        while (i3 < strArr.length && !z2) {
            this.f = strArr[i3];
            String str = this.f + "/show_app.conf?";
            if (this.g) {
                str = this.f + "/show_app_audio?";
            }
            if (this.h || this.i) {
                str = this.f + "/show_reengagement?";
            }
            HttpPost httpPost = new HttpPost(str + "&get=" + trim + "&section_id=" + this.k);
            try {
                httpPost.setEntity(new UrlEncodedFormEntity(arrayList));
            } catch (Exception e) {
                AdLog.printStackTrace(AdController.LB_LOG, e);
            }
            int i4 = 0;
            while (true) {
                if (i4 >= 10) {
                    z = z2;
                    break;
                }
                try {
                    try {
                        try {
                            execute = defaultHttpClient.execute(httpPost);
                        } catch (ConnectTimeoutException e2) {
                            AdLog.e(AdController.LB_LOG, "Connection Timed out - " + e2.getMessage());
                            this.f25a = new JSONObject();
                            this.b = false;
                            z2 = false;
                        }
                    } catch (Exception e3) {
                        AdLog.e(AdController.LB_LOG, "Issue with connection - " + e3.getMessage());
                        AdLog.printStackTrace(AdController.LB_LOG, e3);
                        this.f25a = new JSONObject();
                        this.b = false;
                        z2 = false;
                    }
                    if (execute.getStatusLine().getStatusCode() == 200) {
                        HttpEntity entity = execute.getEntity();
                        if (entity != null) {
                            InputStream content = entity.getContent();
                            this.f25a = new JSONObject(AdUtils.convertStreamToString(content));
                            content.close();
                        }
                        this.b = false;
                        z = true;
                    } else {
                        i4++;
                    }
                } finally {
                    this.b = false;
                }
            }
            if (z) {
                break;
            }
            i3++;
            z2 = z;
        }
        return this.f25a;
    }

    public void setSubId(String str) {
        this.l = str;
    }

    public void setTokens(List list) {
        this.m = list;
    }

    public void setUseLocation(boolean z) {
        this.n = z;
        AdLog.i(AdController.LB_LOG, "setUseLocation: " + z);
    }
}