diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java b/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java index cadf0edc..7a809238 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java @@ -3,6 +3,7 @@ package com.xypower.mpmaster; import android.content.Context; import android.os.Environment; import android.os.PowerManager; +import android.os.SystemClock; import android.text.TextUtils; import android.util.Pair; import android.util.Base64; @@ -88,6 +89,10 @@ public class AppMaster { mService = null; } + private long getBootTime() { + return (System.currentTimeMillis() - SystemClock.elapsedRealtimeNanos() / 1000000) / 1000000; + } + public void start() { new Thread(new Runnable() { @@ -125,11 +130,12 @@ public class AppMaster { List> postParams = new ArrayList<>(); postParams.add(new Pair("id", mCmdid)); postParams.add(new Pair("XyDev", "1")); + postParams.add(new Pair("bootTime", Long.toString(getBootTime()))); postParams.add(new Pair("i1Version", mService.getMpAppVersion())); postParams.add(new Pair("maintainVersion", mService.getMasterAppVersion())); - + // postParams(httpURLConnection.getOutputStream(), postParams); - buildParams(httpURLConnection.getOutputStream()); + buildParams(httpURLConnection.getOutputStream(), postParams); httpURLConnection.connect(); inputStream = httpURLConnection.getInputStream(); @@ -467,14 +473,15 @@ public class AppMaster { } } - private void buildParams(OutputStream output) { + private void buildParams(OutputStream output, List> params) { BufferedWriter bufferedWriter = null; OutputStreamWriter outputStreamWriter = null; try { JSONObject jsonObject = new JSONObject(); - jsonObject.put("id", mCmdid); - jsonObject.put("i1Version", mService.getMpAppVersion()); - jsonObject.put("maintainVersion", mService.getMasterAppVersion()); + + for (Pair pair : params) { + jsonObject.put(pair.first, pair.second); + } outputStreamWriter = new OutputStreamWriter(output, "UTF-8"); bufferedWriter = new BufferedWriter(outputStreamWriter);