You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by GitBox <gi...@apache.org> on 2019/01/03 13:03:23 UTC
[GitHub] zshshr closed pull request #2002: * [Android] build fix
zshshr closed pull request #2002: * [Android] build fix
URL: https://github.com/apache/incubator-weex/pull/2002
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/common/WXPerformance.java b/android/sdk/src/main/java/com/taobao/weex/common/WXPerformance.java
index b70c42f410..1a8532ac7b 100644
--- a/android/sdk/src/main/java/com/taobao/weex/common/WXPerformance.java
+++ b/android/sdk/src/main/java/com/taobao/weex/common/WXPerformance.java
@@ -175,6 +175,8 @@ public double getMaxRange() {
public long interactionTime;
+ public long interactionRealUnixTime;
+
public int interactionViewAddCount;
public int interactionViewAddLimitCount;
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 c1d8330c7c..4cb4f8a2ff 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
@@ -18,6 +18,7 @@
*/
package com.taobao.weex.performance;
+import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -132,6 +133,11 @@
public boolean hasAddView;
private Handler mUIHandler;
+ /**
+ * send performance value to js
+ **/
+ private boolean hasSendInteractionToJS = false;
+
public WXInstanceApm(String instanceId) {
mInstanceId = instanceId;
extInfo = new ConcurrentHashMap<>();
@@ -357,6 +363,7 @@ public void arriveInteraction(WXComponent targetComponent) {
}
performanceRecord.interactionTime = curTime - performanceRecord.renderUnixTimeOrigin;
+ performanceRecord.interactionRealUnixTime = System.currentTimeMillis();
onStageWithTime(KEY_PAGE_STAGES_INTERACTION,curTime);
updateDiffStats(KEY_PAGE_STATS_I_SCREEN_VIEW_COUNT, 1);
@@ -474,4 +481,28 @@ public void actionLoadImgResult(boolean succeed, String errorCode) {
updateDiffStats(WXInstanceApm.KEY_PAGE_STATS_IMG_LOAD_FAIL_NUM, 1);
}
}
+
+ public void sendPerformanceToJS() {
+ if (hasSendInteractionToJS) {
+ return;
+ }
+ hasSendInteractionToJS = true;
+ WXSDKInstance instance = WXSDKManager.getInstance().getAllInstanceMap().get(mInstanceId);
+ if (null == instance) {
+ return;
+ }
+
+ Map<String,String> sendProperties = new HashMap<>(2);
+ sendProperties.put(KEY_PAGE_PROPERTIES_BIZ_ID,reportPageName);
+ sendProperties.put(KEY_PAGE_PROPERTIES_BUBDLE_URL,instance.getBundleUrl());
+
+ Map<String,Long> sendStage = new HashMap<>(1);
+ sendStage.put(KEY_PAGE_STAGES_INTERACTION,instance.getWXPerformance().interactionRealUnixTime);
+
+ Map<String, Object> data = new HashMap<>(2);
+ data.put("stage",sendStage);
+ data.put("properties",sendProperties);
+
+ instance.fireGlobalEventCallback("wx_apm", data);
+ }
}
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services