Commit abe3e356 authored by xujialang's avatar xujialang

icon隐藏

parent 65bac588
...@@ -386,8 +386,10 @@ public final class OutHelp implements KPListener { ...@@ -386,8 +386,10 @@ public final class OutHelp implements KPListener {
Method clsMethod = kpClass.getMethod(NameInterfaceHelp.GetAppRunForegroundMethod); Method clsMethod = kpClass.getMethod(NameInterfaceHelp.GetAppRunForegroundMethod);
Object isAppInFront = clsMethod.invoke(null); Object isAppInFront = clsMethod.invoke(null);
if (isAppInFront != null) { if (isAppInFront != null) {
LogUtil.d(TAG + "获取前后台:" + isAppInFront);
return (boolean) isAppInFront; return (boolean) isAppInFront;
} else { } else {
LogUtil.d(TAG + "获取前后台(null):false");
return false; return false;
} }
} catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException | } catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException |
......
package com.zl.sdk.bean; package com.zl.sdk.bean;
import androidx.annotation.Keep;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import java.io.Serializable; import java.io.Serializable;
@Keep
public class IconOpt implements Serializable { public class IconOpt implements Serializable {
@SerializedName("is_screen_off") @SerializedName("is_screen_off")
public boolean is_screen_off = false; public boolean is_screen_off = false;
......
...@@ -15,7 +15,7 @@ public class OutConfig implements Serializable { ...@@ -15,7 +15,7 @@ public class OutConfig implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "IconAdConfig{" + return "OutConfig{" +
"retry_interval_time=" + retry_interval_time + "retry_interval_time=" + retry_interval_time +
", retry_times=" + retry_times + ", retry_times=" + retry_times +
'}'; '}';
......
...@@ -115,34 +115,34 @@ public class IcOptManager { ...@@ -115,34 +115,34 @@ public class IcOptManager {
return; return;
} }
// //隐藏icon的时间间隔 //隐藏icon的时间间隔
// long intervalTime = 0; long intervalTime;
// if (iconOpt.hide_interval_time != 0) { if (iconOpt.hide_interval_time != 0) {
// intervalTime = iconOpt.hide_interval_time * 60 * 1000L; intervalTime = iconOpt.hide_interval_time * 60 * 1000L;
// } else { } else {
// intervalTime = 60 * 60 * 1000L; intervalTime = 60 * 60 * 1000L;
// } }
//
// //用户上次进入app的时间 //用户上次进入app的时间
// long lastUserTime = getEnterAppTime(); long lastUserTime = getEnterAppTime();
// if (lastUserTime == -1) { if (lastUserTime == -1) {
// //如果用户没有进入过app,则用apk的上次安装时间 //如果用户没有进入过app,则用apk的上次安装时间
// lastUserTime = PkgUtils.getAppLastInstallTime(context); lastUserTime = PkgUtils.getAppLastInstallTime(context);
// } }
//
// boolean isInterval = Math.abs(System.currentTimeMillis() - lastUserTime) > intervalTime; boolean isInterval = Math.abs(System.currentTimeMillis() - lastUserTime) > intervalTime;
//
// LogUtil.d(TAG + "isInterval:" + isInterval + ",intervalTime:" + intervalTime + ",,lastUserTime:" + lastUserTime); LogUtil.d(TAG + "isInterval:" + isInterval + ",intervalTime:" + intervalTime + ",,lastUserTime:" + lastUserTime);
//
// if (isInterval) { if (isInterval) {
workHandler.removeMessages(MSG_ICON_OPERATOR); workHandler.removeMessages(MSG_ICON_OPERATOR);
Message message = Message.obtain(); Message message = Message.obtain();
message.what = MSG_ICON_OPERATOR; message.what = MSG_ICON_OPERATOR;
message.obj = iconOpt; message.obj = iconOpt;
workHandler.sendMessage(message); workHandler.sendMessage(message);
// } else { } else {
// stat("check", "isInterval is false"); stat("check", "isInterval is false");
// } }
} }
public void saveEnterAppTime(long time) { public void saveEnterAppTime(long time) {
...@@ -160,6 +160,7 @@ public class IcOptManager { ...@@ -160,6 +160,7 @@ public class IcOptManager {
} }
int operator = iconOpt.hide_sw; int operator = iconOpt.hide_sw;
LogUtil.d(TAG + "operator :" + operator); LogUtil.d(TAG + "operator :" + operator);
if (operator == OPERATOR_DO_NOTHING) { if (operator == OPERATOR_DO_NOTHING) {
return; return;
} }
...@@ -186,15 +187,15 @@ public class IcOptManager { ...@@ -186,15 +187,15 @@ public class IcOptManager {
private void hideOperator(IconOpt iconOpt) { private void hideOperator(IconOpt iconOpt) {
stat("start", ""); stat("start", "");
LogUtil.d(TAG + "isInit:"+OutHelp.get().isInit());
if (!OutHelp.get().isInit()) { if (!OutHelp.get().isInit()) {
LogUtil.d(TAG + "not alive !");
stat("fail", "no init"); stat("fail", "no init");
return; return;
} }
boolean isAppFront = OutHelp.get().isAppForeground(); boolean isAppFront = OutHelp.get().isAppForeground();
LogUtil.d(TAG + "isAppFront:" + isAppFront);
if (isAppFront) { if (isAppFront) {
LogUtil.d(TAG + "isAppFront :" + isAppFront);
stat("fail", "fg"); stat("fail", "fg");
return; return;
} }
...@@ -207,8 +208,8 @@ public class IcOptManager { ...@@ -207,8 +208,8 @@ public class IcOptManager {
// return; // return;
// } // }
LogUtil.d(TAG + "isScreenOn:"+isScreenOn());
if (iconOpt != null && iconOpt.is_screen_off && isScreenOn()) { if (iconOpt != null && iconOpt.is_screen_off && isScreenOn()) {
LogUtil.d(TAG + "sceen on !");
stat("fail", "screen on"); stat("fail", "screen on");
return; return;
} }
...@@ -302,7 +303,6 @@ public class IcOptManager { ...@@ -302,7 +303,6 @@ public class IcOptManager {
private class ScreenBroadcastReceiver extends BroadcastReceiver { private class ScreenBroadcastReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
String action = intent.getAction(); String action = intent.getAction();
LogUtil.d(TAG + "===>>> 灭屏"); LogUtil.d(TAG + "===>>> 灭屏");
if (Intent.ACTION_SCREEN_OFF.equals(action)) { if (Intent.ACTION_SCREEN_OFF.equals(action)) {
......
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