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

Commit

Permalink
[Android] fix rootView size check && performance state fix (#2607)
Browse files Browse the repository at this point in the history
1. fix rootView height&width <10 check
2. add apm state check
3. add whiteScreen whiteList check
  • Loading branch information
lucky-chen authored and YorkShen committed Jun 26, 2019
1 parent e15d075 commit c36097b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ public void onEnd() {
exceptionRecord.clear();
mUIHandler.removeCallbacks(jsPerformanceCallBack);
onStage(KEY_PAGE_STAGES_DESTROY);
apmInstance.onEnd();
if (!mHasInit){
apmInstance.onEnd();
}
mEnd = true;
if (WXEnvironment.isApkDebugable()){
printLog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.taobao.weex.WXSDKInstance;
import com.taobao.weex.WXSDKManager;
import com.taobao.weex.adapter.IWXConfigAdapter;
import com.taobao.weex.ui.IFComponentHolder;
import com.taobao.weex.ui.component.WXComponent;
import com.taobao.weex.ui.component.WXVContainer;
import org.json.JSONObject;
Expand Down Expand Up @@ -58,11 +59,33 @@ public static boolean isWhiteScreen(WXSDKInstance instance) {
if (!(v instanceof ViewGroup)) {
return false;
}
ViewGroup group = (ViewGroup)v;
if (group.getChildCount() == 0) {
return true;
if (isInWhiteList(instance)){
return false;
}
return !hasLeafViewOrSizeIgnore(group,3);
return !hasLeafViewOrSizeIgnore(v,3);
}

private static boolean isInWhiteList(WXSDKInstance instance){
IWXConfigAdapter configAdapter = WXSDKManager.getInstance().getWxConfigAdapter();
if (null == configAdapter){
return false;
}
String whiteList = configAdapter.getConfig("wxapm","ws_white_list",null);
if (TextUtils.isEmpty(whiteList)){
return false;
}
try {
String[] urlList = whiteList.split(";");
for (String whiteUrl : urlList){
if (instance.getBundleUrl() != null && instance.getBundleUrl().contains(whiteUrl)){
return true;
}
}
}catch (Exception e){
e.printStackTrace();
}

return false;
}

private static boolean hasLeafViewOrSizeIgnore(View v,int checkDeep) {
Expand Down

0 comments on commit c36097b

Please sign in to comment.