BRXT v5.6.8版本的 MD5 值为:caa0615cd5f4a3ae4ac8e2f0f9e0bebe
以下内容为反编译后的 a.java 源代码,内容仅作参考
package io.dcloud.f.a;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import android.widget.CheckBox;
import io.dcloud.PdrR;
import io.dcloud.common.DHInterface.AbsMgr;
import io.dcloud.common.DHInterface.IActivityHandler;
import io.dcloud.common.DHInterface.IApp;
import io.dcloud.common.DHInterface.ICallBack;
import io.dcloud.common.DHInterface.ICore;
import io.dcloud.common.DHInterface.IDCloudWebviewClientListener;
import io.dcloud.common.DHInterface.IMgr;
import io.dcloud.common.DHInterface.ISysEventListener;
import io.dcloud.common.DHInterface.IWebview;
import io.dcloud.common.DHInterface.IWebviewStateListener;
import io.dcloud.common.adapter.io.DHFile;
import io.dcloud.common.adapter.io.UnicodeInputStream;
import io.dcloud.common.adapter.ui.webview.WebResUtil;
import io.dcloud.common.adapter.util.DeviceInfo;
import io.dcloud.common.adapter.util.Logger;
import io.dcloud.common.adapter.util.PlatformUtil;
import io.dcloud.common.adapter.util.SP;
import io.dcloud.common.constant.AbsoluteConst;
import io.dcloud.common.constant.DOMException;
import io.dcloud.common.constant.DataInterface;
import io.dcloud.common.constant.IntentConst;
import io.dcloud.common.constant.StringConst;
import io.dcloud.common.util.AppRuntime;
import io.dcloud.common.util.BaseInfo;
import io.dcloud.common.util.CheckSignatureUtil;
import io.dcloud.common.util.DataUtil;
import io.dcloud.common.util.DialogUtil;
import io.dcloud.common.util.IOUtil;
import io.dcloud.common.util.JSONUtil;
import io.dcloud.common.util.PdrUtil;
import io.dcloud.common.util.StringUtil;
import io.dcloud.common.util.ThreadPool;
import io.dcloud.feature.internal.sdk.SDK;
import io.src.dcloud.adapter.DCloudAdapterUtil;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public final class a extends AbsMgr implements IMgr.AppEvent {
private static String j;
io.dcloud.f.a.d a;
ArrayList<String> b;
ArrayList<io.dcloud.f.a.e> c;
io.dcloud.f.a.c d;
private JSONObject e;
private AlertDialog f;
JSONObject g;
private AlertDialog h;
private AlertDialog i;
public class C0028a implements ICallBack {
C0028a(a aVar) {
}
@Override
public Object onCallBack(int i, Object obj) {
String unused = a.j = String.valueOf(obj);
return null;
}
}
public class b implements Runnable {
final Context a;
b(a aVar, Context context) {
this.a = context;
}
@Override
public void run() {
String str = "uni-jsframework-dev.js";
try {
BaseInfo.uniVersionV3 = new JSONObject(new BufferedReader(new InputStreamReader(this.a.getAssets().open((!BaseInfo.SyncDebug || PlatformUtil.getResInputStream("uni-jsframework-dev.js") == null || SDK.isUniMPSDK()) ? "uni-jsframework.js" : "uni-jsframework.js"))).readLine().substring(2)).optString("version");
} catch (Exception unused) {
}
}
}
public class c implements DialogInterface.OnClickListener {
final Activity a;
final String b;
final io.dcloud.f.a.e c;
final CheckBox d;
final String e;
final io.dcloud.f.a.e f;
final io.dcloud.f.a.e g;
final boolean h;
c(Activity activity, String str, io.dcloud.f.a.e eVar, CheckBox checkBox, String str2, io.dcloud.f.a.e eVar2, io.dcloud.f.a.e eVar3, boolean z) {
this.a = activity;
this.b = str;
this.c = eVar;
this.d = checkBox;
this.e = str2;
this.f = eVar2;
this.g = eVar3;
this.h = z;
}
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (i != -2) {
if (i != -3 && i == -1) {
if (this.d.isChecked()) {
SP.setBundleData(this.a, "pdr", AbsoluteConst.TEST_RUN + this.b, "__am=t");
}
a.this.a(this.a, this.b, this.e, this.c, this.f, this.g, this.h);
a.this.f.dismiss();
return;
}
return;
}
a.this.f.dismiss();
IActivityHandler iActivityHandler = DCloudAdapterUtil.getIActivityHandler(this.a);
if (iActivityHandler != null) {
iActivityHandler.closeAppStreamSplash(this.b);
BaseInfo.setLoadingLaunchePage(false, "closeSplashScreen0");
if (a.this.d.e() == 0) {
this.a.finish();
return;
}
io.dcloud.f.a.e eVar = this.c;
if (eVar != null) {
eVar.w();
}
Intent intent = new Intent("android.intent.action.MAIN");
intent.addCategory("android.intent.category.HOME");
this.a.startActivity(intent);
}
}
}
public class d implements DialogInterface.OnClickListener {
final Activity a;
d(a aVar, Activity activity) {
this.a = activity;
}
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(Uri.parse("http://ask.dcloud.net.cn/article/35627"));
this.a.startActivity(intent);
}
}
public class e implements DialogInterface.OnClickListener {
final Activity a;
e(a aVar, Activity activity) {
this.a = activity;
}
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(Uri.parse("https://ask.dcloud.net.cn/article/35877"));
this.a.startActivity(intent);
}
}
public class f implements ICallBack {
final io.dcloud.f.a.e a;
final boolean b;
final String c;
f(a aVar, io.dcloud.f.a.e eVar, boolean z, String str) {
this.a = eVar;
this.b = z;
this.c = str;
}
@Override
public Object onCallBack(int i, Object obj) {
if (this.a.a(this.b)) {
return null;
}
Logger.e(Logger.AppMgr_TAG, "reboot " + this.c + " app failed !!!");
return null;
}
}
public class g implements ICallBack {
final boolean a;
final io.dcloud.f.a.e b;
final String c;
final String d;
g(boolean z, io.dcloud.f.a.e eVar, String str, String str2) {
this.a = z;
this.b = eVar;
this.c = str;
this.d = str2;
}
@Override
public Object onCallBack(int i, Object obj) {
int i2;
if (BaseInfo.s_Runing_App_Count_Trim <= a.this.d.e() && (i2 = BaseInfo.s_Runing_App_Count_Trim) > 0 && i2 < BaseInfo.s_Runing_App_Count_Max) {
a.this.e();
}
boolean f = this.a ? this.b.f(this.c) : this.b.g(this.c);
io.dcloud.f.a.e eVar = this.b;
if (!eVar.r && eVar.q) {
eVar.f(this.c);
}
if (f) {
a.this.d.a(this.d, this.b);
return null;
}
Logger.e(Logger.AppMgr_TAG, this.d + " run failed!!!");
return null;
}
}
class h implements Runnable {
h(a aVar) {
}
@Override
public void run() {
try {
DHFile.deleteFile(StringConst.STREAMAPP_KEY_ROOTPATH + "splash_temp/");
} catch (Exception e) {
e.printStackTrace();
}
}
}
public a(ICore iCore) {
super(iCore, Logger.AppMgr_TAG, IMgr.MgrType.AppMgr);
this.a = null;
this.b = new ArrayList<>(1);
this.c = new ArrayList<>(1);
this.d = null;
this.e = null;
this.g = null;
if (iCore != null) {
a(iCore.obtainContext());
}
c();
b();
d();
a();
InputStream resInputStream = PlatformUtil.getResInputStream(BaseInfo.sApiConfigPath);
if (resInputStream != null) {
try {
this.e = new JSONObject(new String(IOUtil.getBytes(new UnicodeInputStream(resInputStream, Charset.defaultCharset().name()))));
} catch (IOException e2) {
e2.printStackTrace();
} catch (JSONException e3) {
e3.printStackTrace();
} catch (Exception e4) {
e4.printStackTrace();
}
}
this.d = new io.dcloud.f.a.c(this);
}
private void d(io.dcloud.f.a.e eVar) {
Object newInstance = PlatformUtil.newInstance("android.app.ActivityManager$TaskDescription", new Class[]{String.class, Bitmap.class}, new Object[]{eVar.obtainAppName(), BitmapFactory.decodeResource(getContext().getResources(), getContext().getApplicationInfo().icon)});
PlatformUtil.invokeMethod(eVar.getActivity(), "setTaskDescription", new Class[]{newInstance.getClass()}, newInstance);
}
public void e() {
ArrayList<io.dcloud.f.a.e> f2 = this.d.f();
if (f2 == null || f2.size() < BaseInfo.s_Runing_App_Count_Trim) {
return;
}
int size = f2.size();
for (int i = size - BaseInfo.s_Runing_App_Count_Trim; i >= 0 && i > size - BaseInfo.s_Runing_App_Count_Max; i--) {
io.dcloud.f.a.e eVar = f2.get(i);
eVar.callSysEventListener(ISysEventListener.SysEventType.onWebAppTrimMemory, eVar);
}
}
io.dcloud.f.a.e c(String str) {
return a((Activity) null, str);
}
@Override
public void dispose() {
ArrayList<io.dcloud.f.a.e> arrayList = this.c;
if (arrayList != null) {
Iterator<io.dcloud.f.a.e> it = arrayList.iterator();
while (it.hasNext()) {
it.next().g();
}
}
this.c.clear();
this.b.clear();
io.dcloud.f.a.c cVar = this.d;
if (cVar != null) {
cVar.a();
}
this.d = null;
ThreadPool.self().addThreadTask(new h(this));
}
@Override
public Object processEvent(IMgr.MgrType mgrType, int i, Object obj) {
io.dcloud.f.a.e eVar;
io.dcloud.f.a.e eVar2;
io.dcloud.f.a.e a;
boolean a2;
Object valueOf;
int intValue;
String str;
io.dcloud.f.a.e a3;
Object[] objArr;
io.dcloud.f.a.e a4;
byte b2;
io.dcloud.f.a.e b3;
String str2;
int i2;
Intent intent;
String str3;
try {
} catch (Throwable th) {
th = th;
eVar = null;
}
if (!checkMgrId(mgrType)) {
r12 = this.mCore.dispatchEvent(mgrType, i, obj);
} else {
boolean z = true;
switch (i) {
case 0:
Object[] objArr2 = (Object[]) obj;
Activity activity = (Activity) objArr2[0];
String valueOf2 = String.valueOf(objArr2[1]);
String valueOf3 = String.valueOf(objArr2[2]);
Log.i("ylyl", " AppMGr START_APP " + valueOf2);
Logger.e("appMgr", "START_APP" + valueOf2);
io.dcloud.f.a.e a5 = a(activity, valueOf2);
boolean isEmpty = TextUtils.isEmpty(a5.m0);
if (a5 != null) {
io.dcloud.f.a.e b4 = this.d.b();
io.dcloud.f.a.e a6 = this.d.a(activity, a5);
if (a6 == null || ((a6 != null && a6 != a5) || a5.q)) {
if (a5.q()) {
boolean z2 = a6 == null;
String bundleData = SP.getBundleData(activity, "pdr", AbsoluteConst.TEST_RUN + valueOf2);
if (!TextUtils.isEmpty(bundleData)) {
if (bundleData.equals("popped")) {
SP.removeBundleData(activity, "pdr", AbsoluteConst.TEST_RUN + valueOf2);
}
z2 = false;
}
boolean booleanExtra = !a5.q ? activity.getIntent().getBooleanExtra(IntentConst.IS_START_FIRST_WEB, false) : false;
if (!a5.n() && z2 && !booleanExtra && a5.p == 1) {
AlertDialog alertDialog = this.f;
if (alertDialog != null && alertDialog.isShowing()) {
this.f.dismiss();
}
AlertDialog create = DialogUtil.initDialogTheme(activity, true).create();
this.f = create;
create.setCanceledOnTouchOutside(false);
CheckBox checkBox = new CheckBox(activity);
checkBox.setText("信任此应用,不再提示");
checkBox.setTextColor(-65536);
this.f.setMessage("当前应用为开发者测试版本,未经审核,可能存在安全隐患");
this.f.setView(checkBox, DeviceInfo.getDeivceSuitablePixel(activity, 20), 0, 0, 0);
c cVar = new c(activity, valueOf2, b4, checkBox, valueOf3, a5, a6, isEmpty);
this.f.setButton(-2, activity.getResources().getString(17039360), cVar);
this.f.setButton(-1, activity.getResources().getString(17039370), cVar);
Logger.e("yl", "test show ");
this.f.show();
} else {
a(activity, valueOf2, valueOf3, b4, a5, a6, isEmpty);
}
} else {
a(activity, valueOf2, valueOf3, b4, a5, a6, isEmpty);
if (a5.o()) {
AlertDialog alertDialog2 = this.h;
if (alertDialog2 != null && alertDialog2.isShowing()) {
this.h.dismiss();
}
AlertDialog create2 = new AlertDialog.Builder(activity, PdrR.FEATURE_LOSS_STYLE).setTitle("HTML5+ Runtime").setIcon(17301659).setMessage(String.format("本应用使用HBuilderX %s 或对应的cli版本编译,而手机端SDK版本是 %s。不匹配的版本可能造成应用异常。", a5.obtainConfigProperty(AbsoluteConst.APP_UNIAPP_VERSION), BaseInfo.uniVersionV3)).setPositiveButton("查看详情", new d(this, activity)).setNegativeButton("忽略", (DialogInterface.OnClickListener) null).create();
this.h = create2;
create2.setCanceledOnTouchOutside(false);
this.h.show();
}
if (!PlatformUtil.checkClass("io.dcloud.feature.weex.WeexFeature") && BaseInfo.isUniAppAppid(a5) && BaseInfo.isWeexUniJs(a5)) {
AlertDialog alertDialog3 = this.i;
if (alertDialog3 != null && alertDialog3.isShowing()) {
this.i.dismiss();
}
AlertDialog create3 = new AlertDialog.Builder(activity, PdrR.FEATURE_LOSS_STYLE).setTitle("HTML5+ Runtime").setIcon(17301659).setMessage("当前环境无法运行启用“自定义组件模式”的uni-app应用!").setPositiveButton("查看详情", new e(this, activity)).setNegativeButton("忽略", (DialogInterface.OnClickListener) null).create();
this.i = create3;
create3.setCanceledOnTouchOutside(false);
this.i.show();
}
}
}
} else {
Logger.e(Logger.AppMgr_TAG, "not found " + valueOf2 + " app!!! 检测manifest.json里appid是否与control.xml中配置项符合");
}
return a5;
case 1:
Object[] objArr3 = (Object[]) obj;
if (objArr3[2] instanceof IApp) {
a = (io.dcloud.f.a.e) objArr3[2];
} else {
a = a(String.valueOf(objArr3[2]), false);
}
if (BaseInfo.sRuntimeMode == null && a == null && !io.dcloud.f.a.e.a((ISysEventListener.SysEventType) objArr3[0])) {
a2 = false;
if (!a2 && a != null && ((ISysEventListener.SysEventType) objArr3[0]).equals(ISysEventListener.SysEventType.onKeyUp)) {
intValue = ((Integer) ((Object[]) objArr3[1])[0]).intValue();
String str4 = (String) objArr3[2];
if (intValue == 4) {
processEvent(IMgr.MgrType.WindowMgr, 20, a);
valueOf = Boolean.valueOf(z);
r12 = valueOf;
break;
}
}
z = a2;
valueOf = Boolean.valueOf(z);
r12 = valueOf;
}
a2 = this.d.a(a, (ISysEventListener.SysEventType) objArr3[0], objArr3[1]);
if (!a2) {
intValue = ((Integer) ((Object[]) objArr3[1])[0]).intValue();
String str42 = (String) objArr3[2];
if (intValue == 4) {
}
}
z = a2;
valueOf = Boolean.valueOf(z);
r12 = valueOf;
case 2:
String valueOf4 = String.valueOf(obj);
if (PdrUtil.isDeviceRootDir(valueOf4)) {
int indexOf = valueOf4.indexOf(BaseInfo.sBaseFsAppsPath);
if (indexOf >= 0) {
String substring = valueOf4.substring(indexOf + BaseInfo.sBaseFsAppsPath.length());
str = substring.substring(0, substring.indexOf("/"));
} else {
str = null;
}
r12 = TextUtils.isEmpty(str) ? null : WebResUtil.getEncryptionInputStream(valueOf4, c(str));
if (r12 == null) {
valueOf = DHFile.getInputStream(DHFile.createFileHandler(valueOf4));
r12 = valueOf;
break;
}
} else {
io.dcloud.f.a.e c2 = c(this.d.b().m);
if (valueOf4.startsWith(AbsoluteConst.MINI_SERVER_APP_WWW)) {
if (c2 != null) {
valueOf = c2.obtainResInStream(valueOf4);
r12 = valueOf;
}
} else if (valueOf4.startsWith(AbsoluteConst.MINI_SERVER_APP_DOC)) {
valueOf = DHFile.getInputStream(DHFile.createFileHandler(c2.obtainAppDocPath() + valueOf4.substring(5)));
r12 = valueOf;
}
}
break;
case 3:
String valueOf5 = String.valueOf(obj);
if ("snc:CID".equals(valueOf5)) {
a3 = this.d.b();
} else {
a3 = a(valueOf5, true);
}
a(a3, valueOf5, false);
break;
case 4:
Object[] objArr4 = (Object[]) obj;
String valueOf6 = String.valueOf(objArr4[0]);
JSONObject jSONObject = (JSONObject) objArr4[1];
IWebview iWebview = (IWebview) objArr4[2];
String string = JSONUtil.getString(jSONObject, "appid");
if (Boolean.parseBoolean(JSONUtil.getString(jSONObject, AbsoluteConst.INSTALL_OPTIONS_RECOGNISE)) && !TextUtils.isEmpty(valueOf6) && !valueOf6.toLowerCase().endsWith(".wgtu") && !valueOf6.toLowerCase().endsWith(".wgt") && !CheckSignatureUtil.check(valueOf6)) {
Object[] objArr5 = new Object[2];
objArr5[0] = Boolean.TRUE;
objArr5[1] = StringUtil.format(DOMException.JSON_ERROR_INFO, 10, "校验不通过!");
return objArr5;
}
if (PdrUtil.isEmpty(string)) {
string = iWebview.obtainFrameView().obtainApp().obtainAppId();
}
long currentTimeMillis = System.currentTimeMillis();
Logger.d(Logger.AppMgr_TAG, "install begin _filePath = " + valueOf6 + ";_mayBeAppid = " + string);
io.dcloud.f.a.e a7 = a(valueOf6, string, jSONObject);
Logger.d(Logger.AppMgr_TAG, "install end useTime=" + (System.currentTimeMillis() - currentTimeMillis));
objArr = new Object[]{Boolean.valueOf(a7.n.a), a7.n.b};
return objArr;
case 5:
io.dcloud.f.a.e c3 = c(String.valueOf(obj));
if (c3 != null) {
valueOf = c3.v();
r12 = valueOf;
break;
}
break;
case 6:
valueOf = c(String.valueOf(obj));
r12 = valueOf;
break;
case 7:
String str5 = (String) obj;
if (this.a == null) {
this.a = new io.dcloud.f.a.d(this);
}
this.a.a(str5);
Logger.d(Logger.AppMgr_TAG, "data=" + str5);
break;
case 8:
String[] strArr = (String[]) obj;
valueOf = a(strArr[0], strArr[1], strArr[2], Byte.parseByte(strArr[3]));
r12 = valueOf;
break;
case 9:
Object[] objArr6 = (Object[]) obj;
IApp iApp = (IApp) objArr6[0];
IWebviewStateListener iWebviewStateListener = (IWebviewStateListener) objArr6[1];
if (objArr6.length > 2) {
IDCloudWebviewClientListener iDCloudWebviewClientListener = (IDCloudWebviewClientListener) objArr6[2];
if (!PdrUtil.isEmpty(iDCloudWebviewClientListener)) {
valueOf = ((io.dcloud.f.a.e) iApp).a(iWebviewStateListener, iDCloudWebviewClientListener);
}
} else {
valueOf = ((io.dcloud.f.a.e) iApp).a(iWebviewStateListener);
}
r12 = valueOf;
break;
case 10:
if (obj instanceof String) {
a4 = a(String.valueOf(obj), false);
} else if (obj instanceof io.dcloud.f.a.e) {
a4 = (io.dcloud.f.a.e) obj;
} else {
a4 = obj instanceof Map ? a((String) ((Map) obj).get("appid"), false) : null;
}
if (a4 != null) {
a4.u();
break;
}
break;
case 11:
if (this.d.b() != null) {
eVar2 = this.d.b().m;
return eVar2;
}
break;
case 12:
io.dcloud.f.a.e a8 = a((String) obj, false);
if (a8 != null) {
byte b5 = a8.p;
if (b5 == 3) {
byte b6 = a8.p() ? a8.p : (byte) 2;
a8.p = b6;
b2 = Byte.valueOf(b6);
} else {
b2 = Byte.valueOf(b5);
}
} else {
b2 = (byte) 1;
}
eVar2 = b2;
return eVar2;
case 13:
io.dcloud.f.a.e eVar3 = (io.dcloud.f.a.e) obj;
if (eVar3 != null) {
eVar2 = Boolean.valueOf(eVar3.r());
return eVar2;
}
return AbsoluteConst.FALSE;
case 14:
String valueOf7 = String.valueOf(obj);
if (valueOf7.endsWith("/")) {
valueOf7 = valueOf7.substring(0, valueOf7.length() - 1);
}
String substring2 = valueOf7.substring(valueOf7.lastIndexOf("/") + 1);
if (b(substring2)) {
b3 = c(substring2);
} else {
b3 = b(valueOf7, substring2);
}
eVar = b3;
if (!eVar.n.a) {
try {
c(eVar);
eVar2 = eVar;
} catch (Throwable th2) {
th = th2;
Logger.w("AppMgr.processEvent", th);
eVar2 = eVar;
return eVar2;
}
return eVar2;
}
break;
case 15:
Object[] objArr7 = (Object[]) obj;
IApp iApp2 = (IApp) objArr7[0];
String str6 = (String) objArr7[1];
String str7 = (String) objArr7[2];
String str8 = (String) objArr7[3];
boolean a9 = ((io.dcloud.f.a.e) iApp2).a(str6, str7);
String str9 = "";
if (this.e != null) {
if (!TextUtils.isEmpty(str8)) {
str6 = str6 + "-" + str8;
}
JSONArray optJSONArray = this.e.optJSONArray(str6);
if (optJSONArray != null) {
while (i2 < optJSONArray.length()) {
JSONObject optJSONObject = optJSONArray.optJSONObject(i2);
String optString = optJSONObject.optString("action");
i2 = ("*".equals(optString) || PdrUtil.isEquals(str7, optString)) ? 0 : i2 + 1;
str9 = optJSONObject.optString(AbsoluteConst.STREAMAPP_UPD_DESC);
str2 = str6 + "_" + optString;
objArr = new String[]{String.valueOf(!a9), String.format(str9, iApp2.obtainAppName()), str2};
return objArr;
break;
}
str2 = null;
objArr = new String[]{String.valueOf(!a9), String.format(str9, iApp2.obtainAppName()), str2};
return objArr;
}
}
str2 = null;
a9 = true;
objArr = new String[]{String.valueOf(!a9), String.format(str9, iApp2.obtainAppName()), str2};
return objArr;
case 16:
Object[] objArr8 = (Object[]) obj;
((io.dcloud.f.a.e) ((IApp) objArr8[0])).a((String) objArr8[1], 1);
break;
case 19:
valueOf = this.d.c();
r12 = valueOf;
break;
case 20:
case 21:
if (obj instanceof String) {
str3 = (String) obj;
intent = null;
} else {
Object[] objArr9 = (Object[]) obj;
Activity activity2 = (Activity) objArr9[0];
intent = (Intent) objArr9[1];
str3 = (String) objArr9[2];
}
io.dcloud.f.a.e a10 = this.d.a(str3);
r12 = Boolean.TRUE;
if (a10 != null) {
io.dcloud.f.a.e b7 = this.d.b();
if (b7 != a10) {
if (b7 != null) {
b7.w();
}
if (intent != null) {
a10.setWebAppIntent(intent);
} else {
intent = a10.obtainWebAppIntent();
}
if (21 == i) {
intent.putExtra(IntentConst.IS_WEBAPP_REPLY, true);
}
a10.getActivity().setIntent(intent);
Logger.d(Logger.AppMgr_TAG, str3 + " will unactive change to active STREAM_START_APP");
if (a10.p == 2) {
a10.c();
break;
}
}
} else {
valueOf = Boolean.FALSE;
r12 = valueOf;
break;
}
break;
case 24:
valueOf = j;
r12 = valueOf;
break;
case 27:
io.dcloud.f.a.e b8 = this.d.b();
if (b8 != null) {
a(b8, (String) null, true);
break;
} else {
Logger.e(Logger.AppMgr_TAG, "not app!!!");
break;
}
case 28:
if (this.d.b() != null) {
valueOf = this.d.b();
} else {
valueOf = a((String) obj, false);
}
r12 = valueOf;
break;
}
}
return r12;
}
void b() {
io.dcloud.f.a.e b2;
io.dcloud.f.a.g gVar;
HashMap<String, BaseInfo.BaseAppInfo> hashMap = BaseInfo.mBaseAppInfoSet;
if (hashMap == null || hashMap.isEmpty()) {
return;
}
Set<String> keySet = BaseInfo.mBaseAppInfoSet.keySet();
int size = keySet.size();
String[] strArr = new String[size];
keySet.toArray(strArr);
for (int i = 0; i < size; i++) {
String str = strArr[i];
BaseInfo.BaseAppInfo baseAppInfo = BaseInfo.mBaseAppInfoSet.get(str);
if (!BaseInfo.mUnInstalledAppInfoSet.containsKey(str) && !b(str) && (b2 = b(BaseInfo.sBaseResAppsPath + str, str)) != null && (gVar = b2.n) != null) {
if (!gVar.a) {
b2.o = baseAppInfo;
c(b2);
} else {
Logger.e("AppMgr", str + " app error," + b2.n);
}
}
}
}
void c(io.dcloud.f.a.e eVar) {
this.b.add(eVar.obtainAppId());
this.c.add(eVar);
}
private void a() {
if (PdrUtil.isEmpty(j)) {
DataUtil.datToJsString(BaseInfo.sUniNViewServiceJsPath, new C0028a(this));
}
}
void c() {
io.dcloud.f.a.g gVar;
HashMap<String, BaseInfo.BaseAppInfo> hashMap = BaseInfo.mInstalledAppInfoSet;
if (hashMap == null || hashMap.isEmpty()) {
return;
}
Set<String> keySet = BaseInfo.mInstalledAppInfoSet.keySet();
int size = keySet.size();
String[] strArr = new String[size];
keySet.toArray(strArr);
boolean z = false;
for (int i = 0; i < size; i++) {
String str = strArr[i];
if (!BaseInfo.mUnInstalledAppInfoSet.containsKey(str) && !b(str)) {
io.dcloud.f.a.e b2 = b(BaseInfo.sCacheFsAppsPath + str, str);
if (b2 != null && (gVar = b2.n) != null && !gVar.a) {
b2.deleteAppTemp();
if (SDK.isUniMPSDK()) {
b2.e0 = true;
} else {
b2.e0 = false;
}
c(b2);
} else {
BaseInfo.mInstalledAppInfoSet.get(str).clearBundleData();
BaseInfo.mInstalledAppInfoSet.remove(str);
z = true;
}
}
}
if (z) {
BaseInfo.saveInstalledAppInfo(getContext());
}
}
private void a(Context context) {
if (TextUtils.isEmpty(BaseInfo.uniVersionV3)) {
ThreadPool.self().addThreadTask(new b(this, context), true);
}
}
void d() {
File file = new File(BaseInfo.sURDFilePath);
if (!file.exists()) {
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
DHFile.copyAssetsFile("data/dcloud_url.json", file.getAbsolutePath());
}
if (file.exists()) {
try {
this.g = new JSONObject(new String(DHFile.readAll(file)));
} catch (JSONException e2) {
e2.printStackTrace();
}
}
}
private void a(io.dcloud.f.a.e eVar, String str, boolean z) {
if (eVar != null) {
String obtainConfigProperty = eVar.obtainConfigProperty(IApp.ConfigProperty.CONFIG_UNIAPP_CONTROL);
if (!TextUtils.isEmpty(obtainConfigProperty) && obtainConfigProperty.equals(AbsoluteConst.UNI_V3)) {
BaseInfo.isFirstRun = false;
eVar.showSplash();
AppRuntime.restartWeex(eVar.getActivity().getApplication(), new f(this, eVar, z, str), eVar.m);
return;
} else if (eVar.a(z)) {
return;
} else {
Logger.e(Logger.AppMgr_TAG, "reboot " + str + " app failed !!!");
return;
}
}
Logger.e(Logger.AppMgr_TAG, "not found " + str + " app!!!");
}
public void e(io.dcloud.f.a.e eVar) {
this.d.b(eVar.m);
b(eVar);
}
void b(io.dcloud.f.a.e eVar) {
this.b.remove(eVar.m);
this.c.remove(eVar);
}
private boolean b(String str) {
return this.b.contains(str);
}
private io.dcloud.f.a.e b(String str, String str2) {
return a(str, str2);
}
private void a(io.dcloud.f.a.e eVar) {
if (SDK.isUniMPSDK() && SDK.isEnableBackground) {
d(eVar);
}
}
public void a(Activity activity, String str, String str2, io.dcloud.f.a.e eVar, io.dcloud.f.a.e eVar2, io.dcloud.f.a.e eVar3, boolean z) {
Log.i("ylyl", "startOneApp " + str);
BaseInfo.sLastRunApp = str;
BaseInfo.CmtInfo cmitInfo = BaseInfo.getCmitInfo(str);
if (cmitInfo.needUpdate) {
cmitInfo.templateVersion = eVar2.y;
cmitInfo.rptCrs = eVar2.H;
cmitInfo.rptJse = eVar2.I;
cmitInfo.plusLauncher = BaseInfo.getLaunchType(eVar2.obtainWebAppIntent());
cmitInfo.sfd = DataInterface.getStreamappFrom(eVar2.obtainWebAppIntent());
cmitInfo.needUpdate = false;
}
if (eVar2.p == 3) {
eVar2.p = eVar2.p() ? eVar2.p : (byte) 2;
}
if (eVar != null && eVar != eVar2 && eVar != eVar3) {
eVar.w();
}
byte b2 = eVar2.p;
if (b2 == 1 || ((z && !eVar2.r) || ((eVar2.s && eVar2.q) || !z))) {
Logger.d(Logger.AppMgr_TAG, str + " will unrunning change to active");
eVar2.a(activity);
processEvent(IMgr.MgrType.WindowMgr, 4, new Object[]{eVar2, str});
eVar2.a(new g(z, eVar2, str2, str));
} else if (b2 == 2) {
Logger.d(Logger.AppMgr_TAG, str + " will unactive change to active");
eVar2.c();
} else {
Logger.d(Logger.AppMgr_TAG, str + " is active");
}
if (SDK.isUniMPSDK() && Build.VERSION.SDK_INT >= 21) {
a(eVar2);
}
if (eVar3 == null || eVar3 == eVar2) {
return;
}
eVar3.u();
}
io.dcloud.f.a.e a(Activity activity, String str) {
return a(activity, str, true);
}
private io.dcloud.f.a.e a(String str, boolean z) {
return a((Activity) null, str, z);
}
private io.dcloud.f.a.e a(Activity activity, String str, boolean z) {
int indexOf;
io.dcloud.f.a.e eVar = (!this.b.contains(str) || (indexOf = this.b.indexOf(str)) < 0) ? null : this.c.get(indexOf);
if (eVar == null && z) {
eVar = new io.dcloud.f.a.e(this, str, (byte) 0);
eVar.setAppDataPath(BaseInfo.sCacheFsAppsPath + str + DeviceInfo.sSeparatorChar + BaseInfo.REAL_PRIVATE_WWW_DIR);
if (eVar.a == null) {
eVar.a = activity;
}
if (activity != null) {
eVar.setWebAppIntent(activity.getIntent());
}
eVar.b(str, (JSONObject) null);
if (eVar.n.a) {
eVar.m = str;
}
c(eVar);
} else if (eVar != null && activity != null) {
if (eVar.a == null) {
eVar.a = activity;
}
if (eVar.a.getIntent() != null) {
if (eVar.manifestBeParsed()) {
eVar.setWebAppIntent(eVar.a.getIntent());
}
} else {
eVar.a.setIntent(eVar.obtainWebAppIntent());
}
if (!eVar.q) {
eVar.b(str, (JSONObject) null);
}
}
return eVar;
}
io.dcloud.f.a.e a(String str, String str2, String str3, byte b2) {
io.dcloud.f.a.e a = a(str, false);
if (a == null) {
a = new io.dcloud.f.a.e(this, str, b2);
a.p = (byte) 3;
a.m = str;
if (!PdrUtil.isEmpty(str2)) {
a.setAppDataPath(str2);
}
a.g0 = str3;
c(a);
this.d.a(str, a);
}
return a;
}
io.dcloud.f.a.e a(String str, String str2) {
return a(str, str2, (JSONObject) null);
}
io.dcloud.f.a.e a(String str, String str2, JSONObject jSONObject) {
Exception e2;
PackageInfo packageInfo;
io.dcloud.f.a.e a = a(str2, false);
if (a != null) {
try {
a.n.a();
} catch (Exception e3) {
e2 = e3;
e2.printStackTrace();
Logger.e(Logger.AppMgr_TAG, "installWebApp " + str + " is Illegal path");
return a;
}
}
boolean z = true;
if (!DHFile.isExist(str) && !PdrUtil.isDeviceRootDir(str)) {
boolean contains = str.substring(str.lastIndexOf(47)).contains(".wgt");
r4 = contains ? PlatformUtil.getResInputStream(str) : null;
if (a == null) {
a = new io.dcloud.f.a.e(this, str2, (byte) 1);
}
if (!contains && r4 == null) {
a.setAppDataPath(str + DeviceInfo.sSeparatorChar + BaseInfo.REAL_PRIVATE_WWW_DIR);
a.b(str2, jSONObject);
IOUtil.close(r4);
return a;
}
a.b(r4);
IOUtil.close(r4);
return a;
}
boolean isFile = new File(str).isFile();
if (isFile) {
if (isFile && str.toLowerCase().endsWith(".wgtu")) {
if (a != null) {
z = false;
}
if (z) {
a = new io.dcloud.f.a.e(this, str2, (byte) 0);
}
a.a(str, jSONObject);
io.dcloud.f.a.g gVar = a.n;
gVar.c = false;
gVar.d = false;
} else if (isFile && str.toLowerCase().endsWith(".wgt")) {
boolean z2 = a == null;
a.n.d = true;
if (z2) {
io.dcloud.f.a.e eVar = new io.dcloud.f.a.e(this, str2, (byte) 0);
try {
eVar.m = str2;
eVar.setAppDataPath(BaseInfo.sCacheFsAppsPath + str2 + DeviceInfo.sSeparatorChar + BaseInfo.REAL_PRIVATE_WWW_DIR);
a = eVar;
} catch (Exception e4) {
e2 = e4;
a = eVar;
e2.printStackTrace();
Logger.e(Logger.AppMgr_TAG, "installWebApp " + str + " is Illegal path");
return a;
}
}
boolean c2 = a.c(str, jSONObject);
a.n.d = false;
if (c2 && z2) {
c(a);
}
} else if (isFile && str.toLowerCase().endsWith(".apk")) {
try {
packageInfo = PlatformUtil.parseApkInfo(getContext(), str);
} catch (Exception e5) {
e5.printStackTrace();
a.n.b = StringUtil.format(DOMException.JSON_ERROR_INFO, 10, e5.getMessage());
packageInfo = null;
}
if (packageInfo == null) {
a.n.a = true;
} else {
a.n.a = false;
String str3 = packageInfo.versionName;
String str4 = packageInfo.packageName;
String charSequence = getContext().getPackageManager().getApplicationLabel(packageInfo.applicationInfo).toString();
if (charSequence == null) {
charSequence = "";
}
a.n.b = String.format("{pname:'%s',version:'%s',name:'%s'}", str4, str3, charSequence);
PlatformUtil.openFileBySystem(getContext(), str, null, null);
}
} else {
io.dcloud.f.a.g gVar2 = a.n;
gVar2.a = true;
gVar2.b = StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf((int) DOMException.CODE_RUNTIME_WGT_OR_WGTU_ERROR_MALFORMED), DOMException.MSG_RUNTIME_WGT_OR_WGTU_ERROR_MALFORMED);
}
} else {
if (a != null) {
a.b((byte) 0);
} else {
a = new io.dcloud.f.a.e(this, str2, (byte) 0);
}
a.setAppDataPath(str + DeviceInfo.sSeparatorChar + BaseInfo.REAL_PRIVATE_WWW_DIR);
a.b(str2, jSONObject);
}
IOUtil.close(r4);
return a;
}
}