正在查看: Spermatid Pro v6.4.3 应用的 r.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Spermatid Pro v6.4.3 应用的 r.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.ss.android.downloadlib.s;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.bytedance.sdk.openadsdk.downloadnew.core.BaseConstants;
import com.ss.android.download.api.download.DownloadModel;
import com.ss.android.downloadad.api.do.bh;
import com.ss.android.downloadad.api.download.AdDownloadController;
import com.ss.android.downloadlib.activity.JumpKllkActivity;
import com.ss.android.downloadlib.activity.TTDelegateActivity;
import com.ss.android.downloadlib.addownload.bh.gu;
import com.ss.android.downloadlib.addownload.bh.s;
import com.ss.android.downloadlib.addownload.bh.x;
import com.ss.android.downloadlib.addownload.vs;
import com.ss.android.downloadlib.addownload.y;
import com.ss.android.downloadlib.bh.do;
import com.ss.android.downloadlib.bh.td;
import com.ss.android.socialbase.appdownloader.gu.p;
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 r {
private static final String f1373do = "r";
private static void gu(final Context context, final x xVar, final String str) {
com.ss.android.downloadlib.x.do().do(new Runnable() {
@Override
public void run() {
JSONObject y = vs.y();
JSONObject jSONObject = new JSONObject();
try {
String optString = y.optString("s");
String str2 = p.do(y.optString("bw"), optString);
String str3 = p.do(y.optString("bx"), optString);
String str4 = p.do(y.optString("by"), optString);
Uri.Builder builder = new Uri.Builder();
builder.scheme(BaseConstants.SCHEME_HTTPS).authority(str2).appendPath(str3).appendQueryParameter(str4, str);
vs.o().do("GET", builder.build().toString(), (Map) null, new 1(this, jSONObject));
} catch (Exception e) {
e.printStackTrace();
r.bh(xVar, jSONObject, 4, 9, BaseConstants.MARKET_PREFIX + str);
}
}
});
}
private static s o(@NonNull Context context, @NonNull String str) {
try {
Uri parse = Uri.parse("https://www.samsungapps.com/appquery/appDetail.as?appId=" + 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 s(5);
} catch (Exception unused) {
return new s(6, 14);
}
}
private static void p(Context context, x xVar, String str) {
JSONObject jSONObject = new JSONObject();
try {
TTDelegateActivity.do(context, str, xVar.f1339do);
} catch (Exception unused) {
do.do(m4670do(context, Uri.parse(BaseConstants.MARKET_PREFIX + str)), xVar, true);
bh(xVar, jSONObject, 14, 11, BaseConstants.MARKET_PREFIX + str);
}
}
private static void r(Context context, x xVar, String str) {
com.ss.android.downloadlib.x.do().do(new 7(str, context, xVar));
}
private static void s(Context context, x xVar, String str) {
JSONObject jSONObject = new JSONObject();
try {
TTDelegateActivity.do(str, xVar.f1339do);
} catch (Exception unused) {
do.do(m4670do(context, Uri.parse(BaseConstants.MARKET_PREFIX + str)), xVar, true);
bh(xVar, jSONObject, 13, 10, BaseConstants.MARKET_PREFIX + str);
}
}
private static void x(Context context, x xVar, String str) {
com.ss.android.downloadlib.x.do().do(new 5(context, str, xVar));
}
private static void y(Context context, x xVar, String str) {
JSONObject jSONObject = new JSONObject();
try {
TTDelegateActivity.do(str, xVar.f1339do, BaseConstants.VIVO_MARKET_NEED_COMMENT);
} catch (Exception unused) {
do.do(m4670do(context, Uri.parse(BaseConstants.MARKET_PREFIX + str)), xVar, true);
bh(xVar, jSONObject, 9, 8, BaseConstants.MARKET_PREFIX + str);
}
}
private static s bh(Context context, x xVar, String str) {
Intent intent = new Intent(context, (Class<?>) JumpKllkActivity.class);
intent.addFlags(268435456);
intent.putExtra("p", str);
intent.putExtra("id", xVar.f1339do);
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
JSONObject jSONObject = new JSONObject();
try {
context.startActivity(intent);
return new s(7, "am_kllk2");
} catch (Throwable unused) {
bh(xVar, jSONObject, 1, 3, BaseConstants.MARKET_PREFIX + str);
return m4670do(context, Uri.parse(BaseConstants.MARKET_PREFIX + str));
}
}
public static s m4670do(Context context, Uri uri) {
Intent intent;
if (!com.ss.android.socialbase.appdownloader.gu.x.p() && (context == null || uri == null || !BaseConstants.SCHEME_MARKET.equals(uri.getScheme()))) {
return new s(6, 12);
}
try {
String td = com.ss.android.socialbase.appdownloader.gu.x.td();
if (com.ss.android.socialbase.appdownloader.gu.x.ro() && (TextUtils.isEmpty(td) || !yj.x(context, td))) {
td = "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 (!yj.do(context, intent)) {
return new s(6, 13);
}
if (yj.x(context, td) && !com.ss.android.socialbase.appdownloader.gu.x.s()) {
intent.setPackage(td);
}
if (com.ss.android.socialbase.downloader.s.do.p().do("fix_jump_market")) {
intent.addFlags(335544320);
} else if (!(context instanceof Activity)) {
intent.addFlags(268435456);
}
if (com.ss.android.socialbase.downloader.s.do.p().bh("test_jump_market_failed") == 1) {
com.ss.android.downloadlib.x.p.do().do(false, "jump market error");
return new s(6, 25);
}
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
context.startActivity(intent);
return new s(5);
} catch (Exception unused) {
return new s(6, 14);
}
}
public static boolean p(@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 td = com.ss.android.socialbase.appdownloader.gu.x.td();
if (yj.x(vs.getContext(), td)) {
intent.setPackage(td);
}
if (!yj.do(vs.getContext(), intent)) {
return false;
}
try {
activity.startActivity(intent);
return true;
} catch (Exception e) {
com.ss.android.downloadlib.x.p.do().do(e, "start HM2");
return false;
}
}
private static s o(Context context, x xVar, String str) {
Intent intent = new Intent(context, (Class<?>) JumpKllkActivity.class);
intent.addFlags(268435456);
intent.putExtra("dl", true);
intent.putExtra("p", str);
intent.putExtra("id", xVar.f1339do);
if (Build.VERSION.SDK_INT >= 29) {
intent.putExtra("bk", BaseConstants.KLLK_PROMOTION_HEYTAP_PKG_INFO);
} else if (yj.x(context, BaseConstants.KLLK_PROMOTION_NORMAL_PKG_INFO)) {
intent.putExtra("bk", BaseConstants.KLLK_PROMOTION_NORMAL_PKG_INFO);
} else if (yj.x(context, BaseConstants.KLLK_PROMOTION_COLOROS_PKG_INFO)) {
intent.putExtra("bk", BaseConstants.KLLK_PROMOTION_COLOROS_PKG_INFO);
} else {
return m4670do(context, Uri.parse(BaseConstants.MARKET_PREFIX + str));
}
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
JSONObject jSONObject = new JSONObject();
try {
context.startActivity(intent);
return new s(7, "am_kllk3");
} catch (Throwable unused) {
bh(xVar, jSONObject, 1, 3, BaseConstants.MARKET_PREFIX + str);
return m4670do(context, Uri.parse(BaseConstants.MARKET_PREFIX + str));
}
}
public static void bh(Context context, String str, String str2, @NonNull x xVar, @NonNull JSONObject jSONObject) {
yj.do(jSONObject, "ttdownloader_type", 5);
try {
String str3 = p.do(new JSONObject(str2).optString("a"));
if (!TextUtils.isEmpty(str3)) {
TTDelegateActivity.do(str, xVar.f1339do, str3, jSONObject);
return;
}
do.do(m4670do(context, Uri.parse(BaseConstants.MARKET_PREFIX + str)), xVar, true);
bh(xVar, jSONObject, 5, 5, BaseConstants.MARKET_PREFIX + str);
} catch (Exception unused) {
do.do(m4670do(context, Uri.parse(BaseConstants.MARKET_PREFIX + str)), xVar, true);
bh(xVar, jSONObject, 6, 5, BaseConstants.MARKET_PREFIX + str);
}
}
public static boolean p(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("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 bh(@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 td = com.ss.android.socialbase.appdownloader.gu.x.td();
if (yj.x(vs.getContext(), td)) {
intent.setPackage(td);
}
if (!yj.do(vs.getContext(), intent)) {
return false;
}
try {
activity.startActivity(intent);
return true;
} catch (Exception e) {
com.ss.android.downloadlib.x.p.do().do(e, "start HM1");
return false;
}
}
public static String p(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("value")) {
return str3.substring(7, str3.length() - 1);
}
}
}
}
}
return null;
}
public static s m4671do(final Context context, Uri uri, x xVar) {
bh bhVar;
if (context != null && td.do(uri)) {
try {
final Intent intent = new Intent("android.intent.action.VIEW", uri);
if (!yj.do(context, intent)) {
return new s(6, 13);
}
String td = com.ss.android.socialbase.appdownloader.gu.x.td();
if (yj.x(context, td)) {
intent.setPackage(td);
}
intent.addFlags(335544320);
if (com.ss.android.socialbase.downloader.s.do.p().bh("test_jump_market_failed") == 1 && "local_test".equals(vs.td().p)) {
com.ss.android.downloadlib.x.p.do().do(false, "jump market error");
return new s(6, 25);
}
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
long optLong = vs.y().optLong("market_jump_delay", 1000L);
if (optLong > 0 && xVar != null && (bhVar = xVar.x) != null && !bhVar.jy()) {
com.ss.android.downloadlib.r.do().bh().post(new Runnable() {
@Override
public void run() {
vs.p().do(8, vs.getContext(), (DownloadModel) null, "浏览器跳转失败,正在前往应用商店", (Drawable) null, 0);
}
});
}
com.ss.android.downloadlib.x.do().do(new Runnable() {
@Override
public void run() {
context.startActivity(intent);
}
}, optLong);
return new s(5);
} catch (Exception unused) {
return new s(6, 14);
}
}
return new s(6, 12);
}
public static String o(String str) {
List<String> pathSegments = Uri.parse(str).getPathSegments();
if (pathSegments.size() > 0) {
return pathSegments.get(pathSegments.size() - 1);
}
return null;
}
public static void bh(x xVar, JSONObject jSONObject, int i3, int i5, String str) {
yj.do(jSONObject, "error_code", Integer.valueOf(i3));
yj.do(jSONObject, "ttdownloader_type", Integer.valueOf(i5));
yj.do(jSONObject, "rmu", str);
yj.do(jSONObject, com.ss.android.socialbase.appdownloader.gu.x.td(), Integer.valueOf(yj.bh(vs.getContext(), com.ss.android.socialbase.appdownloader.gu.x.td())));
com.ss.android.downloadlib.o.do.do().bh("am_result", jSONObject, xVar);
}
public static s bh(Context context, String str) {
if (TextUtils.isEmpty(str)) {
return new s(4, 11);
}
if (context == null) {
context = vs.getContext();
}
Intent s = yj.s(context, str);
if (s == null) {
return new s(4, 22);
}
s.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
try {
context.startActivity(s);
return new s(3);
} catch (Exception unused) {
return new s(4, 23);
}
}
public static s bh(String str, com.ss.android.downloadad.api.do.do doVar) {
if (TextUtils.isEmpty(str)) {
return new s(2, 21);
}
Context context = vs.getContext();
Intent intent = null;
String packageName = doVar.v().getPackageName();
if (!TextUtils.isEmpty(packageName)) {
d.do().do(f1373do, "tryOpenByUrl", "获取到跳转中转Activity的intent");
intent = m4668do(context, doVar, packageName, 2, str);
if (intent != null) {
s m4669do = m4669do(context, intent, doVar, true, str);
if (m4669do.getType() == 1) {
return m4669do;
}
}
}
intent.setData(Uri.parse(str));
intent.addFlags(268435456);
intent.putExtra("open_url", str);
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
if (com.ss.android.socialbase.downloader.s.do.p().do("fix_app_link_flag")) {
intent.addFlags(67108864);
}
return m4669do(context, intent, doVar, false, str);
}
public static s m4673do(Context context, String str) {
if (context != null && !TextUtils.isEmpty(str)) {
if (com.ss.android.socialbase.appdownloader.gu.x.s() && yj.x(context, "com.sec.android.app.samsungapps")) {
return o(context, str);
}
return m4670do(context, com.ss.android.download.api.p.do.do(str));
}
return new s(6, 11);
}
public static s m4672do(Context context, x xVar, String str) {
if (context != null && !TextUtils.isEmpty(str)) {
if (com.ss.android.socialbase.appdownloader.gu.x.s() && yj.x(context, "com.sec.android.app.samsungapps")) {
return o(context, str);
}
if (xVar.bh.isAd() && xVar.o.enableAM()) {
JSONArray optJSONArray = vs.y().optJSONArray("am_plans");
if (com.ss.android.socialbase.appdownloader.gu.x.x() && com.ss.android.socialbase.appdownloader.gu.do.do(optJSONArray, "am_3")) {
return bh(context, xVar, str);
}
if (com.ss.android.socialbase.appdownloader.gu.x.gu() && com.ss.android.socialbase.appdownloader.gu.do.do(optJSONArray, "am_2")) {
x(context, xVar, str);
return new s(7, "am_m2");
}
if (com.ss.android.socialbase.appdownloader.gu.x.o() && com.ss.android.socialbase.appdownloader.gu.do.do(optJSONArray, "am_5")) {
r(context, xVar, str);
return new s(7, "am_v1");
}
if (com.ss.android.socialbase.appdownloader.gu.x.x() && com.ss.android.socialbase.appdownloader.gu.do.do(optJSONArray, "am_7")) {
AdDownloadController adDownloadController = xVar.o;
if ((adDownloadController instanceof AdDownloadController) && adDownloadController.enableOppoAutoDownload()) {
return o(context, xVar, str);
}
}
if (com.ss.android.socialbase.appdownloader.gu.x.o() && com.ss.android.socialbase.appdownloader.gu.do.do(optJSONArray, "am_8") && yj.do(yj.p(context, "com.bbk.appstore"), BaseConstants.VIVO_V2_REQUIRED_MARKET_VERSION) >= 0) {
y(context, xVar, str);
return new s(7, "am_v2");
}
if ((com.ss.android.socialbase.appdownloader.gu.x.m4690do() || com.ss.android.socialbase.appdownloader.gu.x.bh()) && com.ss.android.socialbase.appdownloader.gu.do.do(optJSONArray, "am_9")) {
gu(context, xVar, str);
return new s(7, "am_hr");
}
if ((com.ss.android.socialbase.appdownloader.gu.x.m4690do() || com.ss.android.socialbase.appdownloader.gu.x.bh()) && com.ss.android.socialbase.appdownloader.gu.do.do(optJSONArray, "am_10")) {
s(context, xVar, str);
return new s(7, "am_hr2");
}
AdDownloadController adDownloadController2 = xVar.o;
if ((adDownloadController2 instanceof AdDownloadController) && adDownloadController2.enableOppoAutoDownload() && xVar.o.getDownloadMarketInterceptor() != null && xVar.bh.getDownloadSettings().optInt("is_use_obm_convert", 0) == 1) {
p(context, xVar, str);
return new s(7, "am_kllk4");
}
return m4670do(context, Uri.parse(BaseConstants.MARKET_PREFIX + str));
}
return m4670do(context, Uri.parse(BaseConstants.MARKET_PREFIX + str));
}
return new s(6, 11);
}
public static void bh(Context context, @NonNull x xVar, @NonNull String str, @NonNull String str2) {
JSONObject jSONObject = new JSONObject();
try {
TTDelegateActivity.bh(str, xVar.f1339do, str2);
} catch (Exception unused) {
do.do(m4670do(context, Uri.parse(BaseConstants.MARKET_PREFIX + str)), xVar, true);
bh(xVar, jSONObject, 12, 9, BaseConstants.MARKET_PREFIX + str);
}
}
public static void bh(@NonNull Activity activity, String str, long j, String str2) {
x x = gu.do().x(j);
JSONObject jSONObject = new JSONObject();
JSONObject y = vs.y();
String optString = y.optString("s");
String str3 = p.do(y.optString("bz"), optString);
String str4 = p.do(y.optString("ca"), optString);
String str5 = p.do(y.optString("cb"), optString);
Uri.Builder builder = new Uri.Builder();
builder.scheme(BaseConstants.MARKET_SCHEME_HW_HONOR).authority("com.huawei.appmarket");
if (!TextUtils.isEmpty(str3)) {
builder.appendQueryParameter(str3, str2);
}
if (!TextUtils.isEmpty(str4) && !TextUtils.isEmpty(str5)) {
builder.appendQueryParameter(str4, str5);
}
if (bh(activity, builder.build())) {
bh(x, jSONObject, -1, 9, BaseConstants.MARKET_PREFIX + str);
do.do("am_hr", jSONObject, x, true);
return;
}
bh(x, jSONObject, 2, 9, BaseConstants.MARKET_PREFIX + str);
do.do(m4670do((Context) activity, Uri.parse(BaseConstants.MARKET_PREFIX + str)), x, true);
}
public static void bh(@NonNull Activity activity, String str, long j) {
x x = gu.do().x(j);
JSONObject jSONObject = new JSONObject();
boolean enableOppoAutoDownload = x.o.enableOppoAutoDownload();
HashMap hashMap = new HashMap();
hashMap.put("is_button", Boolean.valueOf(enableOppoAutoDownload));
yj.do(jSONObject, "is_button", Boolean.valueOf(enableOppoAutoDownload));
Map interceptObmMarket = x.o.getDownloadMarketInterceptor().interceptObmMarket(hashMap);
if (interceptObmMarket != null && interceptObmMarket.get("convert_result") != null && Boolean.parseBoolean(interceptObmMarket.get("convert_result").toString())) {
bh(x, jSONObject, -1, 11, BaseConstants.MARKET_PREFIX + str);
do.do("am_kllk4", jSONObject, x, true);
return;
}
bh(x, jSONObject, 15, 11, BaseConstants.MARKET_PREFIX + str);
do.do(m4670do((Context) activity, Uri.parse(BaseConstants.MARKET_PREFIX + str)), x, true);
}
public static boolean m4689do(Context context, x xVar, String str, JSONObject jSONObject, boolean z, int i3) {
yj.do(jSONObject, "download_scene", Integer.valueOf(xVar.pk()));
com.ss.android.downloadlib.o.do.do().bh("market_click_open", jSONObject, xVar);
s m4670do = m4670do(context, Uri.parse(str));
String str2 = yj.do(new String[]{m4670do.bh(), "open_market"});
int type = m4670do.getType();
if (type == 5) {
do.do(str2, jSONObject, xVar, true);
} else {
if (type == 6) {
yj.do(jSONObject, "error_code", Integer.valueOf(m4670do.do()));
yj.do(jSONObject, "download_scene", Integer.valueOf(xVar.pk()));
com.ss.android.downloadlib.o.do.do().bh("market_open_failed", jSONObject, xVar);
return false;
}
if (type != 7) {
return false;
}
}
if (z) {
com.ss.android.downloadlib.o.do.do().do(xVar.f1339do, i3);
}
return true;
}
public static void m4684do(Context context, String str, long j, boolean z) {
JSONObject jSONObject = new JSONObject();
x x = gu.do().x(j);
try {
JSONObject y = vs.y();
String optString = y.optString("s");
String str2 = p.do(y.optString("aa"), optString);
String str3 = p.do(y.optString("ac"), optString);
String str4 = p.do(y.optString("af"), optString);
boolean z4 = com.ss.android.socialbase.appdownloader.gu.do.do(y, context, str3);
StringBuilder sb = new StringBuilder(String.format(str2, str, str4, str3));
Intent intent = new Intent("android.intent.action.VIEW");
String td = com.ss.android.socialbase.appdownloader.gu.x.td();
if (yj.x(context, td)) {
intent.setPackage(td);
}
if (z) {
sb.append(p.do(y.optString("ae"), optString));
} else {
intent.addFlags(335544320);
}
yj.do(jSONObject, "mf", Boolean.valueOf(z4));
yj.do(jSONObject, "if", Boolean.valueOf(z));
intent.setData(Uri.parse(sb.toString()));
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
context.startActivity(intent);
do.do("am_kllk2", jSONObject, x, true);
if (z4) {
bh(x, jSONObject, -1, 3, sb.toString());
} else {
bh(x, jSONObject, 3, 3, sb.toString());
}
} catch (Exception unused) {
do.do(m4670do(vs.getContext(), Uri.parse(BaseConstants.MARKET_PREFIX + str)), x, true);
bh(x, jSONObject, 2, 3, BaseConstants.MARKET_PREFIX + str);
}
}
public static void m4683do(final Context context, String str, long j, String str2, boolean z) {
JSONObject jSONObject = new JSONObject();
x x = gu.do().x(j);
try {
JSONObject y = vs.y();
String optString = y.optString("s");
String str3 = p.do(y.optString("br"), optString);
String str4 = p.do(y.optString("bs_1"), optString);
String str5 = p.do(y.optString("bs_2"), optString);
String str6 = p.do(y.optString("bs_3"), optString);
String str7 = p.do(y.optString("bt"), optString);
String str8 = p.do(y.optString("bu"), optString);
StringBuilder sb = new StringBuilder(String.format("https://", new Object[0]));
sb.append(str3);
sb.append(str4);
sb.append(str5);
sb.append(str6);
sb.append(str7);
sb.append(str8);
final Intent intent = new Intent("android.intent.action.VIEW");
intent.setPackage(str2);
if (z) {
sb.append("pkg=" + str);
sb.append("&dl=true");
} else {
intent.addFlags(335544320);
}
yj.do(jSONObject, "dl", Boolean.valueOf(z));
intent.setData(Uri.parse(sb.toString()));
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
long optLong = vs.y().optLong("oppo_browser_jump_delay", 1000L);
if (optLong > 0) {
com.ss.android.downloadlib.r.do().bh().post(new 3());
}
com.ss.android.downloadlib.x.do().do(new Runnable() {
@Override
public void run() {
context.startActivity(intent);
}
}, optLong);
bh bhVar = x.x;
if (bhVar != null) {
bhVar.kc(true);
}
do.do("am_kllk3", jSONObject, x, true);
bh(x, jSONObject, -1, 7, sb.toString());
} catch (Exception unused) {
bh bhVar2 = x.x;
if (bhVar2 != null) {
bhVar2.kc(false);
}
do.do(m4671do(vs.getContext(), Uri.parse(BaseConstants.MARKET_PREFIX + str), x), x, true);
bh(x, jSONObject, 2, 7, BaseConstants.MARKET_PREFIX + str);
}
}
private static boolean m4688do(@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 + str));
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
intent.putExtra("param", hashMap);
String td = com.ss.android.socialbase.appdownloader.gu.x.td();
if (yj.x(vs.getContext(), td)) {
intent.setPackage(td);
}
if (!yj.do(vs.getContext(), intent)) {
return false;
}
try {
activity.startActivity(intent);
return true;
} catch (Exception e) {
com.ss.android.downloadlib.x.p.do().do(e, "start v1");
return false;
}
}
public static void m4681do(@NonNull Activity activity, String str, long j, String str2, String str3) {
JSONObject jSONObject;
int i3;
try {
jSONObject = new JSONObject(str3);
} catch (JSONException unused) {
jSONObject = new JSONObject();
}
x x = gu.do().x(j);
try {
JSONObject y = vs.y();
boolean z = com.ss.android.socialbase.appdownloader.gu.do.do(y, activity, p.do(y.optString("bg"), y.optString("s")));
HashMap bh = yj.bh(new JSONObject(str2));
if (z && !bh.isEmpty() && m4688do(activity, str, (HashMap<String, String>) bh)) {
bh(x, jSONObject, -1, 5, BaseConstants.MARKET_PREFIX + str);
do.do("am_v1", jSONObject, x, true);
return;
}
if (z) {
i3 = bh.isEmpty() ? 1 : 2;
} else {
i3 = 3;
}
bh(x, jSONObject, i3, 5, BaseConstants.MARKET_PREFIX + str);
do.do(m4670do((Context) activity, Uri.parse(BaseConstants.MARKET_PREFIX + str)), x, true);
} catch (Exception unused2) {
do.do(m4670do(vs.getContext(), Uri.parse(BaseConstants.MARKET_PREFIX + str)), x, true);
bh(x, jSONObject, 4, 5, BaseConstants.MARKET_PREFIX + str);
}
}
public static void m4680do(@NonNull Activity activity, String str, long j, String str2) {
x x = gu.do().x(j);
JSONObject jSONObject = new JSONObject();
JSONObject y = vs.y();
String str3 = p.do(y.optString("bv"), y.optString("s"));
Uri.Builder builder = new Uri.Builder();
builder.scheme(BaseConstants.SCHEME_MARKET).authority("details").appendQueryParameter("id", str);
if (!TextUtils.isEmpty(str3)) {
builder.appendQueryParameter(str3, str2);
}
if (m4687do(activity, builder.build())) {
bh(x, jSONObject, -1, 8, BaseConstants.MARKET_PREFIX + str);
do.do("am_v2", jSONObject, x, true);
return;
}
bh(x, jSONObject, 2, 8, BaseConstants.MARKET_PREFIX + str);
do.do(m4670do((Context) activity, Uri.parse(BaseConstants.MARKET_PREFIX + str)), x, true);
}
public static boolean m4687do(@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 td = com.ss.android.socialbase.appdownloader.gu.x.td();
if (yj.x(vs.getContext(), td)) {
intent.setPackage(td);
}
if (!yj.do(vs.getContext(), intent)) {
return false;
}
try {
activity.startActivity(intent);
return true;
} catch (Exception e) {
com.ss.android.downloadlib.x.p.do().do(e, "start v2");
return false;
}
}
public static s m4674do(Context context, String str, com.ss.android.downloadad.api.do.do doVar) {
Intent m4668do = m4668do(context, doVar, str, 1, (String) null);
if (m4668do != null) {
d.do().do(f1373do, "tryOpenByPackage", "成功构造了跳转中转Activity的intent");
s m4675do = m4675do(m4668do, true, context, str, doVar);
if (m4675do.getType() == 3) {
return m4675do;
}
}
Intent s = yj.s(context, str);
if (s == null) {
return new s(4, 22);
}
return m4675do(s, false, context, str, doVar);
}
private static s m4675do(Intent intent, boolean z, Context context, String str, com.ss.android.downloadad.api.do.do doVar) {
if (Build.VERSION.SDK_INT >= 26 && vs.y().optInt("open_package_mode") == 1 && vs.d() != null && vs.d().do() && doVar.ro() && !z) {
TTDelegateActivity.bh(str, doVar);
return new s(3);
}
intent.putExtra(BaseConstants.START_ONLY_FOR_ANDROID, true);
try {
context.startActivity(intent);
return new s(3);
} catch (Exception e) {
if (z) {
d.do().bh(f1373do, "realTryOpenByPackage", "调起中转Activity出现异常,可能是没接转化SDK,回退普通调起" + e.getMessage());
return new s(8, 23);
}
d.do().bh(f1373do, "realTryOpenByPackage", "包名调起失败了,抛出异常" + e.getMessage());
return new s(4, 23);
}
}
public static s m4677do(String str, com.ss.android.downloadad.api.do.do doVar) {
return m4674do(vs.getContext(), str, doVar);
}
private static s m4669do(Context context, Intent intent, com.ss.android.downloadad.api.do.do doVar, boolean z, String str) {
if (context == null) {
context = vs.getContext();
}
if (yj.bh(context, intent)) {
if (vs.y().optInt("open_url_mode") == 0 && vs.d() != null && vs.d().do() && Build.VERSION.SDK_INT >= 26 && doVar.ro() && !z) {
TTDelegateActivity.do(str, doVar);
return new s(1);
}
try {
context.startActivity(intent);
return new s(1);
} catch (Exception e) {
if (z) {
d.do().bh(f1373do, "realTryOpenByUrl", "商店直投注入clickId优化url调起场景,抛出异常,没接转化SDK,回退普通调起" + e.getMessage());
return new s(9);
}
d.do().bh(f1373do, "realTryOpenByUrl", "url调起失败了,抛出异常" + e.getMessage());
return new s(2);
}
}
return new s(2, 24);
}
public static s m4676do(@NonNull bh bhVar, String str, String str2) {
s bh = bh(str, (com.ss.android.downloadad.api.do.do) bhVar);
return (com.ss.android.downloadlib.bh.gu.do(bhVar) && bh.getType() == 2) ? m4677do(str2, (com.ss.android.downloadad.api.do.do) bhVar) : bh;
}
public static void m4679do(@NonNull Activity activity, String str, long j) {
x x = gu.do().x(j);
JSONObject jSONObject = new JSONObject();
JSONObject y = vs.y();
String optString = y.optString("s");
String str2 = p.do(y.optString("ca"), optString);
String str3 = p.do(y.optString("cc"), optString);
StringBuilder sb = new StringBuilder(BaseConstants.MARKET_PREFIX);
if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
sb.append(str);
sb.append("&");
sb.append(str2);
sb.append("=");
sb.append(str3);
}
if (p(activity, Uri.parse(sb.toString()))) {
bh(x, jSONObject, -1, 10, BaseConstants.MARKET_PREFIX + str);
do.do("am_hr2", jSONObject, x, true);
return;
}
bh(x, jSONObject, 2, 10, BaseConstants.MARKET_PREFIX + str);
do.do(m4670do((Context) activity, Uri.parse(BaseConstants.MARKET_PREFIX + str)), x, true);
}
private static Intent m4668do(Context context, com.ss.android.downloadad.api.do.do doVar, String str, int i3, String str2) {
if (!doVar.p() || doVar.nr() == null || doVar.nr().getDownloadMode() != 2 || doVar.v() == null || x.do(doVar).do("app_link_market_open_add_info", 0) != 1) {
return null;
}
String p3 = y.p(doVar.v());
String o = y.o(doVar.v());
Intent intent = new Intent();
intent.setClassName(str, "com.bytedance.ads.convert.BDBridgeActivity");
ResolveInfo resolveActivity = context.getPackageManager().resolveActivity(intent, 0);
if (TextUtils.isEmpty(p3) || resolveActivity == null) {
return null;
}
intent.putExtra("click_id", p3);
if (!(context instanceof Activity)) {
intent.setFlags(268435456);
}
if (!TextUtils.isEmpty(o)) {
intent.putExtra("intent_extra", o);
}
if (i3 == 2 && !TextUtils.isEmpty(str2)) {
intent.putExtra("open_url", str2);
}
return intent;
}
}