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

Commit

Permalink
[WEEX-595][Android] fix report empty when too fast between render(tem…
Browse files Browse the repository at this point in the history
…plate) and destroy (#1475)
  • Loading branch information
lucky-chen authored and YorkShen committed Aug 27, 2018
1 parent 5689183 commit cb9b685
Showing 1 changed file with 18 additions and 4 deletions.
Expand Up @@ -141,13 +141,26 @@ public void checkEmptyScreenAndReport() {
return;
}
//2s limit of instance stayTime (case in\quit very fast case)
final long DIFF_LIMIT = 2000;
long useTime = 2001;
final long DIFF_LIMIT_FROM_RENDER_URL = 2000;
final long DIFF_LIMIT_FROM_RENDER_TEMPLATE = 1000;

long curTime = WXUtils.getFixUnixTime();
Long startRequestTime = mStageMap.get(WXInstanceApm.KEY_PAGE_STAGES_DOWN_BUNDLE_START);
long useTime;
String useTimeForm;
boolean shouldReportByUseTime;
if (null != startRequestTime) {
useTime = WXUtils.getFixUnixTime() - startRequestTime;
useTime = curTime - startRequestTime;
shouldReportByUseTime = useTime >= DIFF_LIMIT_FROM_RENDER_URL;
useTimeForm = WXInstanceApm.KEY_PAGE_STAGES_DOWN_BUNDLE_START;
}else {
Long startRenderTemplateTime = mStageMap.get(WXInstanceApm.KEY_PAGE_STAGES_RENDER_ORGIGIN);
useTime = null != startRenderTemplateTime?curTime - startRenderTemplateTime:curTime;
shouldReportByUseTime = useTime >= DIFF_LIMIT_FROM_RENDER_TEMPLATE;
useTimeForm = WXInstanceApm.KEY_PAGE_STAGES_RENDER_ORGIGIN;
}
if (useTime < DIFF_LIMIT) {

if (!shouldReportByUseTime){
return;
}

Expand All @@ -164,6 +177,7 @@ public void checkEmptyScreenAndReport() {
flagMap.put("wxHasDegrade",String.valueOf(hasDegrade.get()));
flagMap.put("wxHasReportScreenEmpty",String.valueOf(mHasReportScreenEmpty));
flagMap.put("wxUseTime", String.valueOf(useTime));
flagMap.put("wxUseTimeForm", useTimeForm);

WXExceptionUtils.commitCriticalExceptionRT(
instanceId,
Expand Down

0 comments on commit cb9b685

Please sign in to comment.