Kufar v3.2.0版本的 MD5 值为:6a4d203db1c561c7e3bcd50d23fed59f
以下内容为反编译后的 a.java 源代码,内容仅作参考
package com.startapp.sdk.adsbase;
import android.R;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Pair;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
import androidx.browser.customtabs.CustomTabsIntent;
import com.applovin.impl.sdk.utils.Utils;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import com.startapp.b0;
import com.startapp.b6;
import com.startapp.b7;
import com.startapp.c1;
import com.startapp.c3;
import com.startapp.cb;
import com.startapp.i4;
import com.startapp.j4;
import com.startapp.p7;
import com.startapp.s;
import com.startapp.sdk.ads.interstitials.OverlayActivity;
import com.startapp.sdk.adsbase.StartAppSDKInternal;
import com.startapp.sdk.adsbase.commontracking.TrackingParams;
import com.startapp.sdk.adsbase.e;
import com.startapp.sdk.adsbase.model.AdDetails;
import com.startapp.sdk.adsbase.model.AdPreferences;
import com.startapp.sdk.adsbase.remoteconfig.AnalyticsConfig;
import com.startapp.sdk.adsbase.remoteconfig.MetaData;
import com.startapp.sdk.common.Constants;
import com.startapp.sdk.components.ComponentLocator;
import com.startapp.vb;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
public class a {
@Nullable
public static Handler f54604a;
public static ProgressDialog f54605b;
public static String a(Context context, String str) {
ApplicationInfo applicationInfo;
try {
return context.getResources().getString(context.getApplicationInfo().labelRes);
} catch (Throwable unused) {
PackageManager packageManager = context.getPackageManager();
try {
applicationInfo = packageManager.getApplicationInfo(context.getApplicationInfo().packageName, 0);
} catch (Throwable unused2) {
applicationInfo = null;
}
if (applicationInfo != null) {
str = packageManager.getApplicationLabel(applicationInfo);
}
return (String) str;
}
}
public static boolean b(String str) {
return str.startsWith(Utils.PLAY_STORE_SCHEME) || str.startsWith("http://play.google.com") || str.startsWith("https://play.google.com");
}
public static boolean c(String str) {
return str != null && (str.startsWith("http://") || str.startsWith("https://"));
}
public static void b(Context context) {
if (context != null && (context instanceof Activity)) {
Activity activity = (Activity) context;
Map<Activity, Integer> map = vb.f55175a;
vb.a(activity, activity.getResources().getConfiguration().orientation, false);
}
ProgressDialog progressDialog = f54605b;
if (progressDialog != null) {
synchronized (progressDialog) {
ProgressDialog progressDialog2 = f54605b;
if (progressDialog2 != null && progressDialog2.isShowing()) {
try {
f54605b.cancel();
} catch (Throwable th2) {
i4.a(th2);
}
f54605b = null;
}
}
}
}
@Nullable
@VisibleForTesting
public static String c(@Nullable Context context) {
while (context instanceof ContextWrapper) {
if (context instanceof Activity) {
return context.getClass().getName();
}
context = ((ContextWrapper) context).getBaseContext();
}
return null;
}
public static boolean a(Activity activity) {
boolean z11 = activity.getTheme().obtainStyledAttributes(new int[]{R.attr.windowFullscreen}).getBoolean(0, false);
if ((activity.getWindow().getAttributes().flags & 1024) != 0) {
return true;
}
return z11;
}
public static int a(String str) {
String[] split = str.split("&");
return Integer.parseInt(split[split.length - 1].split("=")[1]);
}
public static void a(Context context, String str, String[] strArr, String str2, TrackingParams trackingParams, long j11, long j12, boolean z11, Boolean bool, boolean z12, Runnable runnable) {
String str3;
String str4;
boolean a11;
if (AdsCommonMetaData.f54521h.N()) {
Pair<String, String> a12 = a(context, strArr, str, trackingParams, z12);
String str5 = (String) a12.first;
String str6 = (String) a12.second;
StringBuilder a13 = c1.a(str);
a13.append(AdsCommonMetaData.f54521h.M() || TextUtils.isEmpty(str5) ? com.startapp.a.c(str6) : "");
String sb2 = a13.toString();
Intent intent = new Intent("com.startapp.android.OnClickCallback");
intent.putExtra("dParam", str6);
b6.a(context).a(intent);
if (b(sb2)) {
if (str2 != null && !str2.equals("") && !sb2.toLowerCase().contains(str2.toLowerCase())) {
i4 i4Var = new i4(j4.f53022e);
i4Var.f52978d = "Wrong package reached";
i4Var.f52979e = "Expected: " + str2 + ", Link: " + sb2;
i4Var.f52981g = str6;
i4Var.a();
}
b(context, sb2, str6);
if (runnable != null) {
runnable.run();
return;
}
return;
}
if (context instanceof Activity) {
vb.a((Activity) context, true);
}
try {
WebView b11 = ComponentLocator.a(context).w().b();
if (f54605b == null) {
int i11 = Build.VERSION.SDK_INT;
if (i11 >= 22) {
f54605b = new ProgressDialog(context, R.style.Theme.DeviceDefault.Dialog.Alert);
} else {
f54605b = new ProgressDialog(context);
}
f54605b.setTitle((CharSequence) null);
f54605b.setMessage("Loading....");
f54605b.setIndeterminate(false);
f54605b.setCancelable(false);
f54605b.setOnCancelListener(new s(b11));
if ((context instanceof Activity) && !((Activity) context).isFinishing()) {
f54605b.show();
} else if (!(context instanceof Activity)) {
if (i11 >= 23) {
a11 = Settings.canDrawOverlays(context);
} else {
a11 = b0.a(context, "android.permission.SYSTEM_ALERT_WINDOW");
}
if (a11 && f54605b.getWindow() != null) {
if (i11 >= 26) {
f54605b.getWindow().setType(2038);
} else {
f54605b.getWindow().setType(IronSourceConstants.IS_INSTANCE_LOAD_SUCCESS);
}
f54605b.show();
}
}
}
b11.getSettings().setJavaScriptEnabled(true);
b11.setWebChromeClient(new WebChromeClient());
str4 = str6;
try {
b11.setWebViewClient(new b7(context, ComponentLocator.a(context).d(), ComponentLocator.a(context).k(), new Handler(Looper.getMainLooper()), j11, j12, z11, bool, sb2, str2, str6, runnable));
str3 = sb2;
try {
b11.loadUrl(str3);
} catch (Throwable th2) {
th = th2;
i4.a(th);
b(context, str3, str4);
if (runnable != null) {
runnable.run();
}
}
} catch (Throwable th3) {
th = th3;
str3 = sb2;
}
} catch (Throwable th4) {
th = th4;
str3 = sb2;
str4 = str6;
}
} else {
a(context, str, strArr, trackingParams, z11, z12);
}
}
public static void b(Context context, String str, String str2) {
boolean c11 = c(str);
if (context == null) {
return;
}
int i11 = (AdsCommonMetaData.f54521h.J() || !(context instanceof Activity)) ? 344457216 : 76021760;
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str));
intent.addFlags(i11);
boolean a11 = a(context, intent);
if (!a11) {
try {
if (MetaData.f54824k.j() && ComponentLocator.a(context).d().getBoolean("chromeTabs", false)) {
a(context, str, c11);
return;
}
} catch (Throwable th2) {
i4.a(th2);
try {
Intent parseUri = Intent.parseUri(str, i11);
a(context, parseUri);
if (!(context instanceof Activity)) {
parseUri.addFlags(268435456);
}
context.startActivity(parseUri);
return;
} catch (Throwable th3) {
i4.a(th3);
return;
}
}
}
if (c11 && !a11) {
a(context, intent, i11);
}
context.startActivity(intent);
}
public static void a(String[] strArr, String str, int i11, String str2) {
TrackingParams a11 = new TrackingParams(str).a(i11).a(str2);
if (strArr != null && strArr.length != 0) {
for (String str3 : strArr) {
if (str3 != null && str3.length() > 0) {
i4 i4Var = new i4(j4.f53029l);
i4Var.f52979e = cb.a(str3, a11);
i4Var.a();
}
}
return;
}
i4 i4Var2 = new i4(j4.f53022e);
i4Var2.f52978d = "Non-impression without trackingUrls";
i4Var2.f52983i = str2;
i4Var2.f52979e = vb.b(a11.d());
i4Var2.a();
}
public static List<String> a(List<String> list, String str, String str2) {
ArrayList arrayList = new ArrayList();
int i11 = 0;
while (i11 < list.size()) {
int i12 = i11 + 5;
List<String> subList = list.subList(i11, Math.min(i12, list.size()));
StringBuilder sb2 = new StringBuilder();
sb2.append(AdsConstants.f54526e);
sb2.append("?");
sb2.append(TextUtils.join("&", subList));
sb2.append("&isShown=");
sb2.append(str);
sb2.append("&appPresence=" + str2);
arrayList.add(sb2.toString());
i11 = i12;
}
return arrayList;
}
public static void a(Context context, String str, String[] strArr, TrackingParams trackingParams, boolean z11, boolean z12) {
boolean z13;
Pair<String, String> a11 = a(context, strArr, str, trackingParams, z12);
String str2 = (String) a11.first;
String str3 = (String) a11.second;
try {
if (!AdsCommonMetaData.f54521h.M() && !TextUtils.isEmpty(str2)) {
z13 = false;
if (z13) {
str = str + com.startapp.a.c(str3);
}
if (!MetaData.f54824k.T() && z11) {
a(context, str, str3);
return;
}
if (!TextUtils.isEmpty(str2) && a(context)) {
e.a edit = ComponentLocator.a(context).d().edit();
long currentTimeMillis = System.currentTimeMillis();
edit.a("shared_prefs_CookieFeatureTS", (String) Long.valueOf(currentTimeMillis));
edit.f54764a.putLong("shared_prefs_CookieFeatureTS", currentTimeMillis);
edit.apply();
b(context, str + "&cki=1", null);
return;
}
b(context, str, null);
}
z13 = true;
if (z13) {
}
if (!MetaData.f54824k.T()) {
}
if (!TextUtils.isEmpty(str2)) {
}
b(context, str, null);
} catch (Throwable th2) {
i4.a(th2);
}
}
@NonNull
public static Pair<String, String> a(@NonNull Context context, @Nullable String[] strArr, @Nullable String str, @Nullable TrackingParams trackingParams, boolean z11) {
String str2;
if (strArr != null) {
for (String str3 : strArr) {
if (!TextUtils.isEmpty(str3)) {
a(context, str3, trackingParams);
}
}
}
Object obj = StartAppSDKInternal.D;
StartAppSDKInternal startAppSDKInternal = StartAppSDKInternal.d.f54598a;
startAppSDKInternal.f54570m = true;
startAppSDKInternal.f54562e = true;
String str4 = null;
if (z11 || strArr == null) {
str2 = null;
} else {
try {
str2 = null;
for (String str5 : strArr) {
try {
str2 = a(str, str5);
if (str2 != null || vb.d(str5)) {
str4 = str5;
break;
}
} catch (Throwable th2) {
th = th2;
i4.a(th);
return new Pair<>(str4, str2);
}
}
} catch (Throwable th3) {
th = th3;
str2 = null;
}
}
return new Pair<>(str4, str2);
}
public static void a(Context context, String str, TrackingParams trackingParams) {
if (context == null) {
return;
}
if (str != null && str.length() > 0) {
cb.a(context, str, trackingParams, (c3<String, p7.a, Throwable, Void>) null);
}
vb.a(context, 4, TextUtils.isEmpty(str) ? "Closed Ad" : "Clicked Ad", true);
}
public static void a(Context context, Intent intent, int i11) {
String[] strArr = {"com.android.chrome", "com.android.browser", "com.opera.mini.native", "org.mozilla.firefox", "com.opera.browser"};
try {
List<ResolveInfo> queryIntentActivities = context.getPackageManager().queryIntentActivities(intent, i11);
if (queryIntentActivities == null || queryIntentActivities.size() <= 1) {
return;
}
for (int i12 = 0; i12 < 5; i12++) {
String str = strArr[i12];
if (b0.a(context, str, 0)) {
intent.setPackage(str);
return;
}
}
} catch (Throwable th2) {
i4.a(th2);
}
}
public static void a(Context context, String str, String str2) {
if (TextUtils.isEmpty(str)) {
i4 i4Var = new i4(j4.f53022e);
i4Var.f52978d = "Can not open in app browser, clickUrl is empty";
if (str2 != null) {
i4Var.f52981g = str2;
}
i4Var.a();
return;
}
if (!b(str)) {
Map<Activity, Integer> map = vb.f55175a;
try {
if (MetaData.f54824k.k() && ComponentLocator.a(context).d().getBoolean("chromeTabs", false)) {
a(context, str, true);
return;
}
} catch (Throwable th2) {
i4.a(th2);
}
Intent intent = new Intent(context, (Class<?>) OverlayActivity.class);
intent.addFlags(524288);
intent.addFlags(32768);
if (!(context instanceof Activity)) {
intent.addFlags(268435456);
}
intent.setData(Uri.parse(str));
intent.putExtra("placement", AdPreferences.Placement.INAPP_BROWSER.a());
intent.putExtra("activityShouldLockOrientation", false);
try {
context.startActivity(intent);
return;
} catch (Throwable th3) {
i4.a(th3);
return;
}
}
b(context, str, str2);
}
@RequiresApi(api = 18)
public static void a(Context context, String str, boolean z11) {
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str));
Bundle bundle = new Bundle();
bundle.putBinder(CustomTabsIntent.EXTRA_SESSION, null);
intent.putExtras(bundle);
if (z11) {
try {
List<ResolveInfo> queryIntentActivities = context.getPackageManager().queryIntentActivities(intent, 0);
if (queryIntentActivities != null && queryIntentActivities.size() > 1) {
intent.setPackage(queryIntentActivities.get(0).activityInfo.packageName);
}
} catch (Throwable th2) {
i4.a(th2);
}
}
if (!(context instanceof Activity)) {
intent.addFlags(268435456);
}
try {
context.startActivity(intent);
} catch (Throwable th3) {
i4.a(th3);
}
}
public static void a(String str, String str2, String str3, Context context, TrackingParams trackingParams) {
cb.a(context, str3, trackingParams, (c3<String, p7.a, Throwable, Void>) null);
Intent a11 = vb.a(context, str);
if (a11 != null && str2 != null) {
try {
JSONObject jSONObject = new JSONObject(str2);
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String valueOf = String.valueOf(keys.next());
a11.putExtra(valueOf, String.valueOf(jSONObject.get(valueOf)));
}
} catch (JSONException unused) {
}
}
if (a11 != null) {
try {
context.startActivity(a11);
} catch (Throwable th2) {
i4.a(th2);
}
}
}
public static String a(String str, String str2) {
if (str2 != null) {
try {
if (!str2.equals("")) {
str = str2;
}
} catch (Exception unused) {
}
}
if (str != null) {
String[] split = str.split("[?&]d=");
if (split.length >= 2) {
return split[1].split("[?&]")[0];
}
}
return null;
}
public static void a(Context context, String[] strArr, String str, int i11, @NonNull String str2, @Nullable JSONObject jSONObject) {
try {
AnalyticsConfig analyticsConfig = MetaData.f54824k.analytics;
if (analyticsConfig != null && analyticsConfig.k() && jSONObject != null) {
i4 i4Var = new i4(j4.f53021d);
i4Var.f52978d = "viewability_info";
i4Var.f52983i = str2;
i4Var.f52979e = vb.c(jSONObject.toString());
i4Var.a();
}
} catch (Throwable th2) {
i4.a(th2);
}
try {
String str3 = "Dropped impression because " + str2;
if (jSONObject != null) {
str3 = str3 + ", view hierarchy: " + jSONObject.toString(2);
}
vb.a(context, 6, str3, false);
} catch (Throwable th3) {
i4.a(th3);
}
a(strArr, str, i11, str2);
}
public static boolean a(Context context, Intent intent) {
for (ResolveInfo resolveInfo : context.getPackageManager().queryIntentActivities(intent, 0)) {
if (resolveInfo.activityInfo.packageName.equalsIgnoreCase(Constants.f54880a)) {
ActivityInfo activityInfo = resolveInfo.activityInfo;
intent.setComponent(new ComponentName(activityInfo.packageName, activityInfo.name));
return true;
}
}
return false;
}
public static String a() {
StackTraceElement[] stackTrace = new Throwable().getStackTrace();
for (int i11 = 0; i11 < 8; i11++) {
if (stackTrace[i11].getMethodName().compareTo("doHome") == 0) {
return "home";
}
if (stackTrace[i11].getMethodName().compareTo("onBackPressed") == 0) {
Object obj = StartAppSDKInternal.D;
StartAppSDKInternal startAppSDKInternal = StartAppSDKInternal.d.f54598a;
Activity activity = startAppSDKInternal.f54569l;
if (!(activity != null ? activity.isTaskRoot() : true)) {
return "interstitial";
}
startAppSDKInternal.f54561d = false;
startAppSDKInternal.f54563f = true;
return "back";
}
}
return "interstitial";
}
public static String[] a(d dVar) {
if (dVar instanceof HtmlAd) {
return ((HtmlAd) dVar).trackingUrls;
}
return dVar instanceof JsonAd ? a(((JsonAd) dVar).g()) : new String[0];
}
public static String[] a(List<AdDetails> list) {
ArrayList arrayList = new ArrayList();
if (list != null) {
Iterator<AdDetails> it = list.iterator();
while (it.hasNext()) {
arrayList.addAll(Arrays.asList(it.next().w()));
}
}
return (String[]) arrayList.toArray(new String[0]);
}
public static boolean a(Context context, AdPreferences.Placement placement) {
if (placement.equals(AdPreferences.Placement.INAPP_SPLASH) || !AdsCommonMetaData.f54521h.a()) {
return false;
}
return a(context);
}
public static boolean a(Context context) {
ComponentLocator a11 = ComponentLocator.a(context);
if (a11.a().a().f55091c) {
return false;
}
long j11 = a11.d().getLong("shared_prefs_CookieFeatureTS", 0L);
return j11 == 0 || (((long) AdsCommonMetaData.f54521h.e()) * 86400000) + j11 <= System.currentTimeMillis();
}
public static void a(@Nullable Runnable runnable) {
if (runnable != null) {
Looper mainLooper = Looper.getMainLooper();
if (mainLooper != null && mainLooper.getThread() != Thread.currentThread()) {
Handler handler = f54604a;
if (handler == null) {
handler = new Handler(mainLooper);
f54604a = handler;
}
handler.post(runnable);
return;
}
runnable.run();
}
}
@Nullable
public static String a(@NonNull Context context, @NonNull Object obj) {
return a(context.getPackageName(), obj.getClass().getName(), c(context), (String) null);
}
@NonNull
@RequiresApi(api = 9)
@VisibleForTesting
public static String a(@NonNull String str, @NonNull String str2, @Nullable String str3, @Nullable String str4) {
StringBuilder sb2 = new StringBuilder();
Locale locale = Locale.ROOT;
sb2.append(String.format(locale, "10%08x", Integer.valueOf((str + str2).hashCode())));
sb2.append(str3 != null ? String.format(locale, "ac%08x", Integer.valueOf(str3.hashCode())) : "");
sb2.append(str4 != null ? String.format(locale, "b1%08x", Integer.valueOf(str4.hashCode())) : "");
return sb2.toString();
}
}