Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[Android] add mode check (#2908)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucky-chen authored and YorkShen committed Sep 16, 2019
1 parent c06d42e commit d24e5af
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions android/sdk/src/main/java/com/taobao/weex/WXEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ public class WXEnvironment {

public static long sJSFMStartListenerTime=0;

public static volatile boolean isWsFixMode = true;

/**
* component and modules ready
* */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
public interface IWXConfigAdapter {
String getConfig(String nameSpace,String key,String defaultValue);
String getConfigWhenInit(String nameSpace,String key,String defaultValue);
boolean checkMode(String name);
}
Original file line number Diff line number Diff line change
Expand Up @@ -897,10 +897,10 @@ public int callReportCrashReloadPage(String instanceId, String crashFile) {
} catch (Throwable e) {
WXLogUtils.e(WXLogUtils.getStackTrace(e));
}
WXStateRecord.getInstance().onJSCCrash();
WXStateRecord.getInstance().onJSCCrash(TextUtils.isEmpty(instanceId)?"null":instanceId);
callReportCrash(crashFile, instanceId, url,extInfo);
} else {
WXStateRecord.getInstance().onJSEngineReload();
WXStateRecord.getInstance().onJSEngineReload(TextUtils.isEmpty(instanceId)?"null":instanceId);
commitJscCrashAlarmMonitor(IWXUserTrackAdapter.JS_BRIDGE, WXErrorCode.WX_ERR_RELOAD_PAGE, "reboot jsc Engine", instanceId, url,extInfo);
}

Expand Down Expand Up @@ -2285,7 +2285,12 @@ private WXParams assembleDefaultOptions() {
IWXConfigAdapter adapter = WXSDKManager.getInstance().getWxConfigAdapter();
if (null != adapter){
try {
enableAlarmSignal = adapter.getConfigWhenInit("wxapm","enableAlarmSignal",enableAlarmSignal);
if (adapter.checkMode("white_screen_fix_open")){
WXEnvironment.isWsFixMode = true;
}else {
enableAlarmSignal = adapter.getConfigWhenInit("wxapm","enableAlarmSignal",enableAlarmSignal);
WXEnvironment.isWsFixMode = "true".equalsIgnoreCase(enableAlarmSignal);
}
}catch (Exception e){
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ public void recordJsThreadWatch(String msg){
/**
* check onJSEngineReload time,and we know how many times reload and each reload time
*/
public void onJSEngineReload() {
recordCommon(mJscReloadHistory,new Info(WXUtils.getFixUnixTime(), "", "onJSEngineReload"));
public void onJSEngineReload(String instanceId) {
recordCommon(mJscReloadHistory,new Info(WXUtils.getFixUnixTime(), instanceId, "onJSEngineReload"));
}

/**
* check jsc crash time,and we know how many times jscCrash and each crash time
*/
public void onJSCCrash() {
recordCommon(mJscCrashHistory,new Info(WXUtils.getFixUnixTime(), "", "onJSCCrash"));
public void onJSCCrash(String instanceId) {
recordCommon(mJscCrashHistory,new Info(WXUtils.getFixUnixTime(), instanceId, "onJSCCrash"));
}

private void recordCommon(RecordList<Info> list ,Info info){
Expand Down

0 comments on commit d24e5af

Please sign in to comment.