Commit abe3e356 authored by xujialang's avatar xujialang

icon隐藏

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