整点视频 v3.3.0版本的 MD5 值为:cba0457dc37421eed445b30f92de25d3
以下内容为反编译后的 t.java 源代码,内容仅作参考
package com.ss.android.downloadlib.e;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.sigmob.sdk.base.mta.PointCategory;
import com.ss.android.download.api.config.lf;
import com.ss.android.download.api.download.DownloadController;
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.socialbase.downloader.setting.DownloadSetting;
import com.ss.android.socialbase.downloader.utils.DownloadExpSwitchCode;
import java.util.HashMap;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class t {
private static void e(final Context context, final com.ss.android.downloadlib.addownload.zc.r rVar, final String str) {
com.ss.android.downloadlib.ql.g().g(new Runnable() {
@Override
public void run() {
JSONObject gj = com.ss.android.downloadlib.addownload.il.gj();
String optString = gj.optString(com.kuaishou.weapon.p0.t.g);
final JSONObject jSONObject = new JSONObject();
String g = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("x"), optString);
JSONObject jSONObject2 = new JSONObject();
nr.g(jSONObject2, "t", com.kuaishou.weapon.p0.t.c);
nr.g(jSONObject2, com.kuaishou.weapon.p0.t.b, str);
byte[] bytes = jSONObject2.toString().getBytes();
com.ss.android.downloadlib.addownload.il.ql().g(g, com.ss.android.downloadlib.addownload.il.lf().g(bytes, bytes.length), "application/octet-stream;tt-data=a", 0, new lf() {
@Override
public void g(String str2) {
AnonymousClass7 anonymousClass7 = AnonymousClass7.this;
t.zc(context, str, str2, rVar, jSONObject);
}
@Override
public void g(Throwable th) {
Context context2 = context;
com.ss.android.downloadlib.zc.g.g(t.g(context2, Uri.parse("market://details?id=" + str)), rVar, true);
nr.g(jSONObject, "ttdownloader_message", th != null ? th.getMessage() : "null");
com.ss.android.downloadlib.addownload.zc.r rVar2 = rVar;
JSONObject jSONObject3 = jSONObject;
t.zc(rVar2, jSONObject3, 7, 5, "market://details?id=" + str);
}
});
}
});
}
private static void fy(Context context, com.ss.android.downloadlib.addownload.zc.r rVar, String str) {
JSONObject jSONObject = new JSONObject();
try {
TTDelegateActivity.g(str, rVar.g);
} catch (Exception unused) {
com.ss.android.downloadlib.zc.g.g(g(context, Uri.parse("market://details?id=".concat(String.valueOf(str)))), rVar, true);
zc(rVar, jSONObject, 13, 10, "market://details?id=".concat(String.valueOf(str)));
}
}
private static com.ss.android.downloadlib.addownload.zc.e i(Context context, com.ss.android.downloadlib.addownload.zc.r rVar, String str) {
Intent intent = new Intent(context, JumpKllkActivity.class);
intent.addFlags(DownloadExpSwitchCode.BUGFIX_GETPACKAGEINFO_BY_UNZIP);
intent.putExtra("dl", true);
intent.putExtra(com.kuaishou.weapon.p0.t.b, str);
intent.putExtra("id", rVar.g);
if (Build.VERSION.SDK_INT >= 29) {
intent.putExtra("bk", "com.heytap.browser");
} else if (nr.r(context, "com.android.browser")) {
intent.putExtra("bk", "com.android.browser");
} else if (nr.r(context, "com.coloros.browser")) {
intent.putExtra("bk", "com.coloros.browser");
} else {
return g(context, Uri.parse("market://details?id=".concat(String.valueOf(str))));
}
intent.putExtra("start_only_for_android", true);
JSONObject jSONObject = new JSONObject();
try {
context.startActivity(intent);
return new com.ss.android.downloadlib.addownload.zc.e(7, "am_kllk3");
} catch (Throwable unused) {
zc(rVar, jSONObject, 1, 3, "market://details?id=".concat(String.valueOf(str)));
return g(context, Uri.parse("market://details?id=".concat(String.valueOf(str))));
}
}
private static com.ss.android.downloadlib.addownload.zc.e ql(@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(DownloadExpSwitchCode.BUGFIX_GETPACKAGEINFO_BY_UNZIP);
}
intent.putExtra("start_only_for_android", true);
context.startActivity(intent);
return new com.ss.android.downloadlib.addownload.zc.e(5);
} catch (Exception unused) {
return new com.ss.android.downloadlib.addownload.zc.e(6, 14);
}
}
private static void r(final Context context, final com.ss.android.downloadlib.addownload.zc.r rVar, final String str) {
com.ss.android.downloadlib.ql.g().g(new Runnable() {
@Override
public void run() {
JSONObject gj = com.ss.android.downloadlib.addownload.il.gj();
final JSONObject jSONObject = new JSONObject();
try {
String optString = gj.optString(com.kuaishou.weapon.p0.t.g);
String g = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("bw"), optString);
String g2 = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("bx"), optString);
String g3 = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("by"), optString);
Uri.Builder builder = new Uri.Builder();
builder.scheme("https").authority(g).appendPath(g2).appendQueryParameter(g3, str);
com.ss.android.downloadlib.addownload.il.ql().g("GET", builder.build().toString(), null, new lf() {
@Override
public void g(String str2) {
boolean z;
if (!TextUtils.isEmpty(str2)) {
String i = t.i(str2);
if (!TextUtils.isEmpty(i)) {
String ql = t.ql(i);
if (!TextUtils.isEmpty(ql)) {
AnonymousClass6 anonymousClass6 = AnonymousClass6.this;
t.zc(context, rVar, str, ql);
z = true;
if (z) {
Context context2 = context;
com.ss.android.downloadlib.zc.g.g(t.g(context2, Uri.parse("market://details?id=" + str)), rVar, true);
com.ss.android.downloadlib.addownload.zc.r rVar2 = rVar;
JSONObject jSONObject2 = jSONObject;
t.zc(rVar2, jSONObject2, 10, 9, "market://details?id=" + str);
return;
}
return;
}
}
}
z = false;
if (z) {
}
}
@Override
public void g(Throwable th) {
Context context2 = context;
com.ss.android.downloadlib.zc.g.g(t.g(context2, Uri.parse("market://details?id=" + str)), rVar, true);
nr.g(jSONObject, "ttdownloader_message", th != null ? th.getMessage() : "null");
com.ss.android.downloadlib.addownload.zc.r rVar2 = rVar;
JSONObject jSONObject2 = jSONObject;
t.zc(rVar2, jSONObject2, 11, 9, "market://details?id=" + str);
}
});
} catch (Exception e) {
e.printStackTrace();
com.ss.android.downloadlib.addownload.zc.r rVar2 = rVar;
t.zc(rVar2, jSONObject, 4, 9, "market://details?id=" + str);
}
}
});
}
private static void t(Context context, com.ss.android.downloadlib.addownload.zc.r rVar, String str) {
JSONObject jSONObject = new JSONObject();
try {
TTDelegateActivity.g(str, rVar.g, "need_comment");
} catch (Exception unused) {
com.ss.android.downloadlib.zc.g.g(g(context, Uri.parse("market://details?id=".concat(String.valueOf(str)))), rVar, true);
zc(rVar, jSONObject, 9, 8, "market://details?id=".concat(String.valueOf(str)));
}
}
private static com.ss.android.downloadlib.addownload.zc.e zc(Context context, com.ss.android.downloadlib.addownload.zc.r rVar, String str) {
Intent intent = new Intent(context, JumpKllkActivity.class);
intent.addFlags(DownloadExpSwitchCode.BUGFIX_GETPACKAGEINFO_BY_UNZIP);
intent.putExtra(com.kuaishou.weapon.p0.t.b, str);
intent.putExtra("id", rVar.g);
intent.putExtra("start_only_for_android", true);
JSONObject jSONObject = new JSONObject();
try {
context.startActivity(intent);
return new com.ss.android.downloadlib.addownload.zc.e(7, "am_kllk2");
} catch (Throwable unused) {
zc(rVar, jSONObject, 1, 3, "market://details?id=".concat(String.valueOf(str)));
return g(context, Uri.parse("market://details?id=".concat(String.valueOf(str))));
}
}
public static com.ss.android.downloadlib.addownload.zc.e g(Context context, Uri uri) {
if (!com.ss.android.socialbase.appdownloader.fy.r.i() && (context == null || uri == null || !"market".equals(uri.getScheme()))) {
return new com.ss.android.downloadlib.addownload.zc.e(6, 12);
}
try {
Intent intent = new Intent("android.intent.action.VIEW", uri);
if (!nr.g(context, intent)) {
return new com.ss.android.downloadlib.addownload.zc.e(6, 13);
}
String zy = com.ss.android.socialbase.appdownloader.fy.r.zy();
if (nr.r(context, zy) && !com.ss.android.socialbase.appdownloader.fy.r.e()) {
intent.setPackage(zy);
}
if (DownloadSetting.obtainGlobal().optBugFix("fix_jump_market")) {
intent.addFlags(335544320);
} else if (!(context instanceof Activity)) {
intent.addFlags(DownloadExpSwitchCode.BUGFIX_GETPACKAGEINFO_BY_UNZIP);
}
if (DownloadSetting.obtainGlobal().optInt("test_jump_market_failed") == 1) {
com.ss.android.downloadlib.r.i.g().g(false, "jump market error");
return new com.ss.android.downloadlib.addownload.zc.e(6, 25);
}
intent.putExtra("start_only_for_android", true);
context.startActivity(intent);
return new com.ss.android.downloadlib.addownload.zc.e(5);
} catch (Exception unused) {
return new com.ss.android.downloadlib.addownload.zc.e(6, 14);
}
}
private static void ql(final Context context, final com.ss.android.downloadlib.addownload.zc.r rVar, final String str) {
com.ss.android.downloadlib.ql.g().g(new Runnable() {
@Override
public void run() {
Context context2 = context;
com.ss.android.downloadlib.zc.g.g(t.g(context2, Uri.parse("market://details?id=" + str)), rVar, true);
JSONObject jSONObject = new JSONObject();
try {
JSONObject gj = com.ss.android.downloadlib.addownload.il.gj();
Thread.sleep(gj.optInt("m2_delay_millis", 1000));
com.ss.android.downloadlib.g.g.g.g().g(context, true);
com.ss.android.downloadlib.g.g.zc zcVar = new com.ss.android.downloadlib.g.g.zc();
zcVar.g = 1;
zcVar.zc = 0;
String g = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString(com.kuaishou.weapon.p0.t.c), gj.optString(com.kuaishou.weapon.p0.t.g));
zcVar.i = String.format(g, str);
com.ss.android.downloadlib.g.g.g.g().g(zcVar, (com.ss.android.downloadlib.g.g.ql) null);
com.ss.android.downloadlib.g.g.g.g().zc();
t.zc(rVar, jSONObject, -1, 2, String.format(g, str));
} catch (Throwable th) {
th.printStackTrace();
com.ss.android.downloadlib.addownload.zc.r rVar2 = rVar;
t.zc(rVar2, jSONObject, 1, 2, "market://details?id=" + str);
}
}
});
}
public static String ql(String str) {
List<String> pathSegments = Uri.parse(str).getPathSegments();
if (pathSegments.size() > 0) {
return pathSegments.get(pathSegments.size() - 1);
}
return null;
}
public static void zc(Context context, String str, String str2, @NonNull com.ss.android.downloadlib.addownload.zc.r rVar, @NonNull JSONObject jSONObject) {
nr.g(jSONObject, "ttdownloader_type", (Object) 5);
try {
String g = com.ss.android.socialbase.appdownloader.fy.i.g(new JSONObject(str2).optString(com.kuaishou.weapon.p0.t.f));
if (!TextUtils.isEmpty(g)) {
TTDelegateActivity.g(str, rVar.g, g, jSONObject);
return;
}
com.ss.android.downloadlib.zc.g.g(g(context, Uri.parse("market://details?id=".concat(String.valueOf(str)))), rVar, true);
zc(rVar, jSONObject, 5, 5, "market://details?id=".concat(String.valueOf(str)));
} catch (Exception unused) {
com.ss.android.downloadlib.zc.g.g(g(context, Uri.parse("market://details?id=".concat(String.valueOf(str)))), rVar, true);
zc(rVar, jSONObject, 6, 5, "market://details?id=".concat(String.valueOf(str)));
}
}
public static boolean i(@NonNull Activity activity, Uri uri) {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(uri);
intent.putExtra("start_only_for_android", true);
String zy = com.ss.android.socialbase.appdownloader.fy.r.zy();
if (nr.r(com.ss.android.downloadlib.addownload.il.getContext(), zy)) {
intent.setPackage(zy);
}
if (nr.g(com.ss.android.downloadlib.addownload.il.getContext(), intent)) {
try {
activity.startActivity(intent);
return true;
} catch (Exception e) {
com.ss.android.downloadlib.r.i.g().g(e, "start HM2");
return false;
}
}
return false;
}
public static boolean zc(@NonNull Activity activity, Uri uri) {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(uri);
intent.putExtra("start_only_for_android", true);
String zy = com.ss.android.socialbase.appdownloader.fy.r.zy();
if (nr.r(com.ss.android.downloadlib.addownload.il.getContext(), zy)) {
intent.setPackage(zy);
}
if (nr.g(com.ss.android.downloadlib.addownload.il.getContext(), intent)) {
try {
activity.startActivity(intent);
return true;
} catch (Exception e) {
com.ss.android.downloadlib.r.i.g().g(e, "start HM1");
return false;
}
}
return false;
}
public static com.ss.android.downloadlib.addownload.zc.e g(final Context context, Uri uri, com.ss.android.downloadlib.addownload.zc.r rVar) {
com.ss.android.downloadad.api.g.zc zcVar;
if (context != null && com.ss.android.downloadlib.zc.zy.g(uri)) {
try {
final Intent intent = new Intent("android.intent.action.VIEW", uri);
if (!nr.g(context, intent)) {
return new com.ss.android.downloadlib.addownload.zc.e(6, 13);
}
String zy = com.ss.android.socialbase.appdownloader.fy.r.zy();
if (nr.r(context, zy)) {
intent.setPackage(zy);
}
intent.addFlags(335544320);
if (DownloadSetting.obtainGlobal().optInt("test_jump_market_failed") == 1 && "local_test".equals(com.ss.android.downloadlib.addownload.il.zy().i)) {
com.ss.android.downloadlib.r.i.g().g(false, "jump market error");
return new com.ss.android.downloadlib.addownload.zc.e(6, 25);
}
intent.putExtra("start_only_for_android", true);
long optLong = com.ss.android.downloadlib.addownload.il.gj().optLong("market_jump_delay", 1000L);
if (optLong > 0 && rVar != null && (zcVar = rVar.r) != null && !zcVar.cd()) {
com.ss.android.downloadlib.t.g().zc().post(new Runnable() {
@Override
public void run() {
com.ss.android.downloadlib.addownload.il.i().g(8, com.ss.android.downloadlib.addownload.il.getContext(), null, "浏览器跳转失败,正在前往应用商店", null, 0);
}
});
}
com.ss.android.downloadlib.ql.g().g(new Runnable() {
@Override
public void run() {
context.startActivity(intent);
}
}, optLong);
return new com.ss.android.downloadlib.addownload.zc.e(5);
} catch (Exception unused) {
return new com.ss.android.downloadlib.addownload.zc.e(6, 14);
}
}
return new com.ss.android.downloadlib.addownload.zc.e(6, 12);
}
public static boolean i(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(DownloadExpSwitchCode.BUGFIX_GETPACKAGEINFO_BY_UNZIP);
intent.putExtra("open_url", str);
intent.putExtra("start_only_for_android", true);
context.startActivity(intent);
return true;
} catch (Throwable th) {
th.printStackTrace();
return false;
}
}
public static void zc(com.ss.android.downloadlib.addownload.zc.r rVar, JSONObject jSONObject, int i, int i2, String str) {
nr.g(jSONObject, "error_code", Integer.valueOf(i));
nr.g(jSONObject, "ttdownloader_type", Integer.valueOf(i2));
nr.g(jSONObject, "rmu", str);
nr.g(jSONObject, com.ss.android.socialbase.appdownloader.fy.r.zy(), Integer.valueOf(nr.zc(com.ss.android.downloadlib.addownload.il.getContext(), com.ss.android.socialbase.appdownloader.fy.r.zy())));
com.ss.android.downloadlib.ql.g.g().zc("am_result", jSONObject, rVar);
}
public static String i(String str) {
String[] split;
String[] split2;
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);
}
}
continue;
}
}
}
return null;
}
public static com.ss.android.downloadlib.addownload.zc.e zc(Context context, String str) {
if (TextUtils.isEmpty(str)) {
return new com.ss.android.downloadlib.addownload.zc.e(4, 11);
}
if (context == null) {
context = com.ss.android.downloadlib.addownload.il.getContext();
}
Intent e = nr.e(context, str);
if (e == null) {
return new com.ss.android.downloadlib.addownload.zc.e(4, 22);
}
e.putExtra("start_only_for_android", true);
try {
context.startActivity(e);
return new com.ss.android.downloadlib.addownload.zc.e(3);
} catch (Exception unused) {
return new com.ss.android.downloadlib.addownload.zc.e(4, 23);
}
}
public static com.ss.android.downloadlib.addownload.zc.e g(Context context, String str) {
if (context != null && !TextUtils.isEmpty(str)) {
if (com.ss.android.socialbase.appdownloader.fy.r.e() && nr.r(context, "com.sec.android.app.samsungapps")) {
return ql(context, str);
}
return g(context, Uri.parse("market://details?id=".concat(String.valueOf(str))));
}
return new com.ss.android.downloadlib.addownload.zc.e(6, 11);
}
public static com.ss.android.downloadlib.addownload.zc.e zc(String str, @NonNull com.ss.android.downloadad.api.g.g gVar) {
if (TextUtils.isEmpty(str)) {
return new com.ss.android.downloadlib.addownload.zc.e(2, 21);
}
Context context = com.ss.android.downloadlib.addownload.il.getContext();
Uri parse = Uri.parse(str);
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(parse);
intent.addFlags(DownloadExpSwitchCode.BUGFIX_GETPACKAGEINFO_BY_UNZIP);
intent.putExtra("open_url", str);
intent.putExtra("start_only_for_android", true);
if (DownloadSetting.obtainGlobal().optBugFix("fix_app_link_flag")) {
intent.addFlags(DownloadExpSwitchCode.BACK_BUGFIX_SIGBUS);
}
if (nr.zc(context, intent)) {
if (com.ss.android.downloadlib.addownload.il.gj().optInt("open_url_mode") == 0 && com.ss.android.downloadlib.addownload.il.nr() != null && com.ss.android.downloadlib.addownload.il.nr().g() && Build.VERSION.SDK_INT >= 26 && gVar.ro()) {
TTDelegateActivity.g(str, gVar);
} else {
try {
com.ss.android.downloadlib.addownload.il.getContext().startActivity(intent);
} catch (Exception unused) {
return new com.ss.android.downloadlib.addownload.zc.e(2);
}
}
return new com.ss.android.downloadlib.addownload.zc.e(1);
}
return new com.ss.android.downloadlib.addownload.zc.e(2, 24);
}
public static com.ss.android.downloadlib.addownload.zc.e g(Context context, com.ss.android.downloadlib.addownload.zc.r rVar, String str) {
if (context != null && !TextUtils.isEmpty(str)) {
if (com.ss.android.socialbase.appdownloader.fy.r.e() && nr.r(context, "com.sec.android.app.samsungapps")) {
return ql(context, str);
}
if (rVar.zc.isAd() && rVar.ql.enableAM()) {
JSONArray optJSONArray = com.ss.android.downloadlib.addownload.il.gj().optJSONArray("am_plans");
if (com.ss.android.socialbase.appdownloader.fy.r.r() && com.ss.android.socialbase.appdownloader.fy.g.g(optJSONArray, "am_3")) {
return zc(context, rVar, str);
}
if (com.ss.android.socialbase.appdownloader.fy.r.fy() && com.ss.android.socialbase.appdownloader.fy.g.g(optJSONArray, "am_2")) {
ql(context, rVar, str);
return new com.ss.android.downloadlib.addownload.zc.e(7, "am_m2");
} else if (com.ss.android.socialbase.appdownloader.fy.r.ql() && com.ss.android.socialbase.appdownloader.fy.g.g(optJSONArray, "am_5")) {
e(context, rVar, str);
return new com.ss.android.downloadlib.addownload.zc.e(7, "am_v1");
} else {
if (com.ss.android.socialbase.appdownloader.fy.r.r() && com.ss.android.socialbase.appdownloader.fy.g.g(optJSONArray, "am_7")) {
DownloadController downloadController = rVar.ql;
if ((downloadController instanceof AdDownloadController) && ((AdDownloadController) downloadController).enableOppoAutoDownload()) {
return i(context, rVar, str);
}
}
if (com.ss.android.socialbase.appdownloader.fy.r.ql() && com.ss.android.socialbase.appdownloader.fy.g.g(optJSONArray, "am_8") && nr.g(nr.i(context, "com.bbk.appstore"), "8.7.2.0") >= 0) {
t(context, rVar, str);
return new com.ss.android.downloadlib.addownload.zc.e(7, "am_v2");
} else if ((com.ss.android.socialbase.appdownloader.fy.r.g() || com.ss.android.socialbase.appdownloader.fy.r.zc()) && com.ss.android.socialbase.appdownloader.fy.g.g(optJSONArray, "am_9")) {
r(context, rVar, str);
return new com.ss.android.downloadlib.addownload.zc.e(7, "am_hr");
} else if ((com.ss.android.socialbase.appdownloader.fy.r.g() || com.ss.android.socialbase.appdownloader.fy.r.zc()) && com.ss.android.socialbase.appdownloader.fy.g.g(optJSONArray, "am_10")) {
fy(context, rVar, str);
return new com.ss.android.downloadlib.addownload.zc.e(7, "am_hr2");
} else {
return g(context, Uri.parse("market://details?id=".concat(String.valueOf(str))));
}
}
}
return g(context, Uri.parse("market://details?id=".concat(String.valueOf(str))));
}
return new com.ss.android.downloadlib.addownload.zc.e(6, 11);
}
public static void zc(Context context, @NonNull com.ss.android.downloadlib.addownload.zc.r rVar, @NonNull String str, @NonNull String str2) {
JSONObject jSONObject = new JSONObject();
try {
TTDelegateActivity.zc(str, rVar.g, str2);
} catch (Exception unused) {
com.ss.android.downloadlib.zc.g.g(g(context, Uri.parse("market://details?id=".concat(String.valueOf(str)))), rVar, true);
zc(rVar, jSONObject, 12, 9, "market://details?id=".concat(String.valueOf(str)));
}
}
public static void zc(@NonNull Activity activity, String str, long j, String str2) {
com.ss.android.downloadlib.addownload.zc.r r = com.ss.android.downloadlib.addownload.zc.fy.g().r(j);
JSONObject jSONObject = new JSONObject();
JSONObject gj = com.ss.android.downloadlib.addownload.il.gj();
String optString = gj.optString(com.kuaishou.weapon.p0.t.g);
String g = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("bz"), optString);
String g2 = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("ca"), optString);
String g3 = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("cb"), optString);
Uri.Builder builder = new Uri.Builder();
builder.scheme("hiapplink").authority("com.huawei.appmarket");
if (!TextUtils.isEmpty(g)) {
builder.appendQueryParameter(g, str2);
}
if (!TextUtils.isEmpty(g2) && !TextUtils.isEmpty(g3)) {
builder.appendQueryParameter(g2, g3);
}
if (zc(activity, builder.build())) {
zc(r, jSONObject, -1, 9, "market://details?id=".concat(String.valueOf(str)));
com.ss.android.downloadlib.zc.g.g("am_hr", jSONObject, r, true);
return;
}
zc(r, jSONObject, 2, 9, "market://details?id=".concat(String.valueOf(str)));
com.ss.android.downloadlib.zc.g.g(g((Context) activity, Uri.parse("market://details?id=".concat(String.valueOf(str)))), r, true);
}
public static boolean g(Context context, com.ss.android.downloadlib.addownload.zc.r rVar, String str, JSONObject jSONObject, boolean z, int i) {
nr.g(jSONObject, "download_scene", Integer.valueOf(rVar.o()));
com.ss.android.downloadlib.ql.g.g().zc("market_click_open", jSONObject, rVar);
com.ss.android.downloadlib.addownload.zc.e g = g(context, Uri.parse(str));
String g2 = nr.g(g.zc(), PointCategory.OPEN_MARKET);
int type = g.getType();
if (type == 5) {
com.ss.android.downloadlib.zc.g.g(g2, jSONObject, rVar, true);
} else if (type == 6) {
nr.g(jSONObject, "error_code", Integer.valueOf(g.g()));
nr.g(jSONObject, "download_scene", Integer.valueOf(rVar.o()));
com.ss.android.downloadlib.ql.g.g().zc("market_open_failed", jSONObject, rVar);
return false;
} else if (type != 7) {
return false;
}
if (z) {
com.ss.android.downloadlib.ql.g.g().g(rVar.g, i);
}
return true;
}
public static void g(Context context, String str, long j, boolean z) {
JSONObject jSONObject = new JSONObject();
com.ss.android.downloadlib.addownload.zc.r r = com.ss.android.downloadlib.addownload.zc.fy.g().r(j);
try {
JSONObject gj = com.ss.android.downloadlib.addownload.il.gj();
String optString = gj.optString(com.kuaishou.weapon.p0.t.g);
String g = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("aa"), optString);
String g2 = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("ac"), optString);
String g3 = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("af"), optString);
boolean g4 = com.ss.android.socialbase.appdownloader.fy.g.g(gj, context, g2);
StringBuilder sb = new StringBuilder(String.format(g, str, g3, g2));
Intent intent = new Intent("android.intent.action.VIEW");
String zy = com.ss.android.socialbase.appdownloader.fy.r.zy();
if (nr.r(context, zy)) {
intent.setPackage(zy);
}
if (z) {
sb.append(com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("ae"), optString));
} else {
intent.addFlags(335544320);
}
nr.g(jSONObject, "mf", Boolean.valueOf(g4));
nr.g(jSONObject, "if", Boolean.valueOf(z));
intent.setData(Uri.parse(sb.toString()));
intent.putExtra("start_only_for_android", true);
context.startActivity(intent);
com.ss.android.downloadlib.zc.g.g("am_kllk2", jSONObject, r, true);
if (g4) {
zc(r, jSONObject, -1, 3, sb.toString());
} else {
zc(r, jSONObject, 3, 3, sb.toString());
}
} catch (Exception unused) {
com.ss.android.downloadlib.zc.g.g(g(com.ss.android.downloadlib.addownload.il.getContext(), Uri.parse("market://details?id=".concat(String.valueOf(str)))), r, true);
zc(r, jSONObject, 2, 3, "market://details?id=".concat(String.valueOf(str)));
}
}
public static void g(final Context context, String str, long j, String str2, boolean z) {
JSONObject jSONObject = new JSONObject();
com.ss.android.downloadlib.addownload.zc.r r = com.ss.android.downloadlib.addownload.zc.fy.g().r(j);
try {
JSONObject gj = com.ss.android.downloadlib.addownload.il.gj();
String optString = gj.optString(com.kuaishou.weapon.p0.t.g);
String g = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("br"), optString);
String g2 = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("bs_1"), optString);
String g3 = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("bs_2"), optString);
String g4 = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("bs_3"), optString);
String g5 = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("bt"), optString);
String g6 = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("bu"), optString);
StringBuilder sb = new StringBuilder(String.format("https://", new Object[0]));
sb.append(g);
sb.append(g2);
sb.append(g3);
sb.append(g4);
sb.append(g5);
sb.append(g6);
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);
}
nr.g(jSONObject, "dl", Boolean.valueOf(z));
intent.setData(Uri.parse(sb.toString()));
intent.putExtra("start_only_for_android", true);
long optLong = com.ss.android.downloadlib.addownload.il.gj().optLong("oppo_browser_jump_delay", 1000L);
if (optLong > 0) {
com.ss.android.downloadlib.t.g().zc().post(new Runnable() {
@Override
public void run() {
com.ss.android.downloadlib.addownload.il.i().g(12, com.ss.android.downloadlib.addownload.il.getContext(), null, "正在前往浏览器下载", null, 0);
}
});
}
com.ss.android.downloadlib.ql.g().g(new Runnable() {
@Override
public void run() {
context.startActivity(intent);
}
}, optLong);
com.ss.android.downloadad.api.g.zc zcVar = r.r;
if (zcVar != null) {
zcVar.nk(true);
}
com.ss.android.downloadlib.zc.g.g("am_kllk3", jSONObject, r, true);
zc(r, jSONObject, -1, 7, sb.toString());
} catch (Exception unused) {
com.ss.android.downloadad.api.g.zc zcVar2 = r.r;
if (zcVar2 != null) {
zcVar2.nk(false);
}
com.ss.android.downloadlib.zc.g.g(g(com.ss.android.downloadlib.addownload.il.getContext(), Uri.parse("market://details?id=".concat(String.valueOf(str))), r), r, true);
zc(r, jSONObject, 2, 7, "market://details?id=".concat(String.valueOf(str)));
}
}
private static boolean g(@NonNull Activity activity, @NonNull String str, @NonNull HashMap<String, String> hashMap) {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse("market://details?id=".concat(String.valueOf(str))));
intent.putExtra("start_only_for_android", true);
intent.putExtra("param", hashMap);
String zy = com.ss.android.socialbase.appdownloader.fy.r.zy();
if (nr.r(com.ss.android.downloadlib.addownload.il.getContext(), zy)) {
intent.setPackage(zy);
}
if (nr.g(com.ss.android.downloadlib.addownload.il.getContext(), intent)) {
try {
activity.startActivity(intent);
return true;
} catch (Exception e) {
com.ss.android.downloadlib.r.i.g().g(e, "start v1");
return false;
}
}
return false;
}
public static void g(@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.zc.r r = com.ss.android.downloadlib.addownload.zc.fy.g().r(j);
try {
JSONObject gj = com.ss.android.downloadlib.addownload.il.gj();
boolean g = com.ss.android.socialbase.appdownloader.fy.g.g(gj, activity, com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("bg"), gj.optString(com.kuaishou.weapon.p0.t.g)));
HashMap<String, String> zc = nr.zc(new JSONObject(str2));
if (g && !zc.isEmpty() && g(activity, str, zc)) {
zc(r, jSONObject, -1, 5, "market://details?id=".concat(String.valueOf(str)));
com.ss.android.downloadlib.zc.g.g("am_v1", jSONObject, r, true);
return;
}
if (g) {
i = zc.isEmpty() ? 1 : 2;
} else {
i = 3;
}
zc(r, jSONObject, i, 5, "market://details?id=".concat(String.valueOf(str)));
com.ss.android.downloadlib.zc.g.g(g((Context) activity, Uri.parse("market://details?id=".concat(String.valueOf(str)))), r, true);
} catch (Exception unused2) {
com.ss.android.downloadlib.zc.g.g(g(com.ss.android.downloadlib.addownload.il.getContext(), Uri.parse("market://details?id=".concat(String.valueOf(str)))), r, true);
zc(r, jSONObject, 4, 5, "market://details?id=".concat(String.valueOf(str)));
}
}
public static void g(@NonNull Activity activity, String str, long j, String str2) {
com.ss.android.downloadlib.addownload.zc.r r = com.ss.android.downloadlib.addownload.zc.fy.g().r(j);
JSONObject jSONObject = new JSONObject();
JSONObject gj = com.ss.android.downloadlib.addownload.il.gj();
String g = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("bv"), gj.optString(com.kuaishou.weapon.p0.t.g));
Uri.Builder builder = new Uri.Builder();
builder.scheme("market").authority("details").appendQueryParameter("id", str);
if (!TextUtils.isEmpty(g)) {
builder.appendQueryParameter(g, str2);
}
if (g(activity, builder.build())) {
zc(r, jSONObject, -1, 8, "market://details?id=".concat(String.valueOf(str)));
com.ss.android.downloadlib.zc.g.g("am_v2", jSONObject, r, true);
return;
}
zc(r, jSONObject, 2, 8, "market://details?id=".concat(String.valueOf(str)));
com.ss.android.downloadlib.zc.g.g(g((Context) activity, Uri.parse("market://details?id=".concat(String.valueOf(str)))), r, true);
}
public static boolean g(@NonNull Activity activity, Uri uri) {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(uri);
intent.putExtra("start_only_for_android", true);
String zy = com.ss.android.socialbase.appdownloader.fy.r.zy();
if (nr.r(com.ss.android.downloadlib.addownload.il.getContext(), zy)) {
intent.setPackage(zy);
}
if (nr.g(com.ss.android.downloadlib.addownload.il.getContext(), intent)) {
try {
activity.startActivity(intent);
return true;
} catch (Exception e) {
com.ss.android.downloadlib.r.i.g().g(e, "start v2");
return false;
}
}
return false;
}
public static com.ss.android.downloadlib.addownload.zc.e g(Context context, String str, com.ss.android.downloadad.api.g.g gVar) {
Intent e = nr.e(context, str);
if (e == null) {
return new com.ss.android.downloadlib.addownload.zc.e(4, 22);
}
if (Build.VERSION.SDK_INT >= 26 && com.ss.android.downloadlib.addownload.il.gj().optInt("open_package_mode") == 1 && com.ss.android.downloadlib.addownload.il.nr() != null && com.ss.android.downloadlib.addownload.il.nr().g() && gVar.ro()) {
TTDelegateActivity.zc(str, gVar);
return new com.ss.android.downloadlib.addownload.zc.e(3);
}
e.putExtra("start_only_for_android", true);
try {
context.startActivity(e);
return new com.ss.android.downloadlib.addownload.zc.e(3);
} catch (Exception unused) {
return new com.ss.android.downloadlib.addownload.zc.e(4, 23);
}
}
static com.ss.android.downloadlib.addownload.zc.e g(String str, com.ss.android.downloadad.api.g.g gVar) {
return g(com.ss.android.downloadlib.addownload.il.getContext(), str, gVar);
}
public static com.ss.android.downloadlib.addownload.zc.e g(@NonNull com.ss.android.downloadad.api.g.zc zcVar, String str, String str2) {
com.ss.android.downloadlib.addownload.zc.e zc = zc(str, zcVar);
return (com.ss.android.downloadlib.zc.fy.g(zcVar) && zc.getType() == 2) ? g(str2, zcVar) : zc;
}
public static void g(@NonNull Activity activity, String str, long j) {
com.ss.android.downloadlib.addownload.zc.r r = com.ss.android.downloadlib.addownload.zc.fy.g().r(j);
JSONObject jSONObject = new JSONObject();
JSONObject gj = com.ss.android.downloadlib.addownload.il.gj();
String optString = gj.optString(com.kuaishou.weapon.p0.t.g);
String g = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("ca"), optString);
String g2 = com.ss.android.socialbase.appdownloader.fy.i.g(gj.optString("cc"), optString);
StringBuilder sb = new StringBuilder("market://details?id=");
if (!TextUtils.isEmpty(g) && !TextUtils.isEmpty(g2)) {
sb.append(str);
sb.append("&");
sb.append(g);
sb.append("=");
sb.append(g2);
}
if (i(activity, Uri.parse(sb.toString()))) {
zc(r, jSONObject, -1, 10, "market://details?id=".concat(String.valueOf(str)));
com.ss.android.downloadlib.zc.g.g("am_hr2", jSONObject, r, true);
return;
}
zc(r, jSONObject, 2, 10, "market://details?id=".concat(String.valueOf(str)));
com.ss.android.downloadlib.zc.g.g(g((Context) activity, Uri.parse("market://details?id=".concat(String.valueOf(str)))), r, true);
}
}