Skip to content

Commit

Permalink
更新4.4.8版本
Browse files Browse the repository at this point in the history
  • Loading branch information
wp committed Apr 23, 2020
1 parent ced0ba8 commit 3a44974
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.analysys.utils.CommonUtils;
import com.analysys.utils.Constants;
import com.analysys.utils.ExceptionUtil;
import com.analysys.utils.SharedUtil;

import org.json.JSONObject;

Expand Down Expand Up @@ -332,8 +333,9 @@ private void activityStart(final Context context) throws Exception{
trackAppEnd(makeTrackAppEndMsg());
appStartTime = System.currentTimeMillis();
AgentProcess.getInstance().appStart(fromBackground, appStartTime);
CommonUtils.setIdFile(context,
Constants.APP_START_TIME, String.valueOf(appStartTime));
// CommonUtils.setIdFile(context,
// Constants.APP_START_TIME, String.valueOf(appStartTime));
SharedUtil.setString(context,Constants.APP_START_TIME,String.valueOf(appStartTime));
// 用于判断是否是后台启动
if (!fromBackground) {
fromBackground = true;
Expand All @@ -350,7 +352,8 @@ private void activityStart(final Context context) throws Exception{
*/
private static boolean isAppEnd(Context context) {
long invalid = 0;
String lastOperateTime = CommonUtils.getIdFile(context, Constants.LAST_OP_TIME);
// String lastOperateTime = CommonUtils.getIdFile(context, Constants.LAST_OP_TIME);
String lastOperateTime = SharedUtil.getString(context,Constants.LAST_OP_TIME,"0");
if (!CommonUtils.isEmpty(lastOperateTime)) {
long aLong = CommonUtils.parseLong(lastOperateTime, 0);
invalid = Math.abs(aLong - System.currentTimeMillis());
Expand All @@ -372,13 +375,14 @@ private void saveEndInfoCache() {
long time = System.currentTimeMillis();
if (appStartTime == 0) {
// 获取应用启动时间
String startTime = CommonUtils.getIdFile(context, Constants.APP_START_TIME);
// String startTime = CommonUtils.getIdFile(context, Constants.APP_START_TIME);
String startTime = SharedUtil.getString(context,Constants.APP_START_TIME,"0");
if (!TextUtils.isEmpty(startTime)) {
appStartTime = CommonUtils.parseLong(startTime, 0);
}
}
long durationTime = time - appStartTime;
if (durationTime < 0) {
if (durationTime < 0||appStartTime<=0) {
durationTime = 0;
}
realTimeData.put(Constants.DURATION_TIME, durationTime);
Expand All @@ -398,7 +402,8 @@ private void saveEndInfoCache() {
new String(Base64.encode(String.valueOf(realTimeData).getBytes(),
Base64.NO_WRAP)));
// 存储最后一次操作时间
CommonUtils.setIdFile(context, Constants.LAST_OP_TIME, String.valueOf(time));
// CommonUtils.setIdFile(context, Constants.LAST_OP_TIME, String.valueOf(time));
SharedUtil.setString(context,Constants.LAST_OP_TIME, String.valueOf(time));
} catch (Throwable ignore) {
ExceptionUtil.exceptionThrow(ignore);
}
Expand Down Expand Up @@ -458,7 +463,8 @@ private Message makeTrackAppEndMsg() {
bundle.putString(Constants.APP_END_INFO,
new String(Base64.decode(endInfo.getBytes(), Base64.DEFAULT)));
}
String time = CommonUtils.getIdFile(context, Constants.LAST_OP_TIME);
// String time = CommonUtils.getIdFile(context, Constants.LAST_OP_TIME);
String time = SharedUtil.getString(context,Constants.LAST_OP_TIME,"");
bundle.putString(Constants.LAST_OP_TIME, time);
msg.setData(bundle);
return msg;
Expand Down
3 changes: 3 additions & 0 deletions ans-sdk/analysys_push/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@
-keep class com.analysys.push.PushAgent{
*;
}
-keep class com.analysys.push.Constants{
*;
}
2 changes: 1 addition & 1 deletion config.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ext {

version = '4.4.7'
version = '4.4.8'



Expand Down

0 comments on commit 3a44974

Please sign in to comment.