花瓣 v4.6.12版本的 MD5 值为:6a3515d4d16d98931f1b3d25a91b257e
以下内容为反编译后的 b.java 源代码,内容仅作参考
package com.ss.android.downloadlib.addownload.compliance;
import android.app.Activity;
import android.text.TextUtils;
import android.util.Pair;
import androidx.annotation.NonNull;
import com.huawei.hms.framework.common.ContainerUtils;
import com.qq.e.ads.nativ.NativeUnifiedADAppInfoImpl;
import com.ss.android.download.api.config.r;
import com.ss.android.download.api.download.DownloadModel;
import com.ss.android.downloadlib.activity.TTDelegateActivity;
import com.ss.android.downloadlib.addownload.j;
import com.ss.android.downloadlib.addownload.model.f;
import com.ss.android.downloadlib.constants.EventConstants;
import com.ss.android.downloadlib.g;
import com.ss.android.downloadlib.utils.Chain;
import com.ss.android.downloadlib.utils.k;
import java.lang.ref.SoftReference;
import java.util.HashMap;
import java.util.regex.Pattern;
import org.json.JSONArray;
import org.json.JSONObject;
public class b {
private SoftReference<Activity> a;
public static class a {
private static b a = new b();
}
public void b(long j) {
com.ss.android.downloadlib.addownload.e a2 = g.a().a(f.a().e(j).b.getDownloadUrl());
if (a2 != null) {
a2.a(true, true);
return;
}
e.a(11, j);
com.ss.android.downloadlib.exception.c.a().b("startDownload handler null");
}
private b() {
}
public static b a() {
return a.a;
}
public void a(long j) {
TTDelegateActivity.a(j);
}
public boolean a(DownloadModel downloadModel) {
if (downloadModel.isAd() && j.i().optInt("ad_lp_show_app_dialog") != 0) {
String webUrl = downloadModel.getDeepLink() == null ? null : downloadModel.getDeepLink().getWebUrl();
return (TextUtils.isEmpty(webUrl) || Pattern.compile(j.i().optString("ad_allow_web_url_regex", ".+(www.chengzijianzhan.com|www.toutiaopage.com/tetris/page|ad.toutiao.com/tetris/page).+")).matcher(webUrl).matches()) ? false : true;
}
return false;
}
public Activity b() {
Activity activity = this.a.get();
this.a = null;
return activity;
}
public boolean a(@NonNull com.ss.android.downloadlib.addownload.model.e eVar) {
long j;
long j2;
if (!TextUtils.isEmpty(eVar.b.getLogExtra())) {
try {
j = k.a(new JSONObject(eVar.b.getLogExtra()), "convert_id");
} catch (Exception e2) {
e2.printStackTrace();
j = 0;
}
if (j <= 0) {
e.a(3, eVar);
}
j2 = j;
} else {
e.a(9, eVar);
com.ss.android.downloadlib.exception.c.a().a("requestAppInfo getLogExtra null");
j2 = 0;
}
final long j3 = eVar.a;
com.ss.android.downloadlib.addownload.model.b a2 = c.a().a(j2, j3);
if (a2 != null) {
d.a().a(a2.a(), j3, a2.f11788d);
a(a2.a());
e.a(EventConstants.Label.LP_APP_DIALOG_TRY_SHOW, eVar);
return true;
}
StringBuilder sb = new StringBuilder();
if (j2 > 0) {
sb.append("convert_id=");
sb.append(j2);
}
if (!TextUtils.isEmpty(eVar.b.getPackageName())) {
if (sb.length() > 0) {
sb.append(ContainerUtils.FIELD_DELIMITER);
}
sb.append("package_name=");
sb.append(eVar.b.getPackageName());
}
if (sb.length() <= 0) {
e.a(6, eVar);
return false;
}
final long j4 = j2;
Chain.a((Chain.a<String, R>) new Chain.a<String, Boolean>() {
@Override
public Boolean a(String str) {
final boolean[] zArr = {false};
j.d().a("GET", str, new HashMap(), new r() {
@Override
public void a(String str2) {
boolean[] zArr2 = zArr;
AnonymousClass2 anonymousClass2 = AnonymousClass2.this;
zArr2[0] = b.this.a(j4, j3, str2);
}
@Override
public void a(Throwable th) {
e.a(2, j3);
zArr[0] = false;
}
});
return Boolean.valueOf(zArr[0]);
}
}, "https://apps.oceanengine.com/customer/api/app/pkg_info?" + sb.toString()).a(new Chain.a<Boolean, Object>() {
@Override
public Object a(Boolean bool) {
if (bool.booleanValue()) {
b.this.a(com.ss.android.downloadlib.addownload.model.b.a(j4, j3));
e.b(EventConstants.Label.LP_APP_DIALOG_TRY_SHOW, j3);
return null;
}
b.this.b(j3);
return null;
}
}).a();
return true;
}
public boolean a(long j, long j2, String str) {
try {
JSONObject optJSONObject = new JSONObject(str).optJSONObject("package");
if (optJSONObject != null && optJSONObject.length() != 0) {
com.ss.android.downloadlib.addownload.model.b bVar = new com.ss.android.downloadlib.addownload.model.b();
bVar.a = j;
bVar.b = j2;
bVar.f11788d = optJSONObject.optString("icon_url");
bVar.f11789e = optJSONObject.optString("app_name");
bVar.c = optJSONObject.optString("package_name");
bVar.f11790f = optJSONObject.optString(NativeUnifiedADAppInfoImpl.Keys.VERSION_NAME);
bVar.f11791g = optJSONObject.optString("developer_name");
bVar.f11793i = optJSONObject.optString("policy_url");
JSONArray optJSONArray = optJSONObject.optJSONArray(com.bytedance.msdk.api.activity.TTDelegateActivity.INTENT_PERMISSIONS);
if (optJSONArray != null) {
for (int i2 = 0; i2 < optJSONArray.length(); i2++) {
JSONObject jSONObject = (JSONObject) optJSONArray.get(i2);
bVar.f11792h.add(new Pair<>(jSONObject.optString("permission_name"), jSONObject.optString("permission_desc")));
}
}
c.a().a(bVar);
d.a().a(bVar.a(), j2, bVar.f11788d);
return true;
}
e.a(7, j2);
return false;
} catch (Exception e2) {
com.ss.android.downloadlib.exception.c.a().a(e2, "AdLpComplianceManager parseResponse");
e.a(7, j2);
return false;
}
}
public void a(Activity activity) {
this.a = new SoftReference<>(activity);
}
}