零距离 v1.0版本的 MD5 值为:250cd43fb2f0f5dc8d41b0026cf86adf
以下内容为反编译后的 a.java 源代码,内容仅作参考
package io.dcloud.g.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.os.Process;
import android.text.TextUtils;
import android.util.Log;
import android.widget.CheckBox;
import io.dcloud.PdrR;
import io.dcloud.WebAppActivity;
import io.dcloud.base.R;
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.ui.webview.WebResUtil;
import io.dcloud.common.adapter.ui.webview.WebViewFactory;
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.ErrorDialogUtil;
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.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.json.JSONException;
import org.json.JSONObject;
public final class a extends AbsMgr implements IMgr.AppEvent {
private static String i;
io.dcloud.g.a.d a;
ArrayList<String> b;
ArrayList<io.dcloud.g.a.e> c;
io.dcloud.g.a.c d;
private AlertDialog e;
JSONObject f;
private AlertDialog g;
private AlertDialog h;
public class C0050a implements ICallBack {
C0050a(a aVar) {
}
@Override
public Object onCallBack(int i, Object obj) {
String unused = a.i = 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.g.a.e c;
final CheckBox d;
final String e;
final io.dcloud.g.a.e f;
final io.dcloud.g.a.e g;
final boolean h;
c(Activity activity, String str, io.dcloud.g.a.e eVar, CheckBox checkBox, String str2, io.dcloud.g.a.e eVar2, io.dcloud.g.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()) {
Activity activity = this.a;
SP.setBundleData(activity, "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.e.dismiss();
return;
}
return;
}
a.this.e.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.g.a.e eVar = this.c;
if (eVar != null) {
eVar.x();
}
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("https://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.g.a.e a;
final boolean b;
final String c;
f(a aVar, io.dcloud.g.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 io.dcloud.g.a.e a;
final String b;
final String c;
final boolean d;
class C0051a implements ICallBack {
C0051a() {
}
@Override
public Object onCallBack(int i, Object obj) {
g gVar = g.this;
a.this.a(gVar.a, gVar.b, gVar.c, gVar.d);
return null;
}
}
g(io.dcloud.g.a.e eVar, String str, String str2, boolean z) {
this.a = eVar;
this.b = str;
this.c = str2;
this.d = z;
}
@Override
public Object onCallBack(int i, Object obj) {
if (!WebViewFactory.isOther() || WebViewFactory.isOtherInitialised() || WebViewFactory.isIsLoadOtherTimeOut()) {
a.this.a(this.a, this.b, this.c, this.d);
return null;
}
WebViewFactory.setOtherCallBack(new C0051a());
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.f = null;
if (iCore != null) {
a(iCore.obtainContext());
}
c();
b();
d();
a();
this.d = new io.dcloud.g.a.c(this);
}
private void d(io.dcloud.g.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);
}
void b() {
io.dcloud.g.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 i2 = 0; i2 < size; i2++) {
String str = strArr[i2];
BaseInfo.BaseAppInfo baseAppInfo = BaseInfo.mBaseAppInfoSet.get(str);
if (!BaseInfo.mUnInstalledAppInfoSet.containsKey(str) && !b(str)) {
io.dcloud.g.a.e b2 = b(BaseInfo.sBaseResAppsPath + str, str);
if (b2 != null && (gVar = b2.o) != null) {
if (gVar.a) {
Logger.e("AppMgr", str + " app error," + b2.o);
} else {
b2.p = baseAppInfo;
c(b2);
}
}
}
}
}
io.dcloud.g.a.e c(String str) {
return a((Activity) null, str);
}
@Override
public void dispose() {
ArrayList<io.dcloud.g.a.e> arrayList = this.c;
if (arrayList != null) {
Iterator<io.dcloud.g.a.e> it = arrayList.iterator();
while (it.hasNext()) {
it.next().g();
}
}
this.c.clear();
this.b.clear();
io.dcloud.g.a.c cVar = this.d;
if (cVar != null) {
cVar.a();
}
this.d = null;
ThreadPool.self().addThreadTask(new h(this));
}
public void e(io.dcloud.g.a.e eVar) {
this.d.b(eVar.m);
b(eVar);
}
@Override
public Object processEvent(IMgr.MgrType mgrType, int i2, Object obj) {
io.dcloud.g.a.e eVar;
Object[] objArr;
io.dcloud.g.a.e a;
boolean a2;
Object valueOf;
int intValue;
String str;
io.dcloud.g.a.e a3;
io.dcloud.g.a.e a4;
byte b2;
io.dcloud.g.a.e b3;
Intent intent;
String str2;
try {
} catch (Throwable th) {
th = th;
eVar = null;
}
if (!checkMgrId(mgrType)) {
r12 = this.mCore.dispatchEvent(mgrType, i2, obj);
} else {
boolean z = true;
switch (i2) {
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.g.a.e a5 = a(activity, valueOf2);
boolean isEmpty = TextUtils.isEmpty(a5.n0);
if (a5 != null) {
io.dcloud.g.a.e b4 = this.d.b();
io.dcloud.g.a.e a6 = this.d.a(activity, a5);
if (a6 == null || ((a6 != null && a6 != a5) || a5.r)) {
if (a5.r()) {
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.r ? activity.getIntent().getBooleanExtra(IntentConst.IS_START_FIRST_WEB, false) : false;
if (!a5.o() && z2 && !booleanExtra && a5.q == 1) {
AlertDialog alertDialog = this.e;
if (alertDialog != null && alertDialog.isShowing()) {
this.e.dismiss();
}
AlertDialog create = DialogUtil.initDialogTheme(activity, true).create();
this.e = create;
create.setCanceledOnTouchOutside(false);
String string = activity.getString(R.string.dcloud_common_app_test_tips);
CheckBox checkBox = new CheckBox(activity);
checkBox.setText(R.string.dcloud_common_app_trust_tips);
checkBox.setTextColor(-65536);
this.e.setMessage(string);
this.e.setView(checkBox, DeviceInfo.getDeivceSuitablePixel(activity, 20), 0, 0, 0);
c cVar = new c(activity, valueOf2, b4, checkBox, valueOf3, a5, a6, isEmpty);
this.e.setButton(-2, activity.getResources().getString(17039360), cVar);
this.e.setButton(-1, activity.getResources().getString(17039370), cVar);
Logger.e("yl", "test show ");
this.e.show();
} else {
a(activity, valueOf2, valueOf3, b4, a5, a6, isEmpty);
}
} else {
a(activity, valueOf2, valueOf3, b4, a5, a6, isEmpty);
if (a5.p()) {
AlertDialog alertDialog2 = this.g;
if (alertDialog2 != null && alertDialog2.isShowing()) {
this.g.dismiss();
}
AlertDialog create2 = new AlertDialog.Builder(activity, PdrR.FEATURE_LOSS_STYLE).setTitle("HTML5+ Runtime").setIcon(17301659).setMessage(StringUtil.format(activity.getString(R.string.dcloud_common_app_tips1), a5.obtainConfigProperty(AbsoluteConst.APP_UNIAPP_VERSION), BaseInfo.uniVersionV3)).setPositiveButton(activity.getString(R.string.dcloud_common_view_details), new d(this, activity)).setNegativeButton(activity.getString(R.string.dcloud_common_ignore), (DialogInterface.OnClickListener) null).create();
this.g = create2;
create2.setCanceledOnTouchOutside(false);
this.g.show();
}
if (!PlatformUtil.checkClass("io.dcloud.feature.weex.WeexFeature") && BaseInfo.isUniAppAppid(a5) && BaseInfo.isWeexUniJs(a5)) {
AlertDialog alertDialog3 = this.h;
if (alertDialog3 != null && alertDialog3.isShowing()) {
this.h.dismiss();
}
AlertDialog create3 = new AlertDialog.Builder(activity, PdrR.FEATURE_LOSS_STYLE).setTitle("HTML5+ Runtime").setIcon(17301659).setMessage(activity.getString(R.string.dcloud_common_app_tips2)).setPositiveButton(activity.getString(R.string.dcloud_common_view_details), new e(this, activity)).setNegativeButton(activity.getString(R.string.dcloud_common_ignore), (DialogInterface.OnClickListener) null).create();
this.h = create3;
create3.setCanceledOnTouchOutside(false);
this.h.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.g.a.e) objArr3[2];
} else {
a = a(String.valueOf(objArr3[2]), false);
}
if (BaseInfo.sRuntimeMode == null && a == null && !io.dcloud.g.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 str3 = (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 str32 = (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.g.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);
}
if (a3.getActivity() instanceof WebAppActivity) {
WebAppActivity webAppActivity = (WebAppActivity) a3.getActivity();
if (webAppActivity != null && !webAppActivity.isFinishing()) {
if (io.dcloud.common.ui.b.a().c(webAppActivity.getContext())) {
Intent launchIntentForPackage = webAppActivity.getApplication().getPackageManager().getLaunchIntentForPackage(webAppActivity.getApplication().getPackageName());
launchIntentForPackage.addFlags(67108864);
webAppActivity.getApplication().startActivity(launchIntentForPackage);
Process.killProcess(Process.myPid());
break;
} else {
a(a3, valueOf5, false);
break;
}
} else {
a(a3, valueOf5, false);
break;
}
} else {
a(a3, valueOf5, false);
break;
}
break;
case 4:
Object[] objArr4 = (Object[]) obj;
String valueOf6 = String.valueOf(objArr4[0]);
JSONObject jSONObject = (JSONObject) objArr4[1];
IWebview iWebview = (IWebview) objArr4[2];
String string2 = 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, iWebview.getContext().getString(R.string.dcloud_common_app_check_failed));
return objArr5;
}
if (PdrUtil.isEmpty(string2)) {
string2 = iWebview.obtainFrameView().obtainApp().obtainAppId();
}
long currentTimeMillis = System.currentTimeMillis();
Logger.d(Logger.AppMgr_TAG, "install begin _filePath = " + valueOf6 + ";_mayBeAppid = " + string2);
io.dcloud.g.a.e a7 = a(valueOf6, string2, jSONObject);
StringBuilder sb = new StringBuilder();
sb.append("install end useTime=");
sb.append(System.currentTimeMillis() - currentTimeMillis);
Logger.d(Logger.AppMgr_TAG, sb.toString());
objArr = new Object[]{Boolean.valueOf(a7.o.a), a7.o.b};
return objArr;
case 5:
io.dcloud.g.a.e c3 = c(String.valueOf(obj));
if (c3 != null) {
valueOf = c3.w();
r12 = valueOf;
break;
}
break;
case 6:
valueOf = c(String.valueOf(obj));
r12 = valueOf;
break;
case 7:
String str4 = (String) obj;
if (this.a == null) {
this.a = new io.dcloud.g.a.d(this);
}
this.a.a(str4);
Logger.d(Logger.AppMgr_TAG, "data=" + str4);
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.g.a.e) iApp).a(iWebviewStateListener, iDCloudWebviewClientListener);
}
} else {
valueOf = ((io.dcloud.g.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.g.a.e) {
a4 = (io.dcloud.g.a.e) obj;
} else {
a4 = obj instanceof Map ? a((String) ((Map) obj).get("appid"), false) : null;
}
if (a4 != null) {
a4.v();
break;
}
break;
case 11:
if (this.d.b() != null) {
objArr = this.d.b().m;
return objArr;
}
break;
case 12:
io.dcloud.g.a.e a8 = a((String) obj, false);
if (a8 != null) {
byte b5 = a8.q;
if (b5 == 3) {
byte b6 = a8.q() ? a8.q : (byte) 2;
a8.q = b6;
b2 = Byte.valueOf(b6);
} else {
b2 = Byte.valueOf(b5);
}
} else {
b2 = (byte) 1;
}
objArr = b2;
return objArr;
case 13:
io.dcloud.g.a.e eVar2 = (io.dcloud.g.a.e) obj;
if (eVar2 != null) {
objArr = Boolean.valueOf(eVar2.s());
return objArr;
}
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.o.a) {
try {
c(eVar);
objArr = eVar;
} catch (Throwable th2) {
th = th2;
Logger.w("AppMgr.processEvent", th);
objArr = eVar;
return objArr;
}
return objArr;
}
break;
case 16:
Object[] objArr7 = (Object[]) obj;
((io.dcloud.g.a.e) ((IApp) objArr7[0])).a((String) objArr7[1], 1);
break;
case 19:
valueOf = this.d.c();
r12 = valueOf;
break;
case 20:
case 21:
if (obj instanceof String) {
str2 = (String) obj;
intent = null;
} else {
Object[] objArr8 = (Object[]) obj;
Activity activity2 = (Activity) objArr8[0];
intent = (Intent) objArr8[1];
str2 = (String) objArr8[2];
}
io.dcloud.g.a.e a9 = this.d.a(str2);
r12 = Boolean.TRUE;
if (a9 != null) {
io.dcloud.g.a.e b7 = this.d.b();
if (b7 != a9) {
if (b7 != null) {
b7.x();
}
if (intent != null) {
a9.setWebAppIntent(intent);
} else {
intent = a9.obtainWebAppIntent();
}
if (21 == i2) {
intent.putExtra(IntentConst.IS_WEBAPP_REPLY, true);
}
a9.getActivity().setIntent(intent);
Logger.d(Logger.AppMgr_TAG, str2 + " will unactive change to active STREAM_START_APP");
if (a9.q == 2) {
a9.c();
break;
}
}
} else {
valueOf = Boolean.FALSE;
r12 = valueOf;
break;
}
break;
case 24:
valueOf = i;
r12 = valueOf;
break;
case 27:
io.dcloud.g.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 c(io.dcloud.g.a.e eVar) {
this.b.add(eVar.obtainAppId());
this.c.add(eVar);
}
private void a() {
if (PdrUtil.isEmpty(i)) {
DataUtil.datToJsString(BaseInfo.sUniNViewServiceJsPath, new C0050a(this));
}
}
void c() {
io.dcloud.g.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 i2 = 0; i2 < size; i2++) {
String str = strArr[i2];
if (!BaseInfo.mUnInstalledAppInfoSet.containsKey(str) && !b(str)) {
io.dcloud.g.a.e b2 = b(BaseInfo.sCacheFsAppsPath + str, str);
if (b2 != null && (gVar = b2.o) != null && !gVar.a) {
b2.deleteAppTemp();
if (SDK.isUniMPSDK()) {
b2.f0 = true;
} else {
b2.f0 = 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.f = new JSONObject(new String(DHFile.readAll(file)));
} catch (JSONException e2) {
e2.printStackTrace();
}
}
}
private void a(io.dcloud.g.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!!!");
}
void b(io.dcloud.g.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.g.a.e b(String str, String str2) {
return a(str, str2);
}
private void a(io.dcloud.g.a.e eVar) {
if (SDK.isUniMPSDK() && SDK.isEnableBackground) {
d(eVar);
}
}
public void a(Activity activity, String str, String str2, io.dcloud.g.a.e eVar, io.dcloud.g.a.e eVar2, io.dcloud.g.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.z;
cmitInfo.rptCrs = eVar2.I;
cmitInfo.rptJse = eVar2.J;
cmitInfo.plusLauncher = BaseInfo.getLaunchType(eVar2.obtainWebAppIntent());
cmitInfo.sfd = DataInterface.getStreamappFrom(eVar2.obtainWebAppIntent());
cmitInfo.needUpdate = false;
}
if (!io.dcloud.g.b.g.a() && eVar2.q == 4) {
ErrorDialogUtil.checkAppKeyErrorTips(activity);
return;
}
if (eVar2.q == 3) {
eVar2.q = eVar2.q() ? eVar2.q : (byte) 2;
}
if (eVar != null && eVar != eVar2 && eVar != eVar3) {
eVar.x();
}
byte b2 = eVar2.q;
if (b2 == 1 || ((z && !eVar2.s) || ((eVar2.t && eVar2.r) || !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(eVar2, str, str2, z));
} 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.v();
}
public void a(io.dcloud.g.a.e eVar, String str, String str2, boolean z) {
if (this.d == null) {
return;
}
boolean f2 = z ? eVar.f(str2) : eVar.g(str2);
if (!eVar.s && eVar.r) {
eVar.f(str2);
}
if (f2) {
this.d.a(str, eVar);
return;
}
Logger.e(Logger.AppMgr_TAG, str + " run failed!!!");
}
io.dcloud.g.a.e a(Activity activity, String str) {
return a(activity, str, true);
}
private io.dcloud.g.a.e a(String str, boolean z) {
return a((Activity) null, str, z);
}
private io.dcloud.g.a.e a(Activity activity, String str, boolean z) {
int indexOf;
io.dcloud.g.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.g.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, null);
if (eVar.o.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.r) {
eVar.b(str, null);
}
}
return eVar;
}
io.dcloud.g.a.e a(String str, String str2, String str3, byte b2) {
io.dcloud.g.a.e a = a(str, false);
if (a == null) {
a = new io.dcloud.g.a.e(this, str, b2);
a.q = (byte) 3;
a.m = str;
if (!PdrUtil.isEmpty(str2)) {
a.setAppDataPath(str2);
}
a.h0 = str3;
c(a);
this.d.a(str, a);
}
return a;
}
io.dcloud.g.a.e a(String str, String str2) {
return a(str, str2, (JSONObject) null);
}
io.dcloud.g.a.e a(String str, String str2, JSONObject jSONObject) {
Exception e2;
PackageInfo packageInfo;
io.dcloud.g.a.e a = a(str2, false);
if (a != null) {
try {
a.o.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.g.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.g.a.e(this, str2, (byte) 0);
}
a.a(str, jSONObject);
io.dcloud.g.a.g gVar = a.o;
gVar.c = false;
gVar.d = false;
} else if (isFile && str.toLowerCase().endsWith(".wgt")) {
boolean z2 = a == null;
a.o.d = true;
if (z2) {
io.dcloud.g.a.e eVar = new io.dcloud.g.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.o.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.o.b = StringUtil.format(DOMException.JSON_ERROR_INFO, 10, e5.getMessage());
packageInfo = null;
}
if (packageInfo == null) {
a.o.a = true;
} else {
a.o.a = false;
String str3 = packageInfo.versionName;
String str4 = packageInfo.packageName;
String charSequence = getContext().getPackageManager().getApplicationLabel(packageInfo.applicationInfo).toString();
if (charSequence == null) {
charSequence = "";
}
a.o.b = StringUtil.format("{pname:'%s',version:'%s',name:'%s'}", str4, str3, charSequence);
PlatformUtil.openFileBySystem(getContext(), str, null, null, null);
}
} else {
io.dcloud.g.a.g gVar2 = a.o;
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.g.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;
}
}