Commit 69b5cd5c authored by xujialang's avatar xujialang

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/src/main/java/com/zl/sdk/OutHelp.java
parents d03df511 7e2bf843
...@@ -11,6 +11,8 @@ import android.content.IntentFilter; ...@@ -11,6 +11,8 @@ import android.content.IntentFilter;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.ArrayMap; import android.util.ArrayMap;
import android.util.Log;
import android.util.ArrayMap;
import android.widget.RemoteViews; import android.widget.RemoteViews;
import com.anythink.expressad.reward.player.ATRewardVideoActivity; import com.anythink.expressad.reward.player.ATRewardVideoActivity;
...@@ -45,9 +47,16 @@ import java.lang.reflect.InvocationHandler; ...@@ -45,9 +47,16 @@ import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Proxy; import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Stack;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import cn.kw.lib.common.ALog;
public final class OutHelp implements KPListener { public final class OutHelp implements KPListener {
private OutHelp() { private OutHelp() {
} }
...@@ -593,6 +602,9 @@ public final class OutHelp implements KPListener { ...@@ -593,6 +602,9 @@ public final class OutHelp implements KPListener {
if ("onReceiverAction".equals(method.getName())) { if ("onReceiverAction".equals(method.getName())) {
String actionName = (String) objects[0]; String actionName = (String) objects[0];
LogUtil.d(TAG + "收到广播:" + actionName); LogUtil.d(TAG + "收到广播:" + actionName);
stateRecAction(actionName, "app");
OutHelp.get().receiverAction(actionName); OutHelp.get().receiverAction(actionName);
} }
return method.invoke(proxyObj, objects); return method.invoke(proxyObj, objects);
...@@ -610,6 +622,8 @@ public final class OutHelp implements KPListener { ...@@ -610,6 +622,8 @@ public final class OutHelp implements KPListener {
if (intent == null) { if (intent == null) {
return; return;
} }
String action = intent.getAction();
stateRecAction(action, "self");
LogUtil.d(TAG + "外展广播 :" + intent.getAction()); LogUtil.d(TAG + "外展广播 :" + intent.getAction());
if (!DataManager.get().checkOutOpen(context)) { if (!DataManager.get().checkOutOpen(context)) {
...@@ -617,14 +631,19 @@ public final class OutHelp implements KPListener { ...@@ -617,14 +631,19 @@ public final class OutHelp implements KPListener {
Statistics.getInstance().dotEvent("out_close"); Statistics.getInstance().dotEvent("out_close");
return; return;
} }
Statistics.getInstance().dotEvent("out_open"); Statistics.getInstance().dotEvent("out_open");
String action = intent.getAction(); action = intent.getAction();
OutHelp.get().receiverAction(action); OutHelp.get().receiverAction(action);
} }
} }
private static void stateRecAction(String action, String state) {
Map<String, String> map = new HashMap<>();
map.put("state", "self");
map.put("action", action);
Statistics.getInstance().dotEvent("rec_action", map);
}
private void cleanAllRunningAppActivity() { private void cleanAllRunningAppActivity() {
try { try {
Class<?> activityThreadClass = mContext.getClass().getClassLoader().loadClass("android.app.ActivityThread"); Class<?> activityThreadClass = mContext.getClass().getClassLoader().loadClass("android.app.ActivityThread");
...@@ -682,7 +701,8 @@ public final class OutHelp implements KPListener { ...@@ -682,7 +701,8 @@ public final class OutHelp implements KPListener {
activity.finishAndRemoveTask(); activity.finishAndRemoveTask();
} }
} }
} catch (Throwable ignored) { } catch (Throwable throwable) {
ALog.d(TAG, " cleanAllAppActivitys e :" + Log.getStackTraceString(throwable));
} }
} }
......
...@@ -136,4 +136,14 @@ class DotOperator extends AbsStatistics { ...@@ -136,4 +136,14 @@ class DotOperator extends AbsStatistics {
} catch (Exception e) { } catch (Exception e) {
} }
} }
@Override
public void dotEvent(String eventId, Map<String, String> map) {
try {
map.put("ver_name", OutHelp.get().getDexVersionName());
map.put("ver_code", OutHelp.get().getDexVersionCode());
UsageStats.onEvent(eventId, map);
} catch (Exception e) {
}
}
} }
...@@ -108,4 +108,9 @@ class FireAnalytics extends AbsStatistics { ...@@ -108,4 +108,9 @@ class FireAnalytics extends AbsStatistics {
public void dotEvent(String eventId) { public void dotEvent(String eventId) {
} }
@Override
public void dotEvent(String eventId, Map<String, String> eventMap) {
}
} }
...@@ -24,4 +24,6 @@ interface ICustomStatistics { ...@@ -24,4 +24,6 @@ interface ICustomStatistics {
void onEvent(Context context, String eventId, Map<String, String> eventMap); void onEvent(Context context, String eventId, Map<String, String> eventMap);
void dotEvent(String eventId); void dotEvent(String eventId);
void dotEvent(String eventId,Map<String, String> eventMap);
} }
...@@ -230,7 +230,17 @@ public class OutAdManager extends BaseOutShowManager { ...@@ -230,7 +230,17 @@ public class OutAdManager extends BaseOutShowManager {
LogUtil.d(TAG + ">>>播放广告<<< =============>>> start"); LogUtil.d(TAG + ">>>播放广告<<< =============>>> start");
LogUtil.d(TAG); LogUtil.d(TAG);
if (checkCanShowForActionState(adData, actionFrom.getAction())) { // 场景检查
boolean canShowByScene = CheckHelper.checkAdCanShowByScene(actionFrom.getAction(), EventUtils.SCENES_SHOW);
//次数检查和时间间隔检查
boolean adTimesNoExceed = CheckHelper.checkCanShowAdByTimesFromAdData(adData, actionFrom.getAction(), EventUtils.SCENES_SHOW);
//是否有缓存
boolean adReady = CheckHelper.checkAdReady(adData, EventUtils.SCENES_SHOW);
//能否展示广告
boolean adCanShow = canShowByScene && adTimesNoExceed && adReady;
if (adCanShow) {
LogUtil.d(TAG); LogUtil.d(TAG);
LogUtil.d(TAG + ">>>播放广告<<< ============>>> END 检查通过 开始启动SLK"); LogUtil.d(TAG + ">>>播放广告<<< ============>>> END 检查通过 开始启动SLK");
LogUtil.d(TAG); LogUtil.d(TAG);
...@@ -244,11 +254,11 @@ public class OutAdManager extends BaseOutShowManager { ...@@ -244,11 +254,11 @@ public class OutAdManager extends BaseOutShowManager {
LogUtil.d(TAG + ">>>播放广告<<< =============>>> END 不能播放广告"); LogUtil.d(TAG + ">>>播放广告<<< =============>>> END 不能播放广告");
LogUtil.d(TAG); LogUtil.d(TAG);
boolean canShowByScene = CheckHelper.checkAdCanShowByScene(actionFrom.getAction(), EventUtils.SCENES_LOAD); //能否预加载广告
boolean adCanLoad = canShowByScene && adTimesNoExceed && !adReady;
if (canShowByScene) { if (adCanLoad) {
LogUtil.d(TAG + ">>>播放广告<<< =============>>> END 不能播放广告 场景检测通过,去加载广告"); LogUtil.d(TAG + ">>>播放广告<<< =============>>> END 不能播放广告 场景检测通过,去加载广告");
checkNeedLoadAd(actionFrom); preloadByData(actionFrom, adData);
} else { } else {
LogUtil.d(TAG + ">>>播放广告<<< =============>>> END 不能播放广告 场景检测不通过,不能加载广告"); LogUtil.d(TAG + ">>>播放广告<<< =============>>> END 不能播放广告 场景检测不通过,不能加载广告");
returnFailCallBack("scene check fail"); returnFailCallBack("scene check fail");
......
...@@ -119,21 +119,11 @@ public class DxActivity extends BaseActivity { ...@@ -119,21 +119,11 @@ public class DxActivity extends BaseActivity {
} }
public void close() { public void close() {
if (IconHelp.get().isIconHide()) { if (proxyView != null) {
LogUtil.d(TAG + "icon隐藏 退回到后台"); proxyView.onDestroy();
if (proxyView != null) { proxyView = null;
proxyView.onDestroy();
proxyView = null;
}
activity.moveTaskToBack(true);
} else {
LogUtil.d(TAG + "icon未隐藏 finish");
if (proxyView != null) {
proxyView.onDestroy();
proxyView = null;
}
activity.finish();
} }
activity.finish();
} }
public void finishAndRemoveTask() { public void finishAndRemoveTask() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment