[ 
https://issues.apache.org/jira/browse/WEEX-591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16591636#comment-16591636
 ] 

ASF GitHub Bot commented on WEEX-591:
-------------------------------------

YorkShen closed pull request #1471: [WEEX-591][Android] fix interaction logic
URL: https://github.com/apache/incubator-weex/pull/1471
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java 
b/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
index 780b30ce61..6e4c35b07d 100644
--- a/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
+++ b/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
@@ -1229,7 +1229,7 @@ public void onRefreshSuccess(final int width, final int 
height) {
 
   public void onChangeElement(WXComponent component, boolean isOutOfScreen) {
 
-    if (isDestroy()  || null == mRenderContainer || mWXPerformance == null){
+    if (isDestroy()  || null == mRenderContainer || mWXPerformance == null || 
"videoplus".equals(component.getComponentType())){
       return;
     }
 
diff --git 
a/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceApm.java 
b/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceApm.java
index 21e4f02a5a..f37867860d 100644
--- a/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceApm.java
+++ b/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceApm.java
@@ -203,8 +203,14 @@ public void doInit() {
         }
     }
 
-    public void setPageName(String pageName){
-        String fixPageName = 
TextUtils.isEmpty(pageName)?"emptyPageName":pageName;
+    public void setPageName(String pageName) {
+        if (TextUtils.isEmpty(pageName)) {
+            WXSDKInstance instance = 
WXSDKManager.getInstance().getAllInstanceMap().get(mInstanceId);
+            if (null != instance) {
+                pageName = 
instance.getContainerInfo().get(KEY_PAGE_PROPERTIES_CONTAINER_NAME);
+            }
+        }
+        String fixPageName = TextUtils.isEmpty(pageName) ? "emptyPageName" : 
pageName;
         addProperty(KEY_PAGE_PROPERTIES_BIZ_ID, fixPageName);
     }
 
diff --git 
a/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionMoveElement.java
 
b/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionMoveElement.java
index 8be8c52faa..b00e58cf9b 100644
--- 
a/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionMoveElement.java
+++ 
b/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionMoveElement.java
@@ -49,7 +49,7 @@ public void executeAction() {
     if (component.getHostView() != null && 
!TextUtils.equals(component.getComponentType(), "video") && 
!TextUtils.equals(component.getComponentType(), "videoplus")) {
       int[] location = new  int[2] ;
       component.getHostView().getLocationInWindow(location);
-      component.getInstance().onChangeElement(oldParent, location[1] > 
component.getInstance().getWeexHeight() + 1);
+     // component.getInstance().onChangeElement(oldParent, location[1] > 
component.getInstance().getWeexHeight() + 1);
     }
 
     oldParent.remove(component, false);
@@ -59,7 +59,7 @@ public void executeAction() {
     if (component.getHostView() != null && 
!TextUtils.equals(component.getComponentType(), "video") && 
!TextUtils.equals(component.getComponentType(), "videoplus")) {
       int[] location = new  int[2] ;
       component.getHostView().getLocationInWindow(location);
-      component.getInstance().onChangeElement(newParent, location[1] > 
component.getInstance().getWeexHeight() + 1);
+     // component.getInstance().onChangeElement(newParent, location[1] > 
component.getInstance().getWeexHeight() + 1);
     }
 
     if (!component.isVirtualComponent()) {
diff --git 
a/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionRemoveElement.java
 
b/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionRemoveElement.java
index e0c9884737..b7e45512ef 100644
--- 
a/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionRemoveElement.java
+++ 
b/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionRemoveElement.java
@@ -43,7 +43,7 @@ public void executeAction() {
     if (component.getHostView() != null && 
!TextUtils.equals(component.getComponentType(), "video") && 
!TextUtils.equals(component.getComponentType(), "videoplus")) {
       int[] location = new  int[2];
       component.getHostView().getLocationInWindow(location);
-      component.getInstance().onChangeElement(parent, location[1] > 
component.getInstance().getWeexHeight() + 1);
+      //component.getInstance().onChangeElement(parent, location[1] > 
component.getInstance().getWeexHeight() + 1);
     }
 
     parent.remove(component, true);
diff --git 
a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXImage.java 
b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXImage.java
index f54fe8b17c..961d2e4c43 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXImage.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXImage.java
@@ -471,17 +471,17 @@ private void monitorImgSize(ImageView imageView,String 
currentImgUrlStr){
     }
     int imgHeight = img.getIntrinsicHeight();
     int imgWidth = img.getIntrinsicWidth();
-    if (!preImgUrlStr.equals(currentImgUrlStr) && imgHeight > 1920 && imgWidth 
> 1080){
+    if (!preImgUrlStr.equals(currentImgUrlStr)){
       preImgUrlStr = currentImgUrlStr;
-      
instance.getApmForInstance().updateDiffStats(WXInstanceApm.KEY_PAGE_STATS_LARGE_IMG_COUNT,1);
+      if (imgHeight > 1921 && imgWidth > 1081){
+        
instance.getApmForInstance().updateDiffStats(WXInstanceApm.KEY_PAGE_STATS_LARGE_IMG_COUNT,1);
+      }
+      if (imgHeight * imgWidth > imageView.getMeasuredHeight() * 
imageView.getMeasuredWidth() +10){
+        instance.getWXPerformance().wrongImgSizeCount++;
+        
instance.getApmForInstance().updateDiffStats(WXInstanceApm.KEY_PAGE_STATS_WRONG_IMG_SIZE_COUNT,1);
+      }
     }
 
-
-    if (imgHeight * imgHeight > imageView.getMeasuredHeight() *
-            imageView.getMeasuredWidth() +10){
-      instance.getWXPerformance().wrongImgSizeCount++;
-      
instance.getApmForInstance().updateDiffStats(WXInstanceApm.KEY_PAGE_STATS_WRONG_IMG_SIZE_COUNT,1);
-    }
   }
 
   @Override
diff --git 
a/android/sdk/src/main/java/com/taobao/weex/utils/WXExceptionUtils.java 
b/android/sdk/src/main/java/com/taobao/weex/utils/WXExceptionUtils.java
index 84cc7258f2..62c5be2a5e 100644
--- a/android/sdk/src/main/java/com/taobao/weex/utils/WXExceptionUtils.java
+++ b/android/sdk/src/main/java/com/taobao/weex/utils/WXExceptionUtils.java
@@ -23,6 +23,7 @@
 
 import android.support.annotation.Nullable;
 import android.text.TextUtils;
+import com.taobao.weex.WXEnvironment;
 import com.taobao.weex.WXSDKInstance;
 import com.taobao.weex.WXSDKManager;
 import com.taobao.weex.adapter.IWXJSExceptionAdapter;
@@ -58,57 +59,74 @@ public static void commitCriticalExceptionRT(@Nullable 
final String instanceId,
                                                                                
                 @Nullable final String function,
                                                                                
                 @Nullable final String exception,
                                                                                
                 @Nullable final Map<String,String> extParams ) {
-               IWXJSExceptionAdapter adapter = 
WXSDKManager.getInstance().getIWXJSExceptionAdapter();
-               WXSDKInstance instance = null;
-               WXJSExceptionInfo exceptionCommit;
-               String bundleUrlCommit = "BundleUrlDefault";
-               String instanceIdCommit = "InstanceIdDefalut";
-               String exceptionMsgCommit = exception;
-               Map<String, String> commitMap = extParams;
-               if (null == commitMap){
-                       commitMap = new HashMap<>();
-               }
-               if (!TextUtils.isEmpty(instanceId)) {
-                       instanceIdCommit = instanceId;
-                       instance = 
WXSDKManager.getInstance().getAllInstanceMap().get(instanceId);
+               commitCriticalExceptionWithDefaultUrl(
+                   "BundleUrlDefault",
+            instanceId,
+            errCode,
+            function,
+            exception,
+            extParams
+        );
+       }
 
-                       if (null != instance) {
-                               bundleUrlCommit = instance.getBundleUrl();
-                               
commitMap.put("templateInfo",instance.getTemplateInfo());
-                               if (TextUtils.isEmpty(bundleUrlCommit) || 
bundleUrlCommit.equals(WXPerformance.DEFAULT)) {
-                                       if (!TextUtils.equals(degradeUrl, 
"BundleUrlDefaultDegradeUrl")) {
-                                               bundleUrlCommit = degradeUrl;
-                                       } else
-                                               bundleUrlCommit = 
WXSDKInstance.requestUrl;
-                               }
-                               for (Map.Entry<String,String> entry: 
instance.getContainerInfo().entrySet()){
-                                       
commitMap.put(entry.getKey(),entry.getValue());
-                               }
-                               
commitMap.put(WXInstanceExceptionRecord.KEY_EXP_STAGE_LIST,instance.getExceptionRecorder().convertStageToStr());
-                               String bundleTemplate = instance.getTemplate();
-                               commitMap.put("wxTemplateOfBundle",null == 
bundleTemplate ?"has recycle by gc":bundleTemplate);
-                               
commitMap.put("wxPageName",instance.getWXPerformance().pageName);
-                       }
-               } else {//instance is null for instance id is null
-                       if (!TextUtils.isEmpty(WXSDKInstance.requestUrl)) {
-                               bundleUrlCommit = WXSDKInstance.requestUrl;
-                       }
-                       if (commitMap.size() > 0) {
-                               bundleUrlCommit = 
TextUtils.isEmpty(commitMap.get("weexUrl")) ? commitMap.get("weexUrl")
-                                                               : 
commitMap.get("bundleUrl");
-                       }
-               }
+    public static void commitCriticalExceptionWithDefaultUrl(
+        @Nullable final String defaultUrl,
+        @Nullable final String instanceId,
+        @Nullable final WXErrorCode errCode,
+        @Nullable final String function,
+        @Nullable final String exception,
+        @Nullable final Map<String,String> extParams
+    ){
+        IWXJSExceptionAdapter adapter = 
WXSDKManager.getInstance().getIWXJSExceptionAdapter();
+        WXSDKInstance instance = null;
+        WXJSExceptionInfo exceptionCommit;
+        String bundleUrlCommit = 
TextUtils.isEmpty(defaultUrl)?"BundleUrlDefault":defaultUrl;
+        String instanceIdCommit = "InstanceIdDefalut";
+        String exceptionMsgCommit = exception;
+        Map<String, String> commitMap = extParams;
+        if (null == commitMap){
+            commitMap = new HashMap<>();
+            commitMap.put("wxSdkInitStartTime", 
String.valueOf(WXEnvironment.sSDKInitStart));
+            commitMap.put("wxSDKInitCostTime", 
String.valueOf(WXEnvironment.sSDKInitTime));
+            commitMap.put("wxSDKCurExceptionTime", 
String.valueOf(System.currentTimeMillis()));
+        }
+        if (!TextUtils.isEmpty(instanceId)) {
+            instanceIdCommit = instanceId;
+            instance = 
WXSDKManager.getInstance().getAllInstanceMap().get(instanceId);
 
-               exceptionCommit = new WXJSExceptionInfo(instanceIdCommit, 
bundleUrlCommit, errCode, function, exceptionMsgCommit, commitMap);
-               if (adapter != null) {
-                       adapter.onJSException(exceptionCommit);
-               }
+            if (null != instance) {
+                bundleUrlCommit = instance.getBundleUrl();
+                commitMap.put("templateInfo",instance.getTemplateInfo());
+                if (TextUtils.isEmpty(bundleUrlCommit) || 
bundleUrlCommit.equals(WXPerformance.DEFAULT)) {
+                    if (!TextUtils.equals(degradeUrl, 
"BundleUrlDefaultDegradeUrl")) {
+                        bundleUrlCommit = degradeUrl;
+                    } else
+                        bundleUrlCommit = WXSDKInstance.requestUrl;
+                }
+                for (Map.Entry<String,String> entry: 
instance.getContainerInfo().entrySet()){
+                    commitMap.put(entry.getKey(),entry.getValue());
+                }
+                
commitMap.put(WXInstanceExceptionRecord.KEY_EXP_STAGE_LIST,instance.getExceptionRecorder().convertStageToStr());
+                String bundleTemplate = instance.getTemplate();
+                commitMap.put("wxTemplateOfBundle",null == bundleTemplate 
?"has recycle by gc":bundleTemplate);
+            }
+        } else {//instance is null for instance id is null
+            if (commitMap.size() > 0) {
+                bundleUrlCommit = TextUtils.isEmpty(commitMap.get("weexUrl")) 
? commitMap.get("weexUrl")
+                    : commitMap.get("bundleUrl");
+            }
+        }
 
-               if (null != instance && 
exceptionCommit.getErrCode().getErrorType() != ErrorType.RENDER_ERROR){
-                       
instance.getExceptionRecorder().recordErrorMsg(exceptionCommit);
-               }
+        exceptionCommit = new WXJSExceptionInfo(instanceIdCommit, 
bundleUrlCommit, errCode, function, exceptionMsgCommit, commitMap);
+        if (adapter != null) {
+            adapter.onJSException(exceptionCommit);
+        }
 
-               WXAnalyzerDataTransfer.transferError(exceptionCommit, 
instanceId);
+        if (null != instance && exceptionCommit.getErrCode().getErrorType() != 
ErrorType.RENDER_ERROR){
+            instance.getExceptionRecorder().recordErrorMsg(exceptionCommit);
+        }
+
+        WXAnalyzerDataTransfer.transferError(exceptionCommit, instanceId);
+    }
 
-       }
 }
\ No newline at end of file


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> [Android] fix interaction logic and commit more info 
> -----------------------------------------------------
>
>                 Key: WEEX-591
>                 URL: https://issues.apache.org/jira/browse/WEEX-591
>             Project: Weex
>          Issue Type: Bug
>          Components: Android
>            Reporter: peihan
>            Assignee: YorkShen
>            Priority: Major
>
> [Android] fix interaction logic
>  
>  * fix repeat img url
>  * support default url when commit exception
>  * add init time of sdk
>  * -fix interaction logic
>  **  ignore rm op
>  ** ignore move op
>  ** ignore videoplus add op



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to