翰林优商.apk(点击下载) / n.java


package com.mbridge.msdk.foundation.tools;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.entity.l;
import com.mbridge.msdk.foundation.same.net.f.d;
import com.mbridge.msdk.foundation.same.report.e;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;

public final class n {
    private static volatile String d;
    private CopyOnWriteArrayList<CampaignEx> a;
    private volatile b b;
    private final AtomicBoolean c;
    private volatile Boolean e;
    private CampaignEx f;
    private int g;
    private Context h;

    public static final class a {
        private static final n a = new n();
    }

    private n() {
        this.g = 0;
        this.a = new CopyOnWriteArrayList<>();
        this.c = new AtomicBoolean(false);
    }

    public static n a() {
        return a.a;
    }

    public final void a(CampaignEx campaignEx) {
        try {
            if (this.e != null && campaignEx != null && this.e.booleanValue()) {
                this.f = campaignEx;
                this.a.add(campaignEx);
            }
        } catch (Exception e2) {
            w.d("MIMManager", e2.getMessage());
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:16:0x0073, code lost:
        if (r6.contains(r2 + "=3") != false) goto L_0x0077;
     */
    public final boolean a(String str) {
        boolean z = true;
        this.e = true;
        try {
            if (TextUtils.isEmpty(str) || this.e == null || !this.e.booleanValue()) {
                return false;
            }
            try {
                String trim = str.trim();
                if (trim.startsWith(r.b("YkQwD+z8H+N1WBK3H+xtLkeAyM=="))) {
                    String b2 = r.b("H75TDkQsVbxPY7V=");
                    if (!trim.contains(b2 + "=1")) {
                        if (!trim.contains(b2 + "=2")) {
                        }
                    }
                    return z;
                }
                z = false;
                return z;
            } catch (Exception unused) {
                return false;
            }
        } catch (Exception e2) {
            w.d("MIMManager", e2.getMessage());
            return false;
        }
    }

    public final void b(CampaignEx campaignEx) {
        try {
            if (this.e != null && campaignEx != null && this.e.booleanValue()) {
                this.f = null;
                try {
                    this.a.remove(campaignEx);
                } catch (Exception e2) {
                    w.a("MIMManager", e2.getMessage());
                }
            }
        } catch (Exception e3) {
            w.d("MIMManager", e3.getMessage());
        }
    }

    public final CampaignEx b() {
        return this.f;
    }

    public final void c() {
        this.g++;
    }

    public final void d() {
        int i = this.g - 1;
        this.g = i;
        if (i <= 0) {
            Context context = this.h;
            if (this.b != null && context != null) {
                try {
                    context.unregisterReceiver(this.b);
                } catch (Exception e2) {
                    w.a("MIMManager", e2.getMessage());
                } catch (Throwable th) {
                    this.f = null;
                    this.a.clear();
                    this.a = null;
                    this.b = null;
                    this.h = null;
                    throw th;
                }
                this.f = null;
                this.a.clear();
                this.a = null;
                this.b = null;
                this.h = null;
            }
        }
    }

    public final void a(final Context context) {
        this.h = context;
        com.mbridge.msdk.foundation.same.f.b.a().execute(new Runnable() {
            /* class com.mbridge.msdk.foundation.tools.n.AnonymousClass1 */

            public final void run() {
                if (n.this.c.compareAndSet(false, true)) {
                    try {
                        n nVar = n.this;
                        nVar.e = nVar.g();
                    } catch (Exception e) {
                        w.a("MIMManager", e.getMessage());
                    }
                    if (n.this.e != null && n.this.e.booleanValue() && context != null) {
                        try {
                            n.this.b = new b();
                            IntentFilter intentFilter = new IntentFilter();
                            intentFilter.addAction(r.b("DFKwWgtuDkKwLZPwD+z8H+N/xj26Vjcdx5KyVj5GxVN="));
                            intentFilter.addAction(r.b("DFKwWgtuDkKwLZPwD+z8H+N/xj26Vjcdx5KanjKnxVN="));
                            intentFilter.addAction(r.b("DFKwWgtuDkKwLZPwD+z8H+N/xjQZxVfV+T2SZVe6V2xS5c5n"));
                            context.registerReceiver(n.this.b, intentFilter);
                        } catch (Exception e2) {
                            w.a("MIMManager", e2.getMessage());
                        }
                    }
                }
            }
        });
    }

    public final Boolean e() {
        return this.e;
    }

    private Boolean g() {
        Cursor cursor;
        Context j = com.mbridge.msdk.foundation.controller.a.f().j();
        Boolean bool = null;
        if (j != null) {
            try {
                if (j.getContentResolver() != null) {
                    try {
                        cursor = j.getContentResolver().query(Uri.parse(r.b("DFK/J75/JaEXWFfXYZP9LkcXYk3/YkcBLF5TWgSBYbHuH75BW3xuhr5UJj2tLkeNhrKFLkxQhl==")), null, null, null, null);
                    } catch (Exception unused) {
                        cursor = null;
                    }
                    if (cursor != null) {
                        while (cursor.moveToNext()) {
                            try {
                                String string = cursor.getString(cursor.getColumnIndex("support"));
                                if (!TextUtils.isEmpty(string) && !string.equalsIgnoreCase("null") && (string.equalsIgnoreCase("false") || string.equalsIgnoreCase("true"))) {
                                    bool = Boolean.valueOf(Boolean.parseBoolean(string));
                                }
                            } catch (Exception e2) {
                                w.a("MIMManager", e2.getMessage());
                            }
                            try {
                                d = cursor.getString(cursor.getColumnIndex("detailStyle"));
                            } catch (Exception e3) {
                                w.a("MIMManager", e3.getMessage());
                            }
                        }
                        try {
                            cursor.close();
                        } catch (Exception e4) {
                            w.a("MIMManager", e4.getMessage());
                        }
                    }
                }
            } catch (Exception e5) {
                w.d("MIMManager", e5.getMessage());
            }
        }
        return bool;
    }

    public final String f() {
        try {
            if (d == null) {
                return "";
            }
            return String.format("[%s]", d);
        } catch (Exception unused) {
            return "";
        }
    }

    public static class b extends BroadcastReceiver {
        private b() {
        }

        /* JADX WARNING: Removed duplicated region for block: B:33:0x0083 A[Catch:{ Exception -> 0x00a8 }] */
        public final void onReceive(Context context, Intent intent) {
            Runnable runnable;
            Runnable runnable2;
            String action = intent.getAction();
            if (!TextUtils.isEmpty(action) && !action.equals(r.b("DFKwWgtuDkKwLZPwD+z8H+N/xj26Vjcdx5KyVj5GxVN=")) && !action.equals(r.b("DFKwWgtuDkKwLZPwD+z8H+N/xj26Vjcdx5KanjKnxVN=")) && action.equals(r.b("DFKwWgtuDkKwLZPwD+z8H+N/xjQZxVfV+T2SZVe6V2xS5c5n"))) {
                try {
                    Bundle extras = intent.getExtras();
                    if (extras != null) {
                        int i = extras.getInt("statusCode", -1);
                        String string = extras.getString("packageName", "");
                        if (i == -1) {
                            return;
                        }
                        if (!TextUtils.isEmpty(string)) {
                            CampaignEx b = a.a.b((n) string);
                            if (b != null) {
                                n nVar = a.a;
                                if (i == 3001) {
                                    runnable2 = new Runnable(context, b) {
                                        /* class com.mbridge.msdk.foundation.tools.n.AnonymousClass4 */
                                        final /* synthetic */ Context a;
                                        final /* synthetic */ CampaignEx b;

                                        {
                                            this.a = r2;
                                            this.b = r3;
                                        }

                                        public final void run() {
                                            String[] p;
                                            try {
                                                Context context = this.a;
                                                CampaignEx campaignEx = this.b;
                                                if (campaignEx != null) {
                                                    try {
                                                        l nativeVideoTracking = campaignEx.getNativeVideoTracking();
                                                        if (!(nativeVideoTracking == null || (p = nativeVideoTracking.p()) == null)) {
                                                            for (String str : p) {
                                                                com.mbridge.msdk.click.b.a(context, campaignEx, campaignEx.getCampaignUnitId(), str, false, false);
                                                            }
                                                        }
                                                    } catch (Exception e) {
                                                        w.d("MIMManager", e.getMessage());
                                                    }
                                                }
                                            } catch (Exception e2) {
                                                w.d("MIMManager", e2.getMessage());
                                            }
                                        }
                                    };
                                } else if (i == 3002) {
                                    runnable2 = new Runnable(context, b) {
                                        /* class com.mbridge.msdk.foundation.tools.n.AnonymousClass3 */
                                        final /* synthetic */ Context a;
                                        final /* synthetic */ CampaignEx b;

                                        {
                                            this.a = r2;
                                            this.b = r3;
                                        }

                                        public final void run() {
                                            String[] q;
                                            try {
                                                Context context = this.a;
                                                CampaignEx campaignEx = this.b;
                                                if (campaignEx != null) {
                                                    try {
                                                        l nativeVideoTracking = campaignEx.getNativeVideoTracking();
                                                        if (!(nativeVideoTracking == null || (q = nativeVideoTracking.q()) == null)) {
                                                            for (String str : q) {
                                                                com.mbridge.msdk.click.b.a(context, campaignEx, campaignEx.getCampaignUnitId(), str, false, false);
                                                            }
                                                        }
                                                    } catch (Exception e) {
                                                        w.d("MIMManager", e.getMessage());
                                                    }
                                                }
                                            } catch (Exception e2) {
                                                w.d("MIMManager", e2.getMessage());
                                            }
                                        }
                                    };
                                } else if (i != 3008) {
                                    runnable = null;
                                    if (runnable != null) {
                                        com.mbridge.msdk.foundation.same.f.b.a().execute(runnable);
                                    }
                                    com.mbridge.msdk.foundation.same.f.b.a().execute(new Runnable(context, "dm_page_status", a.a.b(), i) {
                                        /* class com.mbridge.msdk.foundation.tools.n.AnonymousClass5 */
                                        final /* synthetic */ Context a;
                                        final /* synthetic */ String b;
                                        final /* synthetic */ CampaignEx c;
                                        final /* synthetic */ int d;

                                        {
                                            this.a = r2;
                                            this.b = r3;
                                            this.c = r4;
                                            this.d = r5;
                                        }

                                        public final void run() {
                                            try {
                                                if (this.a != null && !TextUtils.isEmpty(this.b) && this.c != null) {
                                                    StringBuffer stringBuffer = new StringBuffer();
                                                    stringBuffer.append("key=2000100&");
                                                    stringBuffer.append("network_type=");
                                                    stringBuffer.append(s.D(this.a));
                                                    stringBuffer.append("&");
                                                    if (!TextUtils.isEmpty(this.c.getRequestIdNotice())) {
                                                        stringBuffer.append("rid_n=");
                                                        stringBuffer.append(this.c.getRequestIdNotice());
                                                        stringBuffer.append("&");
                                                    }
                                                    if (!TextUtils.isEmpty(this.c.getRequestId())) {
                                                        stringBuffer.append("rid=");
                                                        stringBuffer.append(this.c.getRequestId());
                                                        stringBuffer.append("&");
                                                    }
                                                    if (!TextUtils.isEmpty(this.c.getCampaignUnitId())) {
                                                        stringBuffer.append("unit_id=");
                                                        stringBuffer.append(this.c.getCampaignUnitId());
                                                        stringBuffer.append("&");
                                                        String str = com.mbridge.msdk.foundation.controller.a.b.get(this.c.getCampaignUnitId());
                                                        StringBuilder sb = new StringBuilder();
                                                        sb.append("u_stid=");
                                                        if (str == null) {
                                                            str = "";
                                                        }
                                                        sb.append(str);
                                                        sb.append("&");
                                                        stringBuffer.append(sb.toString());
                                                    }
                                                    if (!TextUtils.isEmpty(this.c.getId())) {
                                                        stringBuffer.append("cid=");
                                                        stringBuffer.append(this.c.getId());
                                                        stringBuffer.append("&");
                                                    }
                                                    stringBuffer.append("status=");
                                                    stringBuffer.append(this.b);
                                                    stringBuffer.append("&");
                                                    stringBuffer.append("code=");
                                                    stringBuffer.append(this.d);
                                                    if (com.mbridge.msdk.foundation.same.report.b.a().c()) {
                                                        com.mbridge.msdk.foundation.same.report.b.a().a(stringBuffer.toString());
                                                        return;
                                                    }
                                                    try {
                                                        new com.mbridge.msdk.foundation.same.report.d.a(this.a).c(0, d.a().a, e.a(stringBuffer.toString(), this.a), null);
                                                    } catch (Exception e2) {
                                                        e2.printStackTrace();
                                                        w.d("MIMManager", e2.getMessage());
                                                    }
                                                }
                                            } catch (Throwable th) {
                                                w.d("MIMManager", th.getMessage());
                                            }
                                        }
                                    });
                                } else {
                                    runnable2 = new Runnable(context, b) {
                                        /* class com.mbridge.msdk.foundation.tools.n.AnonymousClass2 */
                                        final /* synthetic */ Context a;
                                        final /* synthetic */ CampaignEx b;

                                        {
                                            this.a = r2;
                                            this.b = r3;
                                        }

                                        public final void run() {
                                            String[] r;
                                            try {
                                                Context context = this.a;
                                                CampaignEx campaignEx = this.b;
                                                if (campaignEx != null) {
                                                    try {
                                                        l nativeVideoTracking = campaignEx.getNativeVideoTracking();
                                                        if (!(nativeVideoTracking == null || (r = nativeVideoTracking.r()) == null)) {
                                                            for (String str : r) {
                                                                com.mbridge.msdk.click.b.a(context, campaignEx, campaignEx.getCampaignUnitId(), str, false, false);
                                                            }
                                                        }
                                                    } catch (Exception e) {
                                                        w.d("MIMManager", e.getMessage());
                                                    }
                                                }
                                                if (n.this.a == null || !n.this.a.contains(this.b)) {
                                                    return;
                                                }
                                            } catch (Exception e2) {
                                                w.d("MIMManager", e2.getMessage());
                                                if (n.this.a == null || !n.this.a.contains(this.b)) {
                                                    return;
                                                }
                                            } catch (Throwable th) {
                                                if (n.this.a != null && n.this.a.contains(this.b)) {
                                                    n.this.a.remove(this.b);
                                                }
                                                throw th;
                                            }
                                            n.this.a.remove(this.b);
                                        }
                                    };
                                }
                                runnable = runnable2;
                                if (runnable != null) {
                                }
                                com.mbridge.msdk.foundation.same.f.b.a().execute(new Runnable(context, "dm_page_status", a.a.b(), i) {
                                    /* class com.mbridge.msdk.foundation.tools.n.AnonymousClass5 */
                                    final /* synthetic */ Context a;
                                    final /* synthetic */ String b;
                                    final /* synthetic */ CampaignEx c;
                                    final /* synthetic */ int d;

                                    {
                                        this.a = r2;
                                        this.b = r3;
                                        this.c = r4;
                                        this.d = r5;
                                    }

                                    public final void run() {
                                        try {
                                            if (this.a != null && !TextUtils.isEmpty(this.b) && this.c != null) {
                                                StringBuffer stringBuffer = new StringBuffer();
                                                stringBuffer.append("key=2000100&");
                                                stringBuffer.append("network_type=");
                                                stringBuffer.append(s.D(this.a));
                                                stringBuffer.append("&");
                                                if (!TextUtils.isEmpty(this.c.getRequestIdNotice())) {
                                                    stringBuffer.append("rid_n=");
                                                    stringBuffer.append(this.c.getRequestIdNotice());
                                                    stringBuffer.append("&");
                                                }
                                                if (!TextUtils.isEmpty(this.c.getRequestId())) {
                                                    stringBuffer.append("rid=");
                                                    stringBuffer.append(this.c.getRequestId());
                                                    stringBuffer.append("&");
                                                }
                                                if (!TextUtils.isEmpty(this.c.getCampaignUnitId())) {
                                                    stringBuffer.append("unit_id=");
                                                    stringBuffer.append(this.c.getCampaignUnitId());
                                                    stringBuffer.append("&");
                                                    String str = com.mbridge.msdk.foundation.controller.a.b.get(this.c.getCampaignUnitId());
                                                    StringBuilder sb = new StringBuilder();
                                                    sb.append("u_stid=");
                                                    if (str == null) {
                                                        str = "";
                                                    }
                                                    sb.append(str);
                                                    sb.append("&");
                                                    stringBuffer.append(sb.toString());
                                                }
                                                if (!TextUtils.isEmpty(this.c.getId())) {
                                                    stringBuffer.append("cid=");
                                                    stringBuffer.append(this.c.getId());
                                                    stringBuffer.append("&");
                                                }
                                                stringBuffer.append("status=");
                                                stringBuffer.append(this.b);
                                                stringBuffer.append("&");
                                                stringBuffer.append("code=");
                                                stringBuffer.append(this.d);
                                                if (com.mbridge.msdk.foundation.same.report.b.a().c()) {
                                                    com.mbridge.msdk.foundation.same.report.b.a().a(stringBuffer.toString());
                                                    return;
                                                }
                                                try {
                                                    new com.mbridge.msdk.foundation.same.report.d.a(this.a).c(0, d.a().a, e.a(stringBuffer.toString(), this.a), null);
                                                } catch (Exception e2) {
                                                    e2.printStackTrace();
                                                    w.d("MIMManager", e2.getMessage());
                                                }
                                            }
                                        } catch (Throwable th) {
                                            w.d("MIMManager", th.getMessage());
                                        }
                                    }
                                });
                            }
                        }
                    }
                } catch (Exception e) {
                    w.d("MIMManager", e.getMessage());
                }
            }
        }
    }

    private CampaignEx b(String str) {
        try {
            CampaignEx campaignEx = this.f;
            if (campaignEx != null && TextUtils.equals(campaignEx.getPackageName(), str)) {
                return this.f;
            }
            CopyOnWriteArrayList<CampaignEx> copyOnWriteArrayList = this.a;
            if (copyOnWriteArrayList == null || copyOnWriteArrayList.size() <= 0) {
                return null;
            }
            Iterator<CampaignEx> it = this.a.iterator();
            while (it.hasNext()) {
                CampaignEx next = it.next();
                if (next != null && TextUtils.equals(next.getPackageName(), str)) {
                    return next;
                }
            }
            return null;
        } catch (Exception e2) {
            w.d("MIMManager", e2.getMessage());
            return null;
        }
    }
}