正在查看: 小柿子 v1.3.8 应用的 h.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 小柿子 v1.3.8 应用的 h.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.ss.android.downloadlib.g;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.mbridge.msdk.foundation.entity.DomainCampaignEx;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import com.sigmob.sdk.base.mta.PointCategory;
import com.ss.android.download.api.config.r;
import com.ss.android.download.api.constant.BaseConstants;
import com.ss.android.download.api.download.DownloadController;
import com.ss.android.downloadad.api.constant.AdBaseConstants;
import com.ss.android.downloadad.api.download.AdDownloadController;
import com.ss.android.downloadlib.activity.JumpKllkActivity;
import com.ss.android.downloadlib.activity.TTDelegateActivity;
import com.umeng.analytics.pro.am;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class h {
private static final String a = "h";
private static void c(Context context, com.ss.android.downloadlib.addownload.b.e eVar, String str) {
JSONObject jSONObject = new JSONObject();
try {
TTDelegateActivity.a(context, str, eVar.a);
} catch (Exception unused) {
com.ss.android.downloadlib.b.a.a(a(context, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)))), eVar, true);
b(eVar, jSONObject, 14, 11, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
}
}
private static com.ss.android.downloadlib.addownload.b.g d(@NonNull Context context, @NonNull String str) {
try {
Uri parse = Uri.parse("https://www.samsungapps.com/appquery/appDetail.as?appId=".concat(String.valueOf(str)));
Intent intent = new Intent();
intent.setClassName("com.sec.android.app.samsungapps", "com.sec.android.app.samsungapps.Main");
intent.setData(parse);
if (!(context instanceof Activity)) {
intent.addFlags(268435456);
}
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
context.startActivity(intent);
return new com.ss.android.downloadlib.addownload.b.g(5);
} catch (Exception unused) {
return new com.ss.android.downloadlib.addownload.b.g(6, 14);
}
}
private static void e(final Context context, final com.ss.android.downloadlib.addownload.b.e eVar, final String str) {
com.ss.android.downloadlib.e.a().a(new Runnable() {
@Override
public void run() {
com.ss.android.downloadlib.b.a.a(h.a(context, Uri.parse(BaseConstants.MARKET_PREFIX + str)), eVar, true);
JSONObject jSONObject = new JSONObject();
try {
JSONObject j = com.ss.android.downloadlib.addownload.k.j();
Thread.sleep(j.optInt("m2_delay_millis", 1000));
com.ss.android.downloadlib.a.a.a.a().a(context, true);
com.ss.android.downloadlib.a.a.b bVar = new com.ss.android.downloadlib.a.a.b();
bVar.a = 1;
bVar.b = 0;
String a5 = com.ss.android.socialbase.appdownloader.f.c.a(j.optString(am.aE), j.optString(am.aB));
bVar.c = String.format(a5, str);
com.ss.android.downloadlib.a.a.a.a().a(bVar, (com.ss.android.downloadlib.a.a.d) null);
com.ss.android.downloadlib.a.a.a.a().b();
h.b(eVar, jSONObject, -1, 2, String.format(a5, str));
} catch (Throwable th) {
th.printStackTrace();
h.b(eVar, jSONObject, 1, 2, BaseConstants.MARKET_PREFIX + str);
}
}
});
}
private static void f(final Context context, final com.ss.android.downloadlib.addownload.b.e eVar, final String str) {
com.ss.android.downloadlib.e.a().a(new Runnable() {
@Override
public void run() {
JSONObject j = com.ss.android.downloadlib.addownload.k.j();
final JSONObject jSONObject = new JSONObject();
try {
String optString = j.optString(am.aB);
String a5 = com.ss.android.socialbase.appdownloader.f.c.a(j.optString("bw"), optString);
String a6 = com.ss.android.socialbase.appdownloader.f.c.a(j.optString("bx"), optString);
String a7 = com.ss.android.socialbase.appdownloader.f.c.a(j.optString("by"), optString);
Uri.Builder builder = new Uri.Builder();
builder.scheme(BaseConstants.SCHEME_HTTPS).authority(a5).appendPath(a6).appendQueryParameter(a7, str);
com.ss.android.downloadlib.addownload.k.e().a("GET", builder.build().toString(), null, new r() {
@Override
public void a(java.lang.String r6) {
throw new UnsupportedOperationException("Method not decompiled: com.ss.android.downloadlib.g.h.AnonymousClass6.AnonymousClass1.a(java.lang.String):void");
}
@Override
public void a(Throwable th) {
com.ss.android.downloadlib.b.a.a(h.a(context, Uri.parse(BaseConstants.MARKET_PREFIX + str)), eVar, true);
m.a(jSONObject, "ttdownloader_message", th != null ? th.getMessage() : "null");
h.b(eVar, jSONObject, 11, 9, BaseConstants.MARKET_PREFIX + str);
}
});
} catch (Exception e) {
e.printStackTrace();
h.b(eVar, jSONObject, 4, 9, BaseConstants.MARKET_PREFIX + str);
}
}
});
}
private static void g(Context context, com.ss.android.downloadlib.addownload.b.e eVar, String str) {
JSONObject jSONObject = new JSONObject();
try {
TTDelegateActivity.a(str, eVar.a);
} catch (Exception unused) {
com.ss.android.downloadlib.b.a.a(a(context, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)))), eVar, true);
b(eVar, jSONObject, 13, 10, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
}
}
private static void h(final Context context, final com.ss.android.downloadlib.addownload.b.e eVar, final String str) {
com.ss.android.downloadlib.e.a().a(new Runnable() {
@Override
public void run() {
JSONObject j = com.ss.android.downloadlib.addownload.k.j();
String optString = j.optString(am.aB);
final JSONObject jSONObject = new JSONObject();
String a5 = com.ss.android.socialbase.appdownloader.f.c.a(j.optString("x"), optString);
JSONObject jSONObject2 = new JSONObject();
m.a(jSONObject2, am.aH, am.aE);
m.a(jSONObject2, "p", str);
byte[] bytes = jSONObject2.toString().getBytes();
com.ss.android.downloadlib.addownload.k.e().a(a5, com.ss.android.downloadlib.addownload.k.s().a(bytes, bytes.length), "application/octet-stream;tt-data=a", 0, new r() {
@Override
public void a(String str2) {
AnonymousClass7 anonymousClass7 = AnonymousClass7.this;
h.b(context, str, str2, eVar, jSONObject);
}
@Override
public void a(Throwable th) {
com.ss.android.downloadlib.b.a.a(h.a(context, Uri.parse(BaseConstants.MARKET_PREFIX + str)), eVar, true);
m.a(jSONObject, "ttdownloader_message", th != null ? th.getMessage() : "null");
h.b(eVar, jSONObject, 7, 5, BaseConstants.MARKET_PREFIX + str);
}
});
}
});
}
private static void i(Context context, com.ss.android.downloadlib.addownload.b.e eVar, String str) {
JSONObject jSONObject = new JSONObject();
try {
TTDelegateActivity.a(str, eVar.a, BaseConstants.VIVO_MARKET_NEED_COMMENT);
} catch (Exception unused) {
com.ss.android.downloadlib.b.a.a(a(context, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)))), eVar, true);
b(eVar, jSONObject, 9, 8, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
}
}
private static com.ss.android.downloadlib.addownload.b.g b(Context context, com.ss.android.downloadlib.addownload.b.e eVar, String str) {
Intent intent = new Intent(context, (Class<?>) JumpKllkActivity.class);
intent.addFlags(268435456);
intent.putExtra("p", str);
intent.putExtra("id", eVar.a);
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
JSONObject jSONObject = new JSONObject();
try {
context.startActivity(intent);
return new com.ss.android.downloadlib.addownload.b.g(7, "am_kllk2");
} catch (Throwable unused) {
b(eVar, jSONObject, 1, 3, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
return a(context, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str))));
}
}
public static com.ss.android.downloadlib.addownload.b.g a(Context context, Uri uri) {
Intent intent;
if (!com.ss.android.socialbase.appdownloader.f.e.c() && (context == null || uri == null || !BaseConstants.SCHEME_MARKET.equals(uri.getScheme()))) {
return new com.ss.android.downloadlib.addownload.b.g(6, 12);
}
try {
String j = com.ss.android.socialbase.appdownloader.f.e.j();
if (com.ss.android.socialbase.appdownloader.f.e.q() && (TextUtils.isEmpty(j) || !m.e(context, j))) {
j = "com.huawei.appmarket";
Uri.Builder buildUpon = uri.buildUpon();
buildUpon.scheme(BaseConstants.SCHEME_MARKET);
intent = new Intent("android.intent.action.VIEW", buildUpon.build());
} else {
intent = new Intent("android.intent.action.VIEW", uri);
}
if (!m.a(context, intent)) {
return new com.ss.android.downloadlib.addownload.b.g(6, 13);
}
if (m.e(context, j) && !com.ss.android.socialbase.appdownloader.f.e.g()) {
intent.setPackage(j);
}
if (com.ss.android.socialbase.downloader.g.a.c().a("fix_jump_market")) {
intent.addFlags(335544320);
} else if (!(context instanceof Activity)) {
intent.addFlags(268435456);
}
if (com.ss.android.socialbase.downloader.g.a.c().b("test_jump_market_failed") == 1) {
com.ss.android.downloadlib.e.c.a().a(false, "jump market error");
return new com.ss.android.downloadlib.addownload.b.g(6, 25);
}
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
context.startActivity(intent);
return new com.ss.android.downloadlib.addownload.b.g(5);
} catch (Exception unused) {
return new com.ss.android.downloadlib.addownload.b.g(6, 14);
}
}
public static boolean c(@NonNull Activity activity, Uri uri) {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(uri);
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
String j = com.ss.android.socialbase.appdownloader.f.e.j();
if (m.e(com.ss.android.downloadlib.addownload.k.a(), j)) {
intent.setPackage(j);
}
if (!m.a(com.ss.android.downloadlib.addownload.k.a(), intent)) {
return false;
}
try {
activity.startActivity(intent);
return true;
} catch (Exception e) {
com.ss.android.downloadlib.e.c.a().a(e, "start HM2");
return false;
}
}
private static com.ss.android.downloadlib.addownload.b.g d(Context context, com.ss.android.downloadlib.addownload.b.e eVar, String str) {
Intent intent = new Intent(context, (Class<?>) JumpKllkActivity.class);
intent.addFlags(268435456);
intent.putExtra("dl", true);
intent.putExtra("p", str);
intent.putExtra("id", eVar.a);
if (Build.VERSION.SDK_INT >= 29) {
intent.putExtra("bk", BaseConstants.KLLK_PROMOTION_HEYTAP_PKG_INFO);
} else if (m.e(context, BaseConstants.KLLK_PROMOTION_NORMAL_PKG_INFO)) {
intent.putExtra("bk", BaseConstants.KLLK_PROMOTION_NORMAL_PKG_INFO);
} else if (m.e(context, BaseConstants.KLLK_PROMOTION_COLOROS_PKG_INFO)) {
intent.putExtra("bk", BaseConstants.KLLK_PROMOTION_COLOROS_PKG_INFO);
} else {
return a(context, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str))));
}
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
JSONObject jSONObject = new JSONObject();
try {
context.startActivity(intent);
return new com.ss.android.downloadlib.addownload.b.g(7, "am_kllk3");
} catch (Throwable unused) {
b(eVar, jSONObject, 1, 3, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
return a(context, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str))));
}
}
public static void b(Context context, String str, String str2, @NonNull com.ss.android.downloadlib.addownload.b.e eVar, @NonNull JSONObject jSONObject) {
m.a(jSONObject, "ttdownloader_type", (Object) 5);
try {
String a5 = com.ss.android.socialbase.appdownloader.f.c.a(new JSONObject(str2).optString("a"));
if (!TextUtils.isEmpty(a5)) {
TTDelegateActivity.a(str, eVar.a, a5, jSONObject);
} else {
com.ss.android.downloadlib.b.a.a(a(context, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)))), eVar, true);
b(eVar, jSONObject, 5, 5, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
}
} catch (Exception unused) {
com.ss.android.downloadlib.b.a.a(a(context, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)))), eVar, true);
b(eVar, jSONObject, 6, 5, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
}
}
public static boolean c(Context context, String str) {
if (context == null) {
return false;
}
try {
Uri parse = Uri.parse(str);
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(parse);
intent.addFlags(268435456);
intent.putExtra(AdBaseConstants.MARKET_OPEN_INTENT_OPEN_URL, str);
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
context.startActivity(intent);
return true;
} catch (Throwable th) {
th.printStackTrace();
return false;
}
}
public static boolean b(@NonNull Activity activity, Uri uri) {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(uri);
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
String j = com.ss.android.socialbase.appdownloader.f.e.j();
if (m.e(com.ss.android.downloadlib.addownload.k.a(), j)) {
intent.setPackage(j);
}
if (!m.a(com.ss.android.downloadlib.addownload.k.a(), intent)) {
return false;
}
try {
activity.startActivity(intent);
return true;
} catch (Exception e) {
com.ss.android.downloadlib.e.c.a().a(e, "start HM1");
return false;
}
}
public static String c(String str) {
Matcher matcher = Pattern.compile("<input[\\s\\S]*>\\n").matcher(str);
String group = matcher.find() ? matcher.group() : "";
if (!group.equals(null) && group.length() > 0) {
for (String str2 : group.split("\\n")) {
if (str2.startsWith("<input")) {
for (String str3 : str2.split("\\s")) {
if (str3.startsWith(DomainCampaignEx.LOOPBACK_VALUE)) {
return str3.substring(7, str3.length() - 1);
}
}
}
}
}
return null;
}
public static com.ss.android.downloadlib.addownload.b.g a(final Context context, Uri uri, com.ss.android.downloadlib.addownload.b.e eVar) {
com.ss.android.downloadad.api.a.b bVar;
if (context != null && com.ss.android.downloadlib.b.j.a(uri)) {
try {
final Intent intent = new Intent("android.intent.action.VIEW", uri);
if (!m.a(context, intent)) {
return new com.ss.android.downloadlib.addownload.b.g(6, 13);
}
String j = com.ss.android.socialbase.appdownloader.f.e.j();
if (m.e(context, j)) {
intent.setPackage(j);
}
intent.addFlags(335544320);
if (com.ss.android.socialbase.downloader.g.a.c().b("test_jump_market_failed") == 1 && "local_test".equals(com.ss.android.downloadlib.addownload.k.k().c)) {
com.ss.android.downloadlib.e.c.a().a(false, "jump market error");
return new com.ss.android.downloadlib.addownload.b.g(6, 25);
}
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
long optLong = com.ss.android.downloadlib.addownload.k.j().optLong("market_jump_delay", 1000L);
if (optLong > 0 && eVar != null && (bVar = eVar.e) != null && !bVar.ae()) {
com.ss.android.downloadlib.h.a().b().post(new Runnable() {
@Override
public void run() {
com.ss.android.downloadlib.addownload.k.d().a(8, com.ss.android.downloadlib.addownload.k.a(), null, "浏览器跳转失败,正在前往应用商店", null, 0);
}
});
}
com.ss.android.downloadlib.e.a().a(new Runnable() {
@Override
public void run() {
context.startActivity(intent);
}
}, optLong);
return new com.ss.android.downloadlib.addownload.b.g(5);
} catch (Exception unused) {
return new com.ss.android.downloadlib.addownload.b.g(6, 14);
}
}
return new com.ss.android.downloadlib.addownload.b.g(6, 12);
}
public static String d(String str) {
List<String> pathSegments = Uri.parse(str).getPathSegments();
if (pathSegments.size() > 0) {
return pathSegments.get(pathSegments.size() - 1);
}
return null;
}
public static void b(com.ss.android.downloadlib.addownload.b.e eVar, JSONObject jSONObject, int i, int i5, String str) {
m.a(jSONObject, "error_code", Integer.valueOf(i));
m.a(jSONObject, "ttdownloader_type", Integer.valueOf(i5));
m.a(jSONObject, "rmu", str);
m.a(jSONObject, com.ss.android.socialbase.appdownloader.f.e.j(), Integer.valueOf(m.b(com.ss.android.downloadlib.addownload.k.a(), com.ss.android.socialbase.appdownloader.f.e.j())));
com.ss.android.downloadlib.d.a.a().b("am_result", jSONObject, eVar);
}
public static com.ss.android.downloadlib.addownload.b.g b(Context context, String str) {
if (TextUtils.isEmpty(str)) {
return new com.ss.android.downloadlib.addownload.b.g(4, 11);
}
if (context == null) {
context = com.ss.android.downloadlib.addownload.k.a();
}
Intent g6 = m.g(context, str);
if (g6 == null) {
return new com.ss.android.downloadlib.addownload.b.g(4, 22);
}
g6.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
try {
context.startActivity(g6);
return new com.ss.android.downloadlib.addownload.b.g(3);
} catch (Exception unused) {
return new com.ss.android.downloadlib.addownload.b.g(4, 23);
}
}
public static com.ss.android.downloadlib.addownload.b.g b(String str, com.ss.android.downloadad.api.a.a aVar) {
if (TextUtils.isEmpty(str)) {
return new com.ss.android.downloadlib.addownload.b.g(2, 21);
}
Context a5 = com.ss.android.downloadlib.addownload.k.a();
Intent intent = null;
String packageName = aVar.u().getPackageName();
if (!TextUtils.isEmpty(packageName)) {
l.a().a(a, "tryOpenByUrl", "获取到跳转中转Activity的intent");
intent = a(a5, aVar, packageName, 2, str);
if (intent != null) {
com.ss.android.downloadlib.addownload.b.g a6 = a(a5, intent, aVar, true, str);
if (a6.a() == 1) {
return a6;
}
}
}
intent.setData(Uri.parse(str));
intent.addFlags(268435456);
intent.putExtra(AdBaseConstants.MARKET_OPEN_INTENT_OPEN_URL, str);
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
if (com.ss.android.socialbase.downloader.g.a.c().a("fix_app_link_flag")) {
intent.addFlags(67108864);
}
return a(a5, intent, aVar, false, str);
}
public static com.ss.android.downloadlib.addownload.b.g a(Context context, String str) {
if (context != null && !TextUtils.isEmpty(str)) {
if (com.ss.android.socialbase.appdownloader.f.e.g() && m.e(context, "com.sec.android.app.samsungapps")) {
return d(context, str);
}
return a(context, com.ss.android.download.api.c.a.a(str));
}
return new com.ss.android.downloadlib.addownload.b.g(6, 11);
}
public static com.ss.android.downloadlib.addownload.b.g a(Context context, com.ss.android.downloadlib.addownload.b.e eVar, String str) {
if (context != null && !TextUtils.isEmpty(str)) {
if (com.ss.android.socialbase.appdownloader.f.e.g() && m.e(context, "com.sec.android.app.samsungapps")) {
return d(context, str);
}
if (eVar.b.isAd() && eVar.d.enableAM()) {
JSONArray optJSONArray = com.ss.android.downloadlib.addownload.k.j().optJSONArray("am_plans");
if (com.ss.android.socialbase.appdownloader.f.e.e() && com.ss.android.socialbase.appdownloader.f.a.a(optJSONArray, "am_3")) {
return b(context, eVar, str);
}
if (com.ss.android.socialbase.appdownloader.f.e.f() && com.ss.android.socialbase.appdownloader.f.a.a(optJSONArray, "am_2")) {
e(context, eVar, str);
return new com.ss.android.downloadlib.addownload.b.g(7, "am_m2");
}
if (com.ss.android.socialbase.appdownloader.f.e.d() && com.ss.android.socialbase.appdownloader.f.a.a(optJSONArray, "am_5")) {
h(context, eVar, str);
return new com.ss.android.downloadlib.addownload.b.g(7, "am_v1");
}
if (com.ss.android.socialbase.appdownloader.f.e.e() && com.ss.android.socialbase.appdownloader.f.a.a(optJSONArray, "am_7")) {
DownloadController downloadController = eVar.d;
if ((downloadController instanceof AdDownloadController) && ((AdDownloadController) downloadController).enableOppoAutoDownload()) {
return d(context, eVar, str);
}
}
if (com.ss.android.socialbase.appdownloader.f.e.d() && com.ss.android.socialbase.appdownloader.f.a.a(optJSONArray, "am_8") && m.a(m.c(context, "com.bbk.appstore"), BaseConstants.VIVO_V2_REQUIRED_MARKET_VERSION) >= 0) {
i(context, eVar, str);
return new com.ss.android.downloadlib.addownload.b.g(7, "am_v2");
}
if ((com.ss.android.socialbase.appdownloader.f.e.a() || com.ss.android.socialbase.appdownloader.f.e.b()) && com.ss.android.socialbase.appdownloader.f.a.a(optJSONArray, "am_9")) {
f(context, eVar, str);
return new com.ss.android.downloadlib.addownload.b.g(7, "am_hr");
}
if ((com.ss.android.socialbase.appdownloader.f.e.a() || com.ss.android.socialbase.appdownloader.f.e.b()) && com.ss.android.socialbase.appdownloader.f.a.a(optJSONArray, "am_10")) {
g(context, eVar, str);
return new com.ss.android.downloadlib.addownload.b.g(7, "am_hr2");
}
DownloadController downloadController2 = eVar.d;
if ((downloadController2 instanceof AdDownloadController) && ((AdDownloadController) downloadController2).enableOppoAutoDownload() && ((AdDownloadController) eVar.d).getDownloadMarketInterceptor() != null && eVar.b.getDownloadSettings().optInt("is_use_obm_convert", 0) == 1) {
c(context, eVar, str);
return new com.ss.android.downloadlib.addownload.b.g(7, "am_kllk4");
}
return a(context, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str))));
}
return a(context, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str))));
}
return new com.ss.android.downloadlib.addownload.b.g(6, 11);
}
public static void b(Context context, @NonNull com.ss.android.downloadlib.addownload.b.e eVar, @NonNull String str, @NonNull String str2) {
JSONObject jSONObject = new JSONObject();
try {
TTDelegateActivity.b(str, eVar.a, str2);
} catch (Exception unused) {
com.ss.android.downloadlib.b.a.a(a(context, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)))), eVar, true);
b(eVar, jSONObject, 12, 9, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
}
}
public static void b(@NonNull Activity activity, String str, long j, String str2) {
com.ss.android.downloadlib.addownload.b.e e = com.ss.android.downloadlib.addownload.b.f.a().e(j);
JSONObject jSONObject = new JSONObject();
JSONObject j5 = com.ss.android.downloadlib.addownload.k.j();
String optString = j5.optString(am.aB);
String a5 = com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("bz"), optString);
String a6 = com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("ca"), optString);
String a7 = com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("cb"), optString);
Uri.Builder builder = new Uri.Builder();
builder.scheme(BaseConstants.MARKET_SCHEME_HW_HONOR).authority("com.huawei.appmarket");
if (!TextUtils.isEmpty(a5)) {
builder.appendQueryParameter(a5, str2);
}
if (!TextUtils.isEmpty(a6) && !TextUtils.isEmpty(a7)) {
builder.appendQueryParameter(a6, a7);
}
if (b(activity, builder.build())) {
b(e, jSONObject, -1, 9, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
com.ss.android.downloadlib.b.a.a("am_hr", jSONObject, e, true);
} else {
b(e, jSONObject, 2, 9, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
com.ss.android.downloadlib.b.a.a(a((Context) activity, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)))), e, true);
}
}
public static void b(@NonNull Activity activity, String str, long j) {
com.ss.android.downloadlib.addownload.b.e e = com.ss.android.downloadlib.addownload.b.f.a().e(j);
JSONObject jSONObject = new JSONObject();
boolean enableOppoAutoDownload = ((AdDownloadController) e.d).enableOppoAutoDownload();
HashMap hashMap = new HashMap();
hashMap.put("is_button", Boolean.valueOf(enableOppoAutoDownload));
m.a(jSONObject, "is_button", Boolean.valueOf(enableOppoAutoDownload));
Map<String, Object> interceptObmMarket = ((AdDownloadController) e.d).getDownloadMarketInterceptor().interceptObmMarket(hashMap);
if (interceptObmMarket != null && interceptObmMarket.get("convert_result") != null && Boolean.parseBoolean(interceptObmMarket.get("convert_result").toString())) {
b(e, jSONObject, -1, 11, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
com.ss.android.downloadlib.b.a.a("am_kllk4", jSONObject, e, true);
} else {
b(e, jSONObject, 15, 11, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
com.ss.android.downloadlib.b.a.a(a((Context) activity, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)))), e, true);
}
}
public static boolean a(Context context, com.ss.android.downloadlib.addownload.b.e eVar, String str, JSONObject jSONObject, boolean z, int i) {
m.a(jSONObject, "download_scene", Integer.valueOf(eVar.t()));
com.ss.android.downloadlib.d.a.a().b("market_click_open", jSONObject, eVar);
com.ss.android.downloadlib.addownload.b.g a5 = a(context, Uri.parse(str));
String a6 = m.a(a5.c(), PointCategory.OPEN_MARKET);
int a7 = a5.a();
if (a7 == 5) {
com.ss.android.downloadlib.b.a.a(a6, jSONObject, eVar, true);
} else {
if (a7 == 6) {
m.a(jSONObject, "error_code", Integer.valueOf(a5.b()));
m.a(jSONObject, "download_scene", Integer.valueOf(eVar.t()));
com.ss.android.downloadlib.d.a.a().b("market_open_failed", jSONObject, eVar);
return false;
}
if (a7 != 7) {
return false;
}
}
if (z) {
com.ss.android.downloadlib.d.a.a().a(eVar.a, i);
}
return true;
}
public static void a(Context context, String str, long j, boolean z) {
JSONObject jSONObject = new JSONObject();
com.ss.android.downloadlib.addownload.b.e e = com.ss.android.downloadlib.addownload.b.f.a().e(j);
try {
JSONObject j5 = com.ss.android.downloadlib.addownload.k.j();
String optString = j5.optString(am.aB);
String a5 = com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("aa"), optString);
String a6 = com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("ac"), optString);
String a7 = com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("af"), optString);
boolean a8 = com.ss.android.socialbase.appdownloader.f.a.a(j5, context, a6);
StringBuilder sb = new StringBuilder(String.format(a5, str, a7, a6));
Intent intent = new Intent("android.intent.action.VIEW");
String j6 = com.ss.android.socialbase.appdownloader.f.e.j();
if (m.e(context, j6)) {
intent.setPackage(j6);
}
if (z) {
sb.append(com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("ae"), optString));
} else {
intent.addFlags(335544320);
}
m.a(jSONObject, "mf", Boolean.valueOf(a8));
m.a(jSONObject, "if", Boolean.valueOf(z));
intent.setData(Uri.parse(sb.toString()));
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
context.startActivity(intent);
com.ss.android.downloadlib.b.a.a("am_kllk2", jSONObject, e, true);
if (a8) {
b(e, jSONObject, -1, 3, sb.toString());
} else {
b(e, jSONObject, 3, 3, sb.toString());
}
} catch (Exception unused) {
com.ss.android.downloadlib.b.a.a(a(com.ss.android.downloadlib.addownload.k.a(), Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)))), e, true);
b(e, jSONObject, 2, 3, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
}
}
public static void a(final Context context, String str, long j, String str2, boolean z) {
JSONObject jSONObject = new JSONObject();
com.ss.android.downloadlib.addownload.b.e e = com.ss.android.downloadlib.addownload.b.f.a().e(j);
try {
JSONObject j5 = com.ss.android.downloadlib.addownload.k.j();
String optString = j5.optString(am.aB);
String a5 = com.ss.android.socialbase.appdownloader.f.c.a(j5.optString(TtmlNode.TAG_BR), optString);
String a6 = com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("bs_1"), optString);
String a7 = com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("bs_2"), optString);
String a8 = com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("bs_3"), optString);
String a9 = com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("bt"), optString);
String a10 = com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("bu"), optString);
StringBuilder sb = new StringBuilder(String.format("https://", new Object[0]));
sb.append(a5);
sb.append(a6);
sb.append(a7);
sb.append(a8);
sb.append(a9);
sb.append(a10);
final Intent intent = new Intent("android.intent.action.VIEW");
intent.setPackage(str2);
if (z) {
sb.append("pkg=".concat(String.valueOf(str)));
sb.append("&dl=true");
} else {
intent.addFlags(335544320);
}
m.a(jSONObject, "dl", Boolean.valueOf(z));
intent.setData(Uri.parse(sb.toString()));
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
long optLong = com.ss.android.downloadlib.addownload.k.j().optLong("oppo_browser_jump_delay", 1000L);
if (optLong > 0) {
com.ss.android.downloadlib.h.a().b().post(new Runnable() {
@Override
public void run() {
com.ss.android.downloadlib.addownload.k.d().a(12, com.ss.android.downloadlib.addownload.k.a(), null, "正在前往浏览器下载", null, 0);
}
});
}
com.ss.android.downloadlib.e.a().a(new Runnable() {
@Override
public void run() {
context.startActivity(intent);
}
}, optLong);
com.ss.android.downloadad.api.a.b bVar = e.e;
if (bVar != null) {
bVar.v(true);
}
com.ss.android.downloadlib.b.a.a("am_kllk3", jSONObject, e, true);
b(e, jSONObject, -1, 7, sb.toString());
} catch (Exception unused) {
com.ss.android.downloadad.api.a.b bVar2 = e.e;
if (bVar2 != null) {
bVar2.v(false);
}
com.ss.android.downloadlib.b.a.a(a(com.ss.android.downloadlib.addownload.k.a(), Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str))), e), e, true);
b(e, jSONObject, 2, 7, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
}
}
private static boolean a(@NonNull Activity activity, @NonNull String str, @NonNull HashMap<String, String> hashMap) {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str))));
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
intent.putExtra("param", hashMap);
String j = com.ss.android.socialbase.appdownloader.f.e.j();
if (m.e(com.ss.android.downloadlib.addownload.k.a(), j)) {
intent.setPackage(j);
}
if (!m.a(com.ss.android.downloadlib.addownload.k.a(), intent)) {
return false;
}
try {
activity.startActivity(intent);
return true;
} catch (Exception e) {
com.ss.android.downloadlib.e.c.a().a(e, "start v1");
return false;
}
}
public static void a(@NonNull Activity activity, String str, long j, String str2, String str3) {
JSONObject jSONObject;
int i;
try {
jSONObject = new JSONObject(str3);
} catch (JSONException unused) {
jSONObject = new JSONObject();
}
com.ss.android.downloadlib.addownload.b.e e = com.ss.android.downloadlib.addownload.b.f.a().e(j);
try {
JSONObject j5 = com.ss.android.downloadlib.addownload.k.j();
boolean a5 = com.ss.android.socialbase.appdownloader.f.a.a(j5, activity, com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("bg"), j5.optString(am.aB)));
HashMap<String, String> b = m.b(new JSONObject(str2));
if (a5 && !b.isEmpty() && a(activity, str, b)) {
b(e, jSONObject, -1, 5, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
com.ss.android.downloadlib.b.a.a("am_v1", jSONObject, e, true);
return;
}
if (a5) {
i = b.isEmpty() ? 1 : 2;
} else {
i = 3;
}
b(e, jSONObject, i, 5, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
com.ss.android.downloadlib.b.a.a(a((Context) activity, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)))), e, true);
} catch (Exception unused2) {
com.ss.android.downloadlib.b.a.a(a(com.ss.android.downloadlib.addownload.k.a(), Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)))), e, true);
b(e, jSONObject, 4, 5, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
}
}
public static void a(@NonNull Activity activity, String str, long j, String str2) {
com.ss.android.downloadlib.addownload.b.e e = com.ss.android.downloadlib.addownload.b.f.a().e(j);
JSONObject jSONObject = new JSONObject();
JSONObject j5 = com.ss.android.downloadlib.addownload.k.j();
String a5 = com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("bv"), j5.optString(am.aB));
Uri.Builder builder = new Uri.Builder();
builder.scheme(BaseConstants.SCHEME_MARKET).authority(BaseConstants.MARKET_URI_AUTHORITY_DETAIL).appendQueryParameter("id", str);
if (!TextUtils.isEmpty(a5)) {
builder.appendQueryParameter(a5, str2);
}
if (a(activity, builder.build())) {
b(e, jSONObject, -1, 8, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
com.ss.android.downloadlib.b.a.a("am_v2", jSONObject, e, true);
} else {
b(e, jSONObject, 2, 8, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
com.ss.android.downloadlib.b.a.a(a((Context) activity, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)))), e, true);
}
}
public static boolean a(@NonNull Activity activity, Uri uri) {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(uri);
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
String j = com.ss.android.socialbase.appdownloader.f.e.j();
if (m.e(com.ss.android.downloadlib.addownload.k.a(), j)) {
intent.setPackage(j);
}
if (!m.a(com.ss.android.downloadlib.addownload.k.a(), intent)) {
return false;
}
try {
activity.startActivity(intent);
return true;
} catch (Exception e) {
com.ss.android.downloadlib.e.c.a().a(e, "start v2");
return false;
}
}
public static com.ss.android.downloadlib.addownload.b.g a(Context context, String str, com.ss.android.downloadad.api.a.a aVar) {
Intent a5 = a(context, aVar, str, 1, (String) null);
if (a5 != null) {
l.a().a(a, "tryOpenByPackage", "成功构造了跳转中转Activity的intent");
com.ss.android.downloadlib.addownload.b.g a6 = a(a5, true, context, str, aVar);
if (a6.a() == 3) {
return a6;
}
}
Intent g6 = m.g(context, str);
if (g6 == null) {
return new com.ss.android.downloadlib.addownload.b.g(4, 22);
}
return a(g6, false, context, str, aVar);
}
private static com.ss.android.downloadlib.addownload.b.g a(Intent intent, boolean z, Context context, String str, com.ss.android.downloadad.api.a.a aVar) {
if (Build.VERSION.SDK_INT >= 26 && com.ss.android.downloadlib.addownload.k.j().optInt("open_package_mode") == 1 && com.ss.android.downloadlib.addownload.k.m() != null && com.ss.android.downloadlib.addownload.k.m().a() && aVar.q() && !z) {
TTDelegateActivity.b(str, aVar);
return new com.ss.android.downloadlib.addownload.b.g(3);
}
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
try {
context.startActivity(intent);
return new com.ss.android.downloadlib.addownload.b.g(3);
} catch (Exception e) {
if (z) {
l.a().b(a, "realTryOpenByPackage", "调起中转Activity出现异常,可能是没接转化SDK,回退普通调起" + e.getMessage());
return new com.ss.android.downloadlib.addownload.b.g(8, 23);
}
l.a().b(a, "realTryOpenByPackage", "包名调起失败了,抛出异常" + e.getMessage());
return new com.ss.android.downloadlib.addownload.b.g(4, 23);
}
}
public static com.ss.android.downloadlib.addownload.b.g a(String str, com.ss.android.downloadad.api.a.a aVar) {
return a(com.ss.android.downloadlib.addownload.k.a(), str, aVar);
}
private static com.ss.android.downloadlib.addownload.b.g a(Context context, Intent intent, com.ss.android.downloadad.api.a.a aVar, boolean z, String str) {
if (context == null) {
context = com.ss.android.downloadlib.addownload.k.a();
}
if (m.b(context, intent)) {
if (com.ss.android.downloadlib.addownload.k.j().optInt("open_url_mode") == 0 && com.ss.android.downloadlib.addownload.k.m() != null && com.ss.android.downloadlib.addownload.k.m().a() && Build.VERSION.SDK_INT >= 26 && aVar.q() && !z) {
TTDelegateActivity.a(str, aVar);
return new com.ss.android.downloadlib.addownload.b.g(1);
}
try {
context.startActivity(intent);
return new com.ss.android.downloadlib.addownload.b.g(1);
} catch (Exception e) {
if (z) {
l.a().b(a, "realTryOpenByUrl", "商店直投注入clickId优化url调起场景,抛出异常,没接转化SDK,回退普通调起" + e.getMessage());
return new com.ss.android.downloadlib.addownload.b.g(9);
}
l.a().b(a, "realTryOpenByUrl", "url调起失败了,抛出异常" + e.getMessage());
return new com.ss.android.downloadlib.addownload.b.g(2);
}
}
return new com.ss.android.downloadlib.addownload.b.g(2, 24);
}
public static com.ss.android.downloadlib.addownload.b.g a(@NonNull com.ss.android.downloadad.api.a.b bVar, String str, String str2) {
com.ss.android.downloadlib.addownload.b.g b = b(str, bVar);
return (com.ss.android.downloadlib.b.f.a(bVar) && b.a() == 2) ? a(str2, bVar) : b;
}
public static void a(@NonNull Activity activity, String str, long j) {
com.ss.android.downloadlib.addownload.b.e e = com.ss.android.downloadlib.addownload.b.f.a().e(j);
JSONObject jSONObject = new JSONObject();
JSONObject j5 = com.ss.android.downloadlib.addownload.k.j();
String optString = j5.optString(am.aB);
String a5 = com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("ca"), optString);
String a6 = com.ss.android.socialbase.appdownloader.f.c.a(j5.optString("cc"), optString);
StringBuilder sb = new StringBuilder(BaseConstants.MARKET_PREFIX);
if (!TextUtils.isEmpty(a5) && !TextUtils.isEmpty(a6)) {
sb.append(str);
sb.append("&");
sb.append(a5);
sb.append("=");
sb.append(a6);
}
if (c(activity, Uri.parse(sb.toString()))) {
b(e, jSONObject, -1, 10, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
com.ss.android.downloadlib.b.a.a("am_hr2", jSONObject, e, true);
} else {
b(e, jSONObject, 2, 10, BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)));
com.ss.android.downloadlib.b.a.a(a((Context) activity, Uri.parse(BaseConstants.MARKET_PREFIX.concat(String.valueOf(str)))), e, true);
}
}
private static Intent a(Context context, com.ss.android.downloadad.api.a.a aVar, String str, int i, String str2) {
if (!aVar.c() || aVar.w() == null || aVar.w().getDownloadMode() != 2 || aVar.u() == null || e.a(aVar).a("app_link_market_open_add_info", 0) != 1) {
return null;
}
String c = com.ss.android.downloadlib.addownload.i.c(aVar.u());
String d = com.ss.android.downloadlib.addownload.i.d(aVar.u());
Intent intent = new Intent();
intent.setClassName(str, AdBaseConstants.MARKET_OPEN_BRIDGE_ACTIVITY);
ResolveInfo resolveActivity = context.getPackageManager().resolveActivity(intent, 0);
if (TextUtils.isEmpty(c) || resolveActivity == null) {
return null;
}
intent.putExtra(AdBaseConstants.MARKET_OPEN_CLICK_ID, c);
if (!(context instanceof Activity)) {
intent.setFlags(268435456);
}
if (!TextUtils.isEmpty(d)) {
intent.putExtra(AdBaseConstants.MARKET_OPEN_INTENT_EXTRA, d);
}
if (i == 2 && !TextUtils.isEmpty(str2)) {
intent.putExtra(AdBaseConstants.MARKET_OPEN_INTENT_OPEN_URL, str2);
}
return intent;
}
}