|
|
|
@ -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<Pair<String, String>> postParams = new ArrayList<>();
|
|
|
|
|
postParams.add(new Pair<String, String>("id", mCmdid));
|
|
|
|
|
postParams.add(new Pair<String, String>("XyDev", "1"));
|
|
|
|
|
postParams.add(new Pair<String, String>("bootTime", Long.toString(getBootTime())));
|
|
|
|
|
postParams.add(new Pair<String, String>("i1Version", mService.getMpAppVersion()));
|
|
|
|
|
postParams.add(new Pair<String, String>("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<Pair<String, String>> 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<String, String> pair : params) {
|
|
|
|
|
jsonObject.put(pair.first, pair.second);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
outputStreamWriter = new OutputStreamWriter(output, "UTF-8");
|
|
|
|
|
bufferedWriter = new BufferedWriter(outputStreamWriter);
|
|
|
|
|